]> git.jsancho.org Git - lugaru.git/commitdiff
Revert "Remove superfluous explicit command for windres/rc"
authorNeal Gompa <ngompa13@gmail.com>
Fri, 18 Nov 2016 20:09:14 +0000 (15:09 -0500)
committerNeal Gompa <ngompa13@gmail.com>
Fri, 18 Nov 2016 20:10:20 +0000 (15:10 -0500)
For the moment, we're going back to the old way for supporting
the cross-compiler. However, we're still going to depend on
CMake 3.5 or newer for other features.

This partially reverts commit 4df6d827a1a3837142051de155083a3e36409959.

.gitlab-ci.yml
CMakeLists.txt

index 959884c95d50056c21551b756ab756245413357d..776f83bc4e1cd1e162be87c2dc7df74052b44742 100644 (file)
@@ -69,3 +69,4 @@ build_mingw64:
       - ./mingw64-build
   tags:
     - shared
+
index 81a7d67d6aeaaa02696a6e6d47cbcdccbebc5e99..e715fffff13334b6bc2366f9441b211b2c1ef105 100644 (file)
@@ -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}
@@ -421,7 +448,11 @@ include_directories(
 set(LUGARU_LIBS ${OPENAL_LIBRARY} ${PNG_LIBRARY} ${JPEG_LIBRARY} ${ZLIB_LIBRARIES} ${SDL2_LIBRARIES} ${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})