Browse Source

CMake: Add temporary solution for generating dtool_config.h

Eventually, we'll want to customize dtool_config.h based on the
configuration being used, but this should be good enough for now.
Donny Lawrence 6 years ago
parent
commit
20db4115b8
3 changed files with 18 additions and 1 deletions
  1. 6 0
      CMakeLists.txt
  2. 8 1
      dtool/LocalSetup.cmake
  3. 4 0
      panda/src/configfiles/CMakeLists.txt

+ 6 - 0
CMakeLists.txt

@@ -15,6 +15,12 @@ enable_testing()
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/macros/")
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/macros/")
 
 
+if(CMAKE_VERSION VERSION_GREATER "3.8")
+  # When using the Xcode generator, don't append the platform name to the
+  # intermediate configuration directory.
+  set_property(GLOBAL PROPERTY XCODE_EMIT_EFFECTIVE_PLATFORM_NAME OFF)
+endif()
+
 # Include global modules needed for configure scripts
 # Include global modules needed for configure scripts
 include(PackageConfig)      # Defines package_option
 include(PackageConfig)      # Defines package_option
 
 

+ 8 - 1
dtool/LocalSetup.cmake

@@ -193,7 +193,14 @@ else()
   set(intdir "${CMAKE_BUILD_TYPE}")
   set(intdir "${CMAKE_BUILD_TYPE}")
 endif()
 endif()
 
 
-configure_file(dtool_config.h.in "${PROJECT_BINARY_DIR}/${intdir}/include/dtool_config.h")
+configure_file(dtool_config.h.in "${PROJECT_BINARY_DIR}/include/dtool_config.h")
+
+# TODO: Add the ability to customize dtool_config.h based on configuration.
+if(IS_MULTICONFIG)
+  file(GENERATE OUTPUT "${PROJECT_BINARY_DIR}/$<CONFIG>/include/dtool_config.h"
+                INPUT "${PROJECT_BINARY_DIR}/include/dtool_config.h")
+endif()
+
 install(FILES "${PROJECT_BINARY_DIR}/${intdir}/include/dtool_config.h"
 install(FILES "${PROJECT_BINARY_DIR}/${intdir}/include/dtool_config.h"
   COMPONENT CoreDevel
   COMPONENT CoreDevel
   DESTINATION include/panda3d)
   DESTINATION include/panda3d)

+ 4 - 0
panda/src/configfiles/CMakeLists.txt

@@ -24,5 +24,9 @@ else()
 endif()
 endif()
 
 
 configure_file(panda.prc.in "${CMAKE_BINARY_DIR}/etc/20_panda.prc")
 configure_file(panda.prc.in "${CMAKE_BINARY_DIR}/etc/20_panda.prc")
+if(IS_MULTICONFIG)
+  file(GENERATE OUTPUT "${PROJECT_BINARY_DIR}/$<CONFIG>/etc/20_panda.prc"
+                INPUT "${PROJECT_BINARY_DIR}/etc/20_panda.prc")
+endif()
 
 
 install(FILES "${CMAKE_BINARY_DIR}/etc/20_panda.prc" COMPONENT Core DESTINATION etc)
 install(FILES "${CMAKE_BINARY_DIR}/etc/20_panda.prc" COMPONENT Core DESTINATION etc)