Browse Source

Fix try_compile execution for MinGW STATIC build and 32-bit build.
[ccache clear]

Yao Wei Tjong 姚伟忠 10 years ago
parent
commit
df18e41ee6
2 changed files with 5 additions and 2 deletions
  1. 0 1
      .appveyor.yml
  2. 5 1
      CMake/Modules/FindUrho3D.cmake

+ 0 - 1
.appveyor.yml

@@ -32,7 +32,6 @@ environment:
     secure: cc1q9CXo5BwIYqtgigHpkCGG90zEVM45xx/YzXTOjVp512oQNUzTJq0AmxEYXP78
     secure: cc1q9CXo5BwIYqtgigHpkCGG90zEVM45xx/YzXTOjVp512oQNUzTJq0AmxEYXP78
   build_tree: native-Build
   build_tree: native-Build
   config: Release
   config: Release
-  PreferredToolArchitecture: x64
   matrix:
   matrix:
     - URHO3D_LIB_TYPE: STATIC
     - URHO3D_LIB_TYPE: STATIC
     - URHO3D_LIB_TYPE: SHARED
     - URHO3D_LIB_TYPE: SHARED

+ 5 - 1
CMake/Modules/FindUrho3D.cmake

@@ -181,14 +181,18 @@ else ()
         get_filename_component (EXT ${URHO3D_LIBRARIES} EXT)
         get_filename_component (EXT ${URHO3D_LIBRARIES} EXT)
         if (EXT STREQUAL .a)
         if (EXT STREQUAL .a)
             set (URHO3D_LIB_TYPE STATIC)
             set (URHO3D_LIB_TYPE STATIC)
+            set (COMPILE_DEFINITIONS COMPILE_DEFINITIONS -DURHO3D_STATIC_DEFINE)
         else ()
         else ()
             set (URHO3D_LIB_TYPE SHARED)
             set (URHO3D_LIB_TYPE SHARED)
         endif ()
         endif ()
     endif ()
     endif ()
     # Ensure the module has found the library with the right ABI for the chosen compiler and URHO3D_64BIT build option
     # Ensure the module has found the library with the right ABI for the chosen compiler and URHO3D_64BIT build option
     if (URHO3D_LIBRARIES AND NOT IOS)
     if (URHO3D_LIBRARIES AND NOT IOS)
+        if (NOT URHO3D_64BIT AND NOT MSVC AND NOT MINGW AND NOT ANDROID AND NOT RPI AND NOT EMSCRIPTEN)
+            set (COMPILE_LINKER_DEFINITIONS -DCOMPILE_DEFINITIONS:STRING=-m32)
+        endif ()
         try_compile (COMPILE_RESULT ${CMAKE_BINARY_DIR}/generated/FindUrho3D ${CMAKE_CURRENT_LIST_DIR}/CheckUrho3DLibrary.cpp
         try_compile (COMPILE_RESULT ${CMAKE_BINARY_DIR}/generated/FindUrho3D ${CMAKE_CURRENT_LIST_DIR}/CheckUrho3DLibrary.cpp
-            CMAKE_FLAGS -DINCLUDE_DIRECTORIES:STRING=${URHO3D_INCLUDE_DIRS}
+            CMAKE_FLAGS -DINCLUDE_DIRECTORIES:STRING=${URHO3D_INCLUDE_DIRS} ${COMPILE_LINKER_DEFINITIONS} ${COMPILE_DEFINITIONS}
             LINK_LIBRARIES ${URHO3D_LIBRARIES})
             LINK_LIBRARIES ${URHO3D_LIBRARIES})
     endif ()
     endif ()
     # For shared library type, also initialize the URHO3D_DLL variable for later use
     # For shared library type, also initialize the URHO3D_DLL variable for later use