Skip to content

Commit

Permalink
Add --standalone flag
Browse files Browse the repository at this point in the history
  • Loading branch information
vespakoen committed Sep 11, 2023
1 parent 6e34975 commit 8506d0b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/cd.yml
Expand Up @@ -83,6 +83,7 @@ jobs:
.github/scripts/ci_deps.sh
./install_boost.sh
./install.sh \
--standalone \
--build-type release \
--boost-prefix $(pwd) \
--install \
Expand Down Expand Up @@ -174,6 +175,7 @@ jobs:
./install.sh \
--build-type release \
--boost-prefix $(pwd) \
--standalone \
--node-architecture ${{ matrix.node_architecture }} \
--install \
--install-prefix $(pwd)/dist \
Expand Down Expand Up @@ -292,23 +294,23 @@ jobs:
OCL_BOOST_ARCHITECTURE="${{ matrix.boost_architecture }}"
CMAKE_GENERATOR="Visual Studio 17 2022"
CMAKE_GENERATOR_PLATFORM="${{ matrix.cmake_generator_platform }}"
USE_STATIC_BOOST="ON"
CIBW_ENVIRONMENT_PASS_WINDOWS: "BOOST_ROOT OCL_BOOST_ADDRESS_MODEL OCL_BOOST_ARCHITECTURE CMAKE_GENERATOR CMAKE_GENERATOR_PLATFORM USE_STATIC_BOOST"
USE_STANDALONE="ON"
CIBW_ENVIRONMENT_PASS_WINDOWS: "BOOST_ROOT OCL_BOOST_ADDRESS_MODEL OCL_BOOST_ARCHITECTURE CMAKE_GENERATOR CMAKE_GENERATOR_PLATFORM USE_STANDALONE"
CIBW_ARCHS_MACOS: "${{ matrix.architecture }}"
CIBW_ENVIRONMENT_MACOS: >
BOOST_ROOT="$(pwd)"
OCL_MACOS_ARCHITECTURE="${{ matrix.architecture }}"
OCL_BOOST_ARCHITECTURE="${{ matrix.boost_architecture }}"
OPENMP_PREFIX_MACOS="/tmp/libomp/libomp/fixed"
USE_STATIC_BOOST="ON"
CIBW_ENVIRONMENT_PASS_MACOS: "BOOST_ROOT OCL_BOOST_ARCHITECTURE OPENMP_PREFIX_MACOS USE_STATIC_BOOST"
USE_STANDALONE="ON"
CIBW_ENVIRONMENT_PASS_MACOS: "BOOST_ROOT OCL_BOOST_ARCHITECTURE OPENMP_PREFIX_MACOS USE_STANDALONE"
CIBW_ARCHS_LINUX: "${{ matrix.architecture }}"
CIBW_ENVIRONMENT_LINUX: >
BOOST_ROOT="$(pwd)"
OCL_BOOST_ARCHITECTURE="${{ matrix.boost_architecture }}"
CMAKE_GENERATOR="Unix Makefiles"
USE_STATIC_BOOST="ON"
CIBW_ENVIRONMENT_PASS_LINUX: "BOOST_ROOT OCL_BOOST_ARCHITECTURE CMAKE_GENERATOR USE_STATIC_BOOST"
USE_STANDALONE="ON"
CIBW_ENVIRONMENT_PASS_LINUX: "BOOST_ROOT OCL_BOOST_ARCHITECTURE CMAKE_GENERATOR USE_STANDALONE"
# - name: Compress Boost.Python
# shell: bash
# run: |
Expand Down Expand Up @@ -338,6 +340,7 @@ jobs:
./install.sh \
--build-type release \
--boost-prefix $(pwd) \
--standalone \
--install \
--install-prefix $(pwd)/dist \
emscripten
Expand Down
6 changes: 4 additions & 2 deletions install.sh
Expand Up @@ -16,6 +16,7 @@ OPTIONS:
--clean Clean the build folder before compiling a library
--build-type Choose the build type (one of: debug, release)
--disable-openmp Disable OpenMP in the build.
--standalone Static linking and copying dependencies (OpenMP) into install destination
--install-system-deps Install dependencies for compiling libraries (only aware of apt, brew and choco at the moment)
--install Install the CMake install targets to the prefix (see: --install-prefix)
Expand Down Expand Up @@ -79,6 +80,7 @@ while [[ "$#" -gt 0 ]]; do
--clean) OCL_CLEAN="1"; ;;
--build-type) OCL_BUILD_TYPE="$2"; shift ;;
--platform) OCL_PLATFORM="$2"; shift ;;
--standalone) OCL_STANDALONE="1"; ;;
--install-system-deps) OCL_INSTALL_SYSTEM_DEPS="1"; ;;
--disable-openmp) OCL_DISABLE_OPENMP="1"; ;;
--install) OCL_INSTALL="1"; ;;
Expand Down Expand Up @@ -246,7 +248,7 @@ get_cmake_args() {
${OCL_GENERATOR:+"-G ${OCL_GENERATOR}"} \
${OCL_GENERATOR_PLATFORM:+"-A ${OCL_GENERATOR_PLATFORM}"} \
-D CMAKE_BUILD_TYPE="${build_type}" \
-D USE_STATIC_BOOST="ON" \
${OCL_STANDALONE:+"-D USE_STANDALONE=ON"} \
-D Boost_ADDITIONAL_VERSIONS="${boost_additional_versions}" \
-D VERSION_STRING="$(cat VERSION)" \
${OCL_DISABLE_OPENMP:+"-D USE_OPENMP=OFF"} \
Expand Down Expand Up @@ -356,7 +358,7 @@ build_emscriptenlib() {
OCL_DISABLE_OPENMP="1"
emcmake cmake $(get_cmake_args) \
-D BUILD_EMSCRIPTEN_LIB="ON" \
-D USE_STATIC_BOOST="ON"
-D USE_STANDALONE="ON"
cd "${build_dir}"
if [ "${determined_os}" = "windows" ]; then
emmake make \
Expand Down
11 changes: 5 additions & 6 deletions src/CMakeLists.txt
Expand Up @@ -44,15 +44,15 @@ option(BUILD_DOC
option(USE_OPENMP
"Use OpenMP for parallel computation" ON)

option(USE_STANDALONE
"Copy dependencies (OpenMP) into install folder and compile statically" ON)

option(VERSION_STRING
"Set version string" OFF)

option(USE_PY_3
"Use Python V3" ON)

option(USE_STATIC_BOOST
"Use static boost" OFF)

if(NOT BUILD_CXX_LIB)
message(STATUS " Note: will NOT build pure c++ library")
endif()
Expand Down Expand Up @@ -108,9 +108,8 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(Boost_DEBUG ON CACHE BOOL "boost-debug")

set(TRUTHY_VALUES "ON;YES;TRUE;1")
if(USE_STATIC_BOOST OR
(DEFINED ENV{USE_STATIC_BOOST} AND
"$ENV{USE_STATIC_BOOST}" IN_LIST TRUTHY_VALUES))
if(USE_STANDALONE OR (DEFINED ENV{USE_STANDALONE} AND
"$ENV{USE_STANDALONE}" IN_LIST TRUTHY_VALUES))
set(Boost_USE_STATIC_LIBS ON CACHE BOOL "boost-use-static-libs")
endif()
if(DEFINED ENV{BOOST_ROOT} OR DEFINED BOOST_ROOT)
Expand Down
7 changes: 6 additions & 1 deletion src/nodejslib/nodejslib.cmake
Expand Up @@ -56,7 +56,12 @@ set_target_properties(ocl PROPERTIES PREFIX "" SUFFIX ".node")

add_definitions(-DNAPI_VERSION=3)

if(USE_OPENMP AND APPLE)
set(TRUTHY_VALUES "ON;YES;TRUE;1")
if(
(USE_STANDALONE OR (DEFINED ENV{USE_STANDALONE} AND "$ENV{USE_STANDALONE}" IN_LIST TRUTHY_VALUES))
AND USE_OPENMP
AND APPLE
)
# copy libomp into install directory
install(
FILES ${OpenMP_omp_LIBRARY}
Expand Down

0 comments on commit 8506d0b

Please sign in to comment.