-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from Pressio/37-simplify-cmake
#37: Simplify CMake
- Loading branch information
Showing
11 changed files
with
34 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
.vscode | ||
generated_docs | ||
build | ||
install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,10 @@ | ||
cmake_minimum_required(VERSION 3.18.0 FATAL_ERROR) | ||
project(pressio C CXX) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") | ||
include(colors) | ||
|
||
|
||
# versioning | ||
#===================================================================== | ||
# adapted from Eigen | ||
file(READ "${PROJECT_SOURCE_DIR}/include/pressio/ops_macros.hpp" _pressio_ops_macros) | ||
string(REGEX MATCH "define[ \t]+PRESSIO_MAJOR_VERSION[ \t]+([0-9]+)" _major_version_match "${_pressio_ops_macros}") | ||
set(PRESSIO_MAJOR_VERSION "${CMAKE_MATCH_1}") | ||
|
||
string(REGEX MATCH "define[ \t]+PRESSIO_MINOR_VERSION[ \t]+([0-9]+)" _minor_version_match "${_pressio_ops_macros}") | ||
set(PRESSIO_MINOR_VERSION "${CMAKE_MATCH_1}") | ||
|
||
string(REGEX MATCH "define[ \t]+PRESSIO_PATCH_VERSION[ \t]+([0-9]+)" _patch_version_match "${_pressio_ops_macros}") | ||
set(PRESSIO_PATCH_VERSION "${CMAKE_MATCH_1}") | ||
|
||
set(PRESSIO_VERSION_NUMBER ${PRESSIO_MAJOR_VERSION}.${PRESSIO_MINOR_VERSION}.${PRESSIO_PATCH_VERSION}) | ||
message("${Magenta}>> PRESSIO-OPS: version = ${PRESSIO_VERSION_NUMBER} ${ColourReset}") | ||
|
||
|
||
# c++ standard | ||
#===================================================================== | ||
if (NOT CMAKE_CXX_STANDARD) | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
endif() | ||
|
||
message("${Magenta}>> CMAKE_CXX_STANDARD is set to ${CMAKE_CXX_STANDARD} ${ColourReset}") | ||
|
||
if(CMAKE_CXX_STANDARD STREQUAL "17" | ||
OR CMAKE_CXX_STANDARD STREQUAL "20") | ||
if(NOT "cxx_std_${CMAKE_CXX_STANDARD}" IN_LIST CMAKE_CXX_COMPILE_FEATURES) | ||
message(FATAL_ERROR "Compiler does not support C++${CMAKE_CXX_STANDARD}. This is required.") | ||
endif() | ||
endif() | ||
|
||
# install headers | ||
#===================================================================== | ||
include(GNUInstallDirs) | ||
include(CMakePackageConfigHelpers) | ||
|
||
install( | ||
DIRECTORY include/pressio | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
project(pressioops C CXX) | ||
|
||
# tests | ||
#===================================================================== | ||
option(PRESSIO_OPS_ENABLE_TESTS "Enable testing for pressio-ops" OFF) | ||
if(PRESSIO_OPS_ENABLE_TESTS) | ||
add_library(pressioops INTERFACE) | ||
|
||
target_include_directories( | ||
pressioops INTERFACE | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
) | ||
|
||
enable_testing() | ||
add_subdirectory(tests) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters