@@ -11,15 +11,27 @@ if (CMAKE_COMPILER_IS_GNUCXX)
1111endif ()
1212
1313message (STATUS "Looking for python ..." )
14- set (Python_FIND_VIRTUALENV ONLY)
15- find_package (Python COMPONENTS Interpreter Development)
16- if (NOT Python_FOUND)
17- set (Python_FIND_VIRTUALENV STANDARD)
18- find_package (Python COMPONENTS Interpreter Development)
19- endif ()
2014
21- if (NOT Python_Development_FOUND)
22- message (FATAL_ERROR "Python development package not found and python component required" )
15+ if (NOT EMSCRIPTEN)
16+ set (Python_FIND_VIRTUALENV ONLY)
17+ find_package (Python COMPONENTS Interpreter Development)
18+ if (NOT Python_FOUND)
19+ set (Python_FIND_VIRTUALENV STANDARD)
20+ find_package (Python COMPONENTS Interpreter Development)
21+ endif ()
22+
23+ if (NOT Python_Development_FOUND)
24+ message (FATAL_ERROR "Python development package not found and python component required" )
25+ endif ()
26+ else ()
27+ set (Python_INCLUDE_DIRS
28+ "${CMAKE_PREFIX_PATH} /include/python3.11"
29+ )
30+
31+ set_property (GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE )
32+ set (CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-s SIDE_MODULE=1" )
33+ set (CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-s SIDE_MODULE=1" )
34+ set (CMAKE_STRIP FALSE )
2335endif ()
2436
2537include_directories ("${PROJECT_SOURCE_DIR} /include" "${Python_INCLUDE_DIRS} " )
@@ -28,6 +40,12 @@ file (GLOB cppyy_src src/*.cxx)
2840
2941add_library (cppyy SHARED ${cppyy_src} )
3042
43+ if (EMSCRIPTEN)
44+ target_link_options (cppyy
45+ PUBLIC "SHELL: -s WASM_BIGINT"
46+ )
47+ endif ()
48+
3149if (APPLE )
3250 set_target_properties (cppyy PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" )
3351 set_target_properties (cppyy PROPERTIES SUFFIX ".so" )
0 commit comments