Ver código fonte

CMake: changes to support Emscripten build

Closes #1069
rdb 5 anos atrás
pai
commit
05403ab04a
2 arquivos alterados com 17 adições e 1 exclusões
  1. 12 1
      dtool/Config.cmake
  2. 5 0
      dtool/src/prc/CMakeLists.txt

+ 12 - 1
dtool/Config.cmake

@@ -30,10 +30,15 @@ if(DEFINED CMAKE_CXX_FLAGS_COVERAGE)
 endif()
 
 # Are we building with static or dynamic linking?
+if(EMSCRIPTEN)
+  set(_default_shared OFF)
+else()
+  set(_default_shared ON)
+endif()
 option(BUILD_SHARED_LIBS
   "Causes subpackages to be built separately -- setup for dynamic linking.
 Utilities/tools/binaries/etc are then dynamically linked to the
-libraries instead of being statically linked." ON)
+libraries instead of being statically linked." ${_default_shared})
 
 option(BUILD_METALIBS
   "Should we build 'metalibs' -- fewer, larger libraries that contain the bulk
@@ -524,12 +529,18 @@ set(THREADS_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
 set(HAVE_POSIX_THREADS ${CMAKE_USE_PTHREADS_INIT})
 
 # Add basic use flag for threading
+if(EMSCRIPTEN)
+  set(_default_threads OFF)
+else()
+  set(_default_threads ON)
+endif()
 package_option(THREADS
   "If on, compile Panda3D with threading support.
 Building in support for threading will enable Panda to take
 advantage of multiple CPU's if you have them (and if the OS
 supports kernel threads running on different CPU's), but it will
 slightly slow down Panda for the single CPU case."
+  DEFAULT ${_default_threads}
   IMPORTED_AS Threads::Threads)
 
 # Configure debug threads

+ 5 - 0
dtool/src/prc/CMakeLists.txt

@@ -69,6 +69,11 @@ if(ANDROID)
     androidLogStream.cxx)
 endif()
 
+if(EMSCRIPTEN)
+  set(P3PRC_SOURCES ${P3PRC_SOURCES}
+    emscriptenLogStream.cxx)
+endif()
+
 if(HAVE_OPENSSL)
   list(APPEND P3PRC_SOURCES encryptStreamBuf.cxx encryptStream.cxx)
 endif()