X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=CMakeLists.txt;h=44ea757580021415f83f16c2ed3c1d71ce09a0a9;hb=d3acd7fa1309b73959a34290cc27c8c91c8180d7;hp=81a7d67d6aeaaa02696a6e6d47cbcdccbebc5e99;hpb=1c7d28a2fc93699ab955ea66203d0c36bba9d977;p=lugaru.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 81a7d67..44ea757 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -138,13 +138,40 @@ if(MSVC) # MSVC non-C99 support biting us hard endif(MSVC) if(WIN32) - ENABLE_LANGUAGE(RC) - - # !!! FIXME: get rid of WinDefs.{cpp,h} + if(CMAKE_CROSSCOMPILING) + ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lugaru_resource.obj + COMMAND ${CMAKE_RC_COMPILER} + -I${SRCDIR}/win-res + -o ${CMAKE_CURRENT_BINARY_DIR}/lugaru_resource.obj + -i${SRCDIR}/win-res/Lugaru.rc + DEPENDS ${SRCDIR}/win-res/Lugaru.rc + ) + endif(CMAKE_CROSSCOMPILING) + if(NOT CMAKE_CROSSCOMPILING) + if(MSVC) + ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lugaru_resource.obj + COMMAND rc + -I${SRCDIR}/win-res + -fo${CMAKE_CURRENT_BINARY_DIR}/lugaru_resource.obj + ${SRCDIR}/win-res/Lugaru.rc + DEPENDS ${SRCDIR}/win-res/Lugaru.rc + ) + endif(MSVC) + if(MINGW) + ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lugaru_resource.obj + COMMAND windres + -I${SRCDIR}/win-res + -o ${CMAKE_CURRENT_BINARY_DIR}/lugaru_resource.obj + -i${SRCDIR}/win-res/Lugaru.rc + DEPENDS ${SRCDIR}/win-res/Lugaru.rc + ) + endif(MINGW) + endif(NOT CMAKE_CROSSCOMPILING) + + # !!! FIXME: get rid of this. set(LUGARU_SRCS - ${LUGARU_SRCS} - ${SRCDIR}/WinDefs.cpp - ${SRCDIR}/win-res/Lugaru.rc) + ${LUGARU_SRCS} + ${SRCDIR}/WinDefs.cpp) set(LUGARU_H ${LUGARU_H} @@ -159,16 +186,10 @@ endif (APPLE) # Deal with dependencies... find_package(OpenGL REQUIRED) # force this include dir no matter what on Windows, so we get sane headers. -if(NOT WIN32) - option (LUGARU_FORCE_INTERNAL_OPENGL "Force internal OpenGL headers, even if there's a system version" True) - if (LUGARU_FORCE_INTERNAL_OPENGL) - include_directories("${DEPDIR}/OpenGL") - endif (LUGARU_FORCE_INTERNAL_OPENGL) -endif(NOT WIN32) - -if(WIN32) +option (LUGARU_FORCE_INTERNAL_OPENGL "Force internal OpenGL headers, even if there's a system version" True) +if (LUGARU_FORCE_INTERNAL_OPENGL) include_directories("${DEPDIR}/OpenGL") -endif(WIN32) +endif (LUGARU_FORCE_INTERNAL_OPENGL) if(MSVC) # More Visual Studio annoyances include_directories("${DEPDIR}/msinttypes") @@ -176,7 +197,12 @@ endif(MSVC) option (LUGARU_FORCE_INTERNAL_OPENAL "Force internal libOpenAL, even if there's a system version" False) if (NOT LUGARU_FORCE_INTERNAL_OPENAL) - find_package(OpenAL REQUIRED) + # FIXME: We should remove bundled libs and allow building OpenAL from source, for all platforms + if (WIN32) + find_package(OpenAL) + else (WIN32) + find_package(OpenAL REQUIRED) + endif() else(NOT LUGARU_FORCE_INTERNAL_OPENAL) set(OPENAL_FOUND False) endif (NOT LUGARU_FORCE_INTERNAL_OPENAL) @@ -418,10 +444,14 @@ include_directories( ${CMAKE_SOURCE_DIR}/Source ) -set(LUGARU_LIBS ${OPENAL_LIBRARY} ${PNG_LIBRARY} ${JPEG_LIBRARY} ${ZLIB_LIBRARIES} ${SDL2_LIBRARIES} ${OPENGL_glu_LIBRARY} ${VORBISFILE_LIBRARY} ${OGG_LIBRARY} ${PLATFORM_LIBS}) +set(LUGARU_LIBS ${OPENAL_LIBRARY} ${PNG_LIBRARY} ${JPEG_LIBRARY} ${ZLIB_LIBRARIES} ${SDL2_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${VORBISFILE_LIBRARY} ${OGG_LIBRARY} ${PLATFORM_LIBS}) -add_executable(lugaru ${LUGARU_SRCS} ${LUGARU_H}) +if(WIN32) + add_executable(lugaru ${LUGARU_SRCS} ${LUGARU_H} lugaru_resource.obj) +else(WIN32) + add_executable(lugaru ${LUGARU_SRCS} ${LUGARU_H}) +endif(WIN32) target_link_libraries(lugaru ${LUGARU_LIBS})