Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.27)

set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -freflection -fno-access-contexts -std=c++26")
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")

project(mppi
VERSION 0.10.2
Expand All @@ -13,6 +9,9 @@ find_package(MPI REQUIRED)

include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
if(PROJECT_IS_TOP_LEVEL)
include(CTest)
endif()

add_library(mppi INTERFACE)
target_include_directories(mppi
Expand All @@ -22,16 +21,9 @@ target_include_directories(mppi

add_library(mppi::mppi ALIAS mppi)
target_link_libraries(mppi INTERFACE MPI::MPI_CXX)
target_compile_features(mppi INTERFACE cxx_std_23)

# set Release as the default build type if it is not yet set.
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif(NOT CMAKE_BUILD_TYPE)
target_compile_features(mppi INTERFACE cxx_std_26)

# only combile tests in debug mode
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
if(BUILD_TESTING)
add_subdirectory(tests)
endif()

Expand Down
46 changes: 46 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"version": 5,
"cmakeMinimumRequired": {
"major": 3,
"minor": 27,
"patch": 0
},
"configurePresets": [
{
"name": "clang_reflection",
"hidden": true,
"cacheVariables": {
"CMAKE_CXX_STANDARD": "26",
"CMAKE_CXX_STANDARD_REQUIRED": "ON",
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/cmake/toolchains/clang-p2996-libcxx.cmake"
}
},
{
"name": "release",
"displayName": "Release",
"inherits": "clang_reflection",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "debug",
"displayName": "Debug",
"inherits": "clang_reflection",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
}
],

"buildPresets": [
{
"name": "release",
"configurePreset": "release"
},
{
"name": "debug",
"configurePreset": "debug"
}
]
}
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ Additionally, for the tests:

To build, test and install the MPPI library execute
```shell
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/my/install/prefix ..
make [-j N]
make install
cmake --preset release -B build -S . -DCMAKE_INSTALL_PREFIX=/my/install/prefix ..
cmake --build build
cmake --install build
```

## Notes
Expand Down
5 changes: 5 additions & 0 deletions cmake/toolchains/clang-p2996-libcxx.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)

add_compile_options(-stdlib=libc++ -freflection)
add_link_options(-stdlib=libc++)