@@ -277,9 +277,9 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
277277 -fexceptions \
278278 -g3 \
279279 " )
280- if (PSP_WASM_EXCEPTIONS)
281- set (OPT_FLAGS "${OPT_FLAGS} -fwasm-exceptions " )
282- endif ()
280+ if (PSP_WASM_EXCEPTIONS)
281+ set (OPT_FLAGS "${OPT_FLAGS} -fwasm-exceptions " )
282+ endif ()
283283 endif ()
284284 else ()
285285 set (OPT_FLAGS " \
@@ -299,22 +299,11 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
299299 if (PSP_PYODIDE)
300300 set (CMAKE_FIND_ROOT_PATH "${CMAKE_FIND_ROOT_PATH} ;/usr/local/" )
301301 find_package (Boost REQUIRED)
302- else ( )
302+ elseif ( NOT WIN32 )
303303 set (Boost_USE_STATIC_LIBS ON )
304304 find_package (Boost REQUIRED COMPONENTS system )
305305 endif ()
306306
307- if (NOT Boost_FOUND)
308- message (FATAL_ERROR "${Red} Boost could not be located${ColorReset} " )
309- else ()
310- psp_build_message("${Cyan} Found Boost: `Boost_INCLUDE_DIRS`: ${Boost_INCLUDE_DIRS} , `Boost_LIBRARY_DIRS` - ${Boost_LIBRARY_DIRS} ${ColorReset} " )
311-
312- if (WIN32 )
313- include_directories (SYSTEM ${Boost_INCLUDE_DIRS} )
314- add_definitions (-DBOOST_UUID_FORCE_AUTO_LINK)
315- endif ()
316- endif ()
317-
318307 if (WIN32 )
319308 foreach (warning 4244 4251 4267 4275 4290 4786 4305 4996)
320309 SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd${warning} " )
@@ -329,21 +318,8 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
329318 endif ()
330319
331320 if (PSP_PYTHON_BUILD)
332- # ########################
333- # PYTHON BINDINGS BUILD #
334- # ########################
335321 set (CMAKE_POSITION_INDEPENDENT_CODE ON )
336322 include_directories ("${PSP_PYTHON_SRC} /perspective/include" )
337-
338- if (MANYLINUX)
339- # Manylinux docker images have no shared libraries
340- # The instead use a statically built python.
341- # Cmake's default FindPython can't find the python headers
342- # without also finding (or failing to find) the python libraries
343- # so we use a custom FindPythonHeaders that is the same as the
344- # default, but ignores when the python libraries can't be found.
345- psp_build_message("${Red} Manylinux build has no python shared libraries${ColorReset} " )
346- endif ()
347323 endif ()
348324endif ()
349325
@@ -353,10 +329,18 @@ set(RAPIDJSON_BUILD_TESTS OFF CACHE BOOL "Disable rapidjson tests")
353329set (CMAKE_C_FLAGS " \
354330-O3 \
355331" )
332+ if (PSP_WASM_EXCEPTIONS)
333+ set (CMAKE_CXX_FLAGS " -fwasm-exceptions \
334+ -O3 \
335+ -g0 \
336+ " )
337+ else ()
356338set (CMAKE_CXX_FLAGS " \
357339-O3 \
358340" )
359341
342+ endif ()
343+
360344if (PSP_PYODIDE)
361345 set (RELOCATABLE_FLAGS "-sRELOCATABLE=1 -sSIDE_MODULE=2 -sWASM_BIGINT=1" )
362346
@@ -399,6 +383,24 @@ psp_build_dep("lz4" "${PSP_CMAKE_MODULE_PATH}/lz4.txt.in")
399383# Build minimal arrow itself
400384psp_build_dep("arrow" "${PSP_CMAKE_MODULE_PATH} /arrow.txt.in" )
401385
386+ if (PSP_PYTHON_BUILD AND NOT PSP_PYODIDE)
387+ # Boost must be added after arrow to prevent linking bug on Windows.
388+ if (WIN32 )
389+ set (Boost_USE_STATIC_LIBS ON )
390+ find_package (Boost REQUIRED COMPONENTS system )
391+ endif ()
392+ if (NOT Boost_FOUND)
393+ message (FATAL_ERROR "${Red} Boost could not be located${ColorReset} " )
394+ else ()
395+ psp_build_message("${Cyan} Found Boost: `Boost_INCLUDE_DIRS`: ${Boost_INCLUDE_DIRS} , `Boost_LIBRARY_DIRS` - ${Boost_LIBRARY_DIRS} ${ColorReset} " )
396+ if (WIN32 )
397+ include_directories (SYSTEM ${Boost_INCLUDE_DIRS} )
398+ add_definitions (-DBOOST_UUID_FORCE_AUTO_LINK)
399+ endif ()
400+ endif ()
401+ endif ()
402+
403+
402404# Build re2 as our regex library
403405# this is a workaround for some re2-specific weirdness
404406add_definitions (-DTARGET_OS_OSX=1)
@@ -587,7 +589,7 @@ if(PSP_WASM_BUILD AND NOT PSP_PYTHON_BUILD)
587589 add_library (psp ${WASM_SOURCE_FILES} )
588590 target_compile_definitions (psp PRIVATE PSP_ENABLE_WASM=1)
589591 set_target_properties (psp PROPERTIES COMPILE_FLAGS "" )
590- target_link_libraries (psp PRIVATE arrow re2 protos)
592+ target_link_libraries (psp PRIVATE arrow_static re2 protos)
591593
592594 add_executable (perspective_esm src/cpp/binding_api.cpp)
593595 target_link_libraries (perspective_esm psp protos)
@@ -628,7 +630,7 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
628630 target_compile_definitions (psp PRIVATE PSP_ENABLE_PYTHON=1 PSP_ENABLE_WASM=1)
629631 # support for emscripten exceptions https://emscripten.org/docs/porting/exceptions.html#emscripten-javascript-based-exception-support
630632 target_compile_options (psp PUBLIC -fexceptions -fvisibility=hidden)
631- target_compile_options (arrow PUBLIC -fexceptions -fvisibility=hidden)
633+ target_compile_options (arrow_static PUBLIC -fexceptions -fvisibility=hidden)
632634 target_compile_options (re2 PUBLIC -fexceptions -fvisibility=hidden)
633635 target_compile_options (protos PUBLIC -fexceptions -fvisibility=hidden)
634636 else ()
@@ -647,25 +649,14 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
647649 # intentionally blank
648650 else ()
649651 target_compile_options (psp PRIVATE -fvisibility=hidden)
650- # target_compile_options(psppy PRIVATE -Wdeprecated-declarations)
651652 endif ()
652653
653654 # Link against minimal arrow static library
654- target_link_libraries (psp PRIVATE arrow re2 protos)
655- # target_link_libraries(psppy psp)
656-
657- # The compiled libraries will be put in CMAKE_LIBRARY_OUTPUT_DIRECTORY by default. In the
658- # setup.py file, we designate this to be in the build/lib.<platform> directory. However,
659- # since we want to be able to test perspective in-source, we also copy the libraries into
660- # the source folder. These two commands do that.
661- # add_custom_command(TARGET psp POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:psp> ${PSP_PYTHON_SRC}/table/)
662- # add_custom_command(TARGET psppy POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:psppy> ${PSP_PYTHON_SRC}/table/)
663-
664- # #######################
655+ target_link_libraries (psp PRIVATE arrow_static re2 protos lz4_static libzstd_static)
665656 else ()
666657 add_library (psp STATIC ${WASM_SOURCE_FILES} )
667658 target_compile_options (psp PRIVATE -fvisibility=hidden)
668- target_link_libraries (psp PRIVATE arrow re2 protos)
659+ target_link_libraries (psp PRIVATE arrow_static re2 protos)
669660 endif ()
670661
671662 if (PSP_CPP_BUILD_STRICT AND NOT WIN32 )
0 commit comments