diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8fb6ec6..41e96c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,8 @@ env: CTEST_NO_TESTS_ACTION: error CMAKE_BUILD_PARALLEL_LEVEL: 4 CTEST_PARALLEL_LEVEL: 0 + CMAKE_INSTALL_PREFIX: ~/libs + CMAKE_PREFIX_PATH: ~/libs on: push: diff --git a/.github/workflows/ci_build.yml b/.github/workflows/ci_build.yml index 7fca5b0..fa755ee 100644 --- a/.github/workflows/ci_build.yml +++ b/.github/workflows/ci_build.yml @@ -1,8 +1,11 @@ name: ci_build env: - CMAKE_GENERATOR: Ninja CTEST_NO_TESTS_ACTION: error + CMAKE_BUILD_PARALLEL_LEVEL: 4 + CTEST_PARALLEL_LEVEL: 0 + CMAKE_INSTALL_PREFIX: ~/libs + CMAKE_PREFIX_PATH: ~/libs on: push: @@ -21,10 +24,10 @@ jobs: - name: Install prereqs run: | sudo apt update - sudo apt install --no-install-recommends ninja-build libopenmpi-dev openmpi-bin + sudo apt install --no-install-recommends libopenmpi-dev openmpi-bin - name: configure - run: cmake --preset default --install-prefix=${{ runner.temp }} + run: cmake --preset default - name: build, test release run: cmake --workflow --preset default @@ -33,7 +36,7 @@ jobs: # builds fine on local machine # - name: configure example - # run: cmake -S example -B example/build -DCMAKE_PREFIX_PATH:PATH=${{ runner.temp }} -DBUILD_SHARED_LIBS:BOOL=${{ matrix.shared }} + # run: cmake -S example -B example/build -DBUILD_SHARED_LIBS:BOOL=${{ matrix.shared }} # - name: build example # run: cmake --build example/build # - name: test example diff --git a/.github/workflows/oneapi-linux.yml b/.github/workflows/oneapi-linux.yml index a0bb7ac..3918759 100644 --- a/.github/workflows/oneapi-linux.yml +++ b/.github/workflows/oneapi-linux.yml @@ -11,6 +11,8 @@ env: FC: ifx CMAKE_BUILD_TYPE: Release CMAKE_BUILD_PARALLEL_LEVEL: 4 + CMAKE_INSTALL_PREFIX: ~/libs + CMAKE_PREFIX_PATH: ~/libs on: push: @@ -62,7 +64,6 @@ jobs: run: >- cmake --preset default -Dintsize64=${{ matrix.int64 }} - -DCMAKE_INSTALL_PREFIX=${{ runner.temp }} - name: print config log CMake run: cat build/CMakeFiles/CMakeConfigureLog.yaml @@ -82,7 +83,6 @@ jobs: cmake -S example -B example/build - -DCMAKE_PREFIX_PATH=${{ runner.temp }} - name: print config log if: ${{ failure() }} diff --git a/Readme_oneapi.md b/Readme_oneapi.md index 980a60d..e593d5c 100644 --- a/Readme_oneapi.md +++ b/Readme_oneapi.md @@ -3,12 +3,6 @@ We require [oneMKL >= 2021.3](https://www.intel.com/content/www/us/en/docs/onemkl/developer-guide-linux/2023-2/cmake-config-for-onemkl.html). -We recommend using Ninja generator with oneAPI (and any other) compiler: - -```sh -cmake -G Ninja -B build -``` - Do not try to build LAPACK and ScaLAPACK with oneAPI, the build will fail--use the oneMKL libraries that provide LAPACK and SCALAPACK. ## Linux @@ -23,7 +17,7 @@ If the oneAPI compiler is not found by CMake, try hinting its location like: export CC=$CMPLR_ROOT/bin/icx export FC=$CMPLR_ROOT/bin/ifx -cmake -G Ninja -B build +cmake -B build ``` ## Windows diff --git a/options.cmake b/options.cmake index 9f684cd..bf2fd98 100644 --- a/options.cmake +++ b/options.cmake @@ -2,7 +2,7 @@ if(CMAKE_VERSION VERSION_LESS 3.21) get_property(not_top DIRECTORY PROPERTY PARENT_DIRECTORY) if(NOT not_top) set(${PROJECT_NAME}_IS_TOP_LEVEL true) - endif() + endif() endif() option(${PROJECT_NAME}_BUILD_TESTING "Build tests" ${${PROJECT_NAME}_IS_TOP_LEVEL}) @@ -57,3 +57,8 @@ option(CMAKE_TLS_VERIFY "Verify TLS certificates" ON) set_property(DIRECTORY PROPERTY EP_UPDATE_DISCONNECTED true) set(FETCHCONTENT_UPDATES_DISCONNECTED true) + +# this is for convenience of those needing scalapaack, lapack built +if(${${PROJECT_NAME}_IS_TOP_LEVEL} AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set_property(CACHE CMAKE_INSTALL_PREFIX PROPERTY VALUE "${PROJECT_BINARY_DIR}/local") +endif() diff --git a/scripts/build_metis.cmake b/scripts/build_metis.cmake index d173121..ac59472 100644 --- a/scripts/build_metis.cmake +++ b/scripts/build_metis.cmake @@ -8,5 +8,8 @@ option(intsize64 "use 64-bit integers in C and Fortran--METIS must be consistent set(target "metis") set(args -Dintsize64:BOOL=${intsize64}) +if(prefix) + list(APPEND args -DCMAKE_INSTALL_PREFIX:PATH=${prefix}) +endif() include(${CMAKE_CURRENT_LIST_DIR}/run_cmake.cmake) diff --git a/scripts/build_scotch.cmake b/scripts/build_scotch.cmake index fd6ecf1..6533653 100644 --- a/scripts/build_scotch.cmake +++ b/scripts/build_scotch.cmake @@ -8,5 +8,8 @@ option(intsize64 "use 64-bit integers in C and Fortran--Scotch must be consisten set(target "scotch") set(args -Dintsize64:BOOL=${intsize64}) +if(prefix) + list(APPEND args -DCMAKE_INSTALL_PREFIX:PATH=${prefix}) +endif() include(${CMAKE_CURRENT_LIST_DIR}/run_cmake.cmake) diff --git a/scripts/run_cmake.cmake b/scripts/run_cmake.cmake index bb82155..4cd03ac 100644 --- a/scripts/run_cmake.cmake +++ b/scripts/run_cmake.cmake @@ -1,7 +1,3 @@ -if(NOT prefix) - set(prefix ${CMAKE_CURRENT_BINARY_DIR}/build_${target}) -endif() - if(NOT bindir) include(${CMAKE_CURRENT_LIST_DIR}/mkdtemp.cmake) endif() @@ -10,21 +6,16 @@ execute_process( COMMAND ${CMAKE_COMMAND} -B${bindir} -S${CMAKE_CURRENT_LIST_DIR} - ${args} -DCMAKE_INSTALL_PREFIX:PATH=${prefix} + ${args} RESULT_VARIABLE ret ) -# avoid overloading CPU/RAM with extreme GNU Make --parallel -cmake_host_system_information(RESULT N QUERY NUMBER_OF_PHYSICAL_CORES) - -if(ret EQUAL 0) - message(STATUS "${target} build with ${N} workers") -else() +if(NOT ret EQUAL 0) message(FATAL_ERROR "${target} failed to configure.") endif() execute_process( -COMMAND ${CMAKE_COMMAND} --build ${bindir} --parallel ${N} --target ${target} +COMMAND ${CMAKE_COMMAND} --build ${bindir} --target ${target} RESULT_VARIABLE ret ) diff --git a/scripts/test_shared.cmake b/scripts/test_shared.cmake index 3a4ac91..e4cfc0c 100644 --- a/scripts/test_shared.cmake +++ b/scripts/test_shared.cmake @@ -5,12 +5,11 @@ include(${CMAKE_CURRENT_LIST_DIR}/tempdir.cmake) if(NOT bindir) get_temp_dir(bindir) endif() -if(NOT prefix) - get_temp_dir(prefix) -endif() + +get_temp_dir(prefix) message(STATUS "binary_dir: ${bindir} -prefix: ${prefix}") +temp install dir: ${prefix}") execute_process( COMMAND ${CMAKE_COMMAND}