Skip to content

Commit 18de297

Browse files
committed
default build release
1 parent 79efc42 commit 18de297

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

.github/workflows/intel-oneapi.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,18 @@ jobs:
4545
- uses: actions/checkout@v2
4646

4747
- name: Configure CMake
48-
run: cmake -B build
48+
run: cmake --preset multi
4949

5050
- name: print config log
5151
if: ${{ failure() }}
5252
run: cat build/CMakeFiles/CMakeError.log
5353

5454
- name: Release build
55-
run: cmake --build build
56-
55+
run: cmake --build --preset release
5756
- name: Release unit test
58-
run: ctest --test-dir build --output-junit test-release-oneapi.xml
57+
run: ctest --preset release --output-junit test-release-oneapi.xml
58+
59+
- name: debug build
60+
run: cmake --build --preset debug
61+
- name: debug unit test
62+
run: ctest --preset debug --output-junit test-debug-oneapi.xml

CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
cmake_minimum_required(VERSION 3.20...3.21)
22

3+
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
4+
if(NOT is_multi_config AND NOT (CMAKE_BUILD_TYPE OR DEFINED ENV{CMAKE_BUILD_TYPE}))
5+
set(CMAKE_BUILD_TYPE Release CACHE STRING "Release default")
6+
endif()
7+
38
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/VERSION PROJECT_VERSION
49
REGEX "^([0-9]+\.[0-9]+\.[0-9]+)" LIMIT_INPUT 16 LENGTH_MAXIMUM 16 LIMIT_COUNT 1)
510

@@ -14,6 +19,12 @@ if(NOT DEFINED ${PROJECT_NAME}_BUILD_TESTING)
1419
set(${PROJECT_NAME}_BUILD_TESTING ${BUILD_TESTING})
1520
endif()
1621

22+
if(CMAKE_GENERATOR STREQUAL "Ninja Multi-Config")
23+
set(EXTPROJ_GENERATOR "Ninja")
24+
else()
25+
set(EXTPROJ_GENERATOR ${CMAKE_GENERATOR})
26+
endif()
27+
1728
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
1829

1930
include(cmake/options.cmake)

cmake/build_hdf5.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.20...3.21)
1+
cmake_minimum_required(VERSION 3.20...3.22)
22
# builds HDF5 library from scratch
33
# note: the use of "lib" vs. CMAKE_STATIC_LIBRARY_PREFIX is deliberate based on the particulars of these libraries
44
# across Intel Fortran on Windows vs. Gfortran on Windows vs. Linux.
@@ -73,6 +73,7 @@ ExternalProject_Add(HDF5
7373
URL ${hdf5_url}
7474
URL_HASH SHA256=${hdf5_sha256}
7575
CMAKE_ARGS ${hdf5_cmake_args}
76+
CMAKE_GENERATOR ${EXTPROJ_GENERATOR}
7677
BUILD_BYPRODUCTS ${HDF5_LIBRARIES}
7778
DEPENDS ZLIB
7879
CONFIGURE_HANDLED_BY_BUILD ON

cmake/build_zlib.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.20...3.21)
1+
cmake_minimum_required(VERSION 3.20...3.22)
22
# build Zlib to ensure compatibility.
33
# We use Zlib 2.x for speed and robustness.
44

@@ -33,6 +33,7 @@ ExternalProject_Add(ZLIB
3333
URL ${zlib_url}
3434
URL_HASH SHA256=${zlib_sha256}
3535
CMAKE_ARGS ${zlib_cmake_args}
36+
CMAKE_GENERATOR ${EXTPROJ_GENERATOR}
3637
BUILD_BYPRODUCTS ${ZLIB_LIBRARY}
3738
CONFIGURE_HANDLED_BY_BUILD ON
3839
INACTIVITY_TIMEOUT 15)

0 commit comments

Comments
 (0)