@@ -5,8 +5,6 @@ include(CheckCCompilerFlag)
5
5
set (CMAKE_BUILD_TYPE "Release" )
6
6
set (CMAKE_CXX_STANDARD 17)
7
7
set (CMAKE_EXPORT_COMPILE_COMMANDS ON )
8
-
9
-
10
8
# CMAKE POLICIES
11
9
# option() should use new cmake behavior wrt variable clobbering
12
10
cmake_policy (SET CMP0077 NEW)
@@ -28,9 +26,6 @@ if(NOT DEFINED PSP_CMAKE_MODULE_PATH)
28
26
set (PSP_CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /../../cmake" )
29
27
endif ()
30
28
31
-
32
-
33
-
34
29
set (CMAKE_MODULE_PATH "${PSP_CMAKE_MODULE_PATH} /modules" ${CMAKE_MODULE_PATH} )
35
30
set (MSVC_RUNTIME_LIBRARY MultiThreaded)
36
31
@@ -195,38 +190,15 @@ if(PSP_PYTHON_BUILD AND MACOS)
195
190
# don't link against build python
196
191
# https://blog.tim-smith.us/2015/09/python-extension-modules-os-x/
197
192
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()
212
193
endif ()
213
194
214
195
# ######################
215
196
include_directories ("${CMAKE_CURRENT_SOURCE_DIR} /src/include" )
216
197
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
-
222
198
if (NOT DEFINED PSP_WASM_EXCEPTIONS AND NOT PSP_PYTHON_BUILD)
223
199
set (PSP_WASM_EXCEPTIONS ON )
224
200
endif ()
225
201
226
- # if(NOT WIN32)
227
- # set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
228
- # set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
229
- # endif()
230
202
if (PSP_WASM_BUILD)
231
203
# ###################
232
204
# EMSCRIPTEN BUILD #
@@ -246,6 +218,7 @@ if(PSP_WASM_BUILD)
246
218
" )
247
219
248
220
if (CMAKE_BUILD_TYPE_LOWER STREQUAL debug)
221
+ # Pyodide DEBUG block
249
222
set (OPT_FLAGS " \
250
223
-O0 \
251
224
-g3 \
@@ -262,6 +235,7 @@ if(PSP_WASM_BUILD)
262
235
" )
263
236
endif ()
264
237
else ()
238
+ # Pyodide RELEASE block
265
239
set (OPT_FLAGS " \
266
240
-O3 \
267
241
-g0 \
@@ -369,34 +343,7 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
369
343
# so we use a custom FindPythonHeaders that is the same as the
370
344
# default, but ignores when the python libraries can't be found.
371
345
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})
383
346
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
- # ####################
400
347
endif ()
401
348
endif ()
402
349
@@ -674,34 +621,30 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
674
621
# Python extra targets #
675
622
# #######################
676
623
if (PSP_WASM_BUILD)
624
+ # Pyodide
677
625
set (CMAKE_EXECUTABLE_SUFFIX ".wasm" )
678
626
set (CMAKE_EXE_LINKER_FLAGS "${PSP_WASM_LINKER_FLAGS} --pre-js \" ${PSP_CPP_SRC} /env.js\" " )
679
627
add_library (psp STATIC ${PYTHON_SOURCE_FILES} )
680
628
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)
681
634
else ()
635
+ # Cpython
682
636
add_library (psp STATIC ${PYTHON_SOURCE_FILES} )
683
637
target_compile_definitions (psp PRIVATE PSP_ENABLE_PYTHON=1 PSP_PARALLEL_FOR=1)
684
638
endif ()
685
- # add_library(psppy SHARED ${PYTHON_BINDING_SOURCE_FILES})
686
639
687
640
include_directories (${PSP_PYTHON_SRC} /include )
688
641
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)
699
643
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})
701
644
702
645
target_compile_options (psp PRIVATE -fvisibility=hidden)
703
- # target_compile_options(psppy PRIVATE -fvisibility=hidden)
704
646
elseif (MANYLINUX)
647
+ # intentionally blank
705
648
else ()
706
649
target_compile_options (psp PRIVATE -fvisibility=hidden)
707
650
# target_compile_options(psppy PRIVATE -Wdeprecated-declarations)
0 commit comments