@@ -5,8 +5,6 @@ include(CheckCCompilerFlag)
55set (CMAKE_BUILD_TYPE "Release" )
66set (CMAKE_CXX_STANDARD 17)
77set (CMAKE_EXPORT_COMPILE_COMMANDS ON )
8-
9-
108# CMAKE POLICIES
119# option() should use new cmake behavior wrt variable clobbering
1210cmake_policy (SET CMP0077 NEW )
@@ -28,9 +26,6 @@ if(NOT DEFINED PSP_CMAKE_MODULE_PATH)
2826 set (PSP_CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR } /../../cmake" )
2927endif ()
3028
31-
32-
33-
3429set (CMAKE_MODULE_PATH "${PSP_CMAKE_MODULE_PATH} /modules" ${CMAKE_MODULE_PATH } )
3530set (MSVC_RUNTIME_LIBRARY MultiThreaded)
3631
@@ -195,38 +190,15 @@ if(PSP_PYTHON_BUILD AND MACOS)
195190 # don't link against build python
196191 # https://blog.tim-smith.us/2015/09/python-extension-modules-os-x/
197192 set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS } -undefined dynamic_lookup" )
198-
199- # # TODO This now needs to be set externally because we cross-compile.
200- # # check_c_compiler_flag("-arch x86_64" x86_64Supported)
201- # check_c_compiler_flag("-arch arm64" arm64Supported)
202-
203- # if(x86_64Supported AND arm64Supported)
204- # set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Build universal architecture for OSX" FORCE)
205- # elseif(x86_64Supported)
206- # set(CMAKE_REQUIRED_LINK_OPTIONS "-arch;x86_64")
207- # set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build x86_64 architecture for OSX" FORCE)
208- # elseif(arm64Supported)
209- # set(CMAKE_REQUIRED_LINK_OPTIONS "-arch;arm64")
210- # set(CMAKE_OSX_ARCHITECTURES "arm64" CACHE STRING "Build arm64 architecture for OSX" FORCE)
211- # endif()
212193endif ()
213194
214195# ######################
215196include_directories ("${CMAKE_CURRENT_SOURCE_DIR } /src/include" )
216197
217- # Needs to be set early so that all translation units use it.
218- if (NOT PSP_PYODIDE)
219- set (CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS } -fexceptions" )
220- endif ()
221-
222198if (NOT DEFINED PSP_WASM_EXCEPTIONS AND NOT PSP_PYTHON_BUILD)
223199 set (PSP_WASM_EXCEPTIONS ON )
224200endif ()
225201
226- # if(NOT WIN32)
227- # set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
228- # set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
229- # endif()
230202if (PSP_WASM_BUILD)
231203 # ###################
232204 # EMSCRIPTEN BUILD #
@@ -246,6 +218,7 @@ if(PSP_WASM_BUILD)
246218 " )
247219
248220 if (CMAKE_BUILD_TYPE_LOWER STREQUAL debug)
221+ # Pyodide DEBUG block
249222 set (OPT_FLAGS " \
250223 -O0 \
251224 -g3 \
@@ -262,6 +235,7 @@ if(PSP_WASM_BUILD)
262235 " )
263236 endif ()
264237 else ()
238+ # Pyodide RELEASE block
265239 set (OPT_FLAGS " \
266240 -O3 \
267241 -g0 \
@@ -369,34 +343,7 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
369343 # so we use a custom FindPythonHeaders that is the same as the
370344 # default, but ignores when the python libraries can't be found.
371345 psp_build_message ("${Red} Manylinux build has no python shared libraries${ColorReset} " )
372- # find_package(Python ${PSP_PYTHON_VERSION} EXACT REQUIRED COMPONENTS Interpreter)
373- # find_package(PythonHeaders ${PSP_PYTHON_VERSION} EXACT REQUIRED)
374- else ()
375- # psp_build_message("${Cyan}Use python shared libraries${ColorReset}")
376- # if(PSP_PYODIDE)
377- # find_package(Python ${PSP_PYTHON_VERSION} EXACT REQUIRED COMPONENTS Interpreter)
378- # else()
379- # find_package(Python ${PSP_PYTHON_VERSION} EXACT REQUIRED COMPONENTS Interpreter Development.Module)
380- # endif()
381-
382- # link_directories(${Python_LIBRARY_DIRS})
383346 endif ()
384-
385- # psp_build_message("${Cyan}Using Python ${Python_VERSION}, \nPython_INCLUDE_DIRS: ${Python_INCLUDE_DIRS}, \nPython_LIBRARIES: ${Python_LIBRARIES}, \nPython_EXECUTABLE: ${Python_EXECUTABLE} ${ColorReset}")
386- # include_directories(${Python_INCLUDE_DIRS})
387-
388- # psp_build_dep("pybind11" "${PSP_CMAKE_MODULE_PATH}/Pybind.txt.in")
389-
390- # find_package(NumPy REQUIRED)
391-
392- # if(NOT PYTHON_NUMPY_FOUND)
393- # message(FATAL_ERROR "${Red}Numpy could not be located${ColorReset}")
394- # else()
395- # psp_build_message("${Cyan}Numpy found: ${PYTHON_NUMPY_INCLUDE_DIR}${ColorReset}")
396- # include_directories(${PYTHON_NUMPY_INCLUDE_DIR})
397- # endif()
398-
399- # ####################
400347 endif ()
401348endif ()
402349
@@ -674,34 +621,30 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
674621 # Python extra targets #
675622 # #######################
676623 if (PSP_WASM_BUILD)
624+ # Pyodide
677625 set (CMAKE_EXECUTABLE_SUFFIX ".wasm" )
678626 set (CMAKE_EXE_LINKER_FLAGS "${PSP_WASM_LINKER_FLAGS} --pre-js \" ${PSP_CPP_SRC} /env.js\" " )
679627 add_library (psp STATIC ${PYTHON_SOURCE_FILES} )
680628 target_compile_definitions (psp PRIVATE PSP_ENABLE_PYTHON=1 PSP_ENABLE_WASM=1 )
629+ # support for emscripten exceptions https://emscripten.org/docs/porting/exceptions.html#emscripten-javascript-based-exception-support
630+ target_compile_options (psp PUBLIC -fexceptions -fvisibility=hidden )
631+ target_compile_options (arrow PUBLIC -fexceptions -fvisibility=hidden )
632+ target_compile_options (re2 PUBLIC -fexceptions -fvisibility=hidden )
633+ target_compile_options (protos PUBLIC -fexceptions -fvisibility=hidden )
681634 else ()
635+ # Cpython
682636 add_library (psp STATIC ${PYTHON_SOURCE_FILES} )
683637 target_compile_definitions (psp PRIVATE PSP_ENABLE_PYTHON=1 PSP_PARALLEL_FOR=1 )
684638 endif ()
685- # add_library(psppy SHARED ${PYTHON_BINDING_SOURCE_FILES})
686639
687640 include_directories (${PSP_PYTHON_SRC} /include )
688641
689- # target_compile_definitions(psppy PRIVATE PSP_ENABLE_PYTHON=1 PSP_PARALLEL_FOR=1)
690-
691- if (WIN32 )
692- #target_compile_definitions(psppy PRIVATE WIN32=1)
693- # target_compile_definitions(psppy PRIVATE _WIN32=1)
694-
695- # .dll not importable
696- # set_property(TARGET psppy PROPERTY SUFFIX .pyd)
697- elseif (MACOS OR NOT MANYLINUX)
698- # target_compile_options(psppy PRIVATE -Wdeprecated-declarations)
642+ if (MACOS OR NOT MANYLINUX)
699643 set_property (TARGET psp PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_RPATH } ${module_origin_path} )
700- # set_property(TARGET psppy PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${module_origin_path})
701644
702645 target_compile_options (psp PRIVATE -fvisibility=hidden )
703- # target_compile_options(psppy PRIVATE -fvisibility=hidden)
704646 elseif (MANYLINUX)
647+ # intentionally blank
705648 else ()
706649 target_compile_options (psp PRIVATE -fvisibility=hidden )
707650 # target_compile_options(psppy PRIVATE -Wdeprecated-declarations)
0 commit comments