Browse Source

CMake: fix bad location of panda3d/__init__.py in multiconfig build

rdb 5 years ago
parent
commit
c4c99ca24a
1 changed files with 8 additions and 4 deletions
  1. 8 4
      panda/CMakeLists.txt

+ 8 - 4
panda/CMakeLists.txt

@@ -113,8 +113,7 @@ if(INTERROGATE_PYTHON_INTERFACE)
     set(win32_init "")
   endif()
 
-  file(WRITE "${PROJECT_BINARY_DIR}/panda3d/__init__.py"
-    "\"Python bindings for the Panda3D libraries\"
+  set(init_file "\"Python bindings for the Panda3D libraries\"
 
 __version__ = '${PROJECT_VERSION}'
 
@@ -130,8 +129,13 @@ To suppress this warning, upgrade to Python 3.
 
 ${win32_init}")
 
-  if(BUILD_SHARED_LIBS)
-    install_python_package(panda3d ARCH)
+  if(IS_MULTICONFIG)
+    foreach(config ${CMAKE_CONFIGURATION_TYPES})
+      # Generate an __init__.py in the per-configuration directory.
+      file(WRITE "${PROJECT_BINARY_DIR}/${config}/panda3d/__init__.py" ${init_file})
+    endforeach(config)
+  else()
+    file(WRITE "${PROJECT_BINARY_DIR}/panda3d/__init__.py" ${init_file})
   endif()
 
   if(HAVE_BULLET)