Skip to content

Commit a626880

Browse files
committed
Cmake: Release Channel
Add support for an `openPMD_RELEASE_CHANNEL` variable. This var can be set in conda/spack/pypi/... release channels to something different than "source" and we can ask the user later on for it via a simple runtime API call.
1 parent 163a0f0 commit a626880

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

CMakeLists.txt

+10
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ if(WIN32)
2929
endif()
3030

3131

32+
# Release channel #############################################################
33+
#
34+
set(openPMD_RELEASE_CHANNEL "source"
35+
CACHE STRING "Describes the method openPMD-api was installed with.")
36+
37+
3238
# Options and Variants ########################################################
3339
#
3440
function(openpmd_option name description default)
@@ -271,6 +277,9 @@ set(IO_ADIOS1_SOURCE
271277
add_library(openPMD ${CORE_SOURCE} ${IO_SOURCE})
272278
add_library(openPMD::openPMD ALIAS openPMD)
273279

280+
# release channel
281+
target_compile_definitions(openPMD PUBLIC "-DOPENPMD_RELEASE_CHANNEL=${OPENPMD_RELEASE_CHANNEL}")
282+
274283
# properties
275284
target_compile_features(openPMD
276285
PUBLIC cxx_std_11
@@ -832,6 +841,7 @@ message("")
832841
message("openPMD build configuration:")
833842
message(" library Version: ${openPMD_VERSION}")
834843
message(" openPMD Standard: ${openPMD_STANDARD_VERSION}")
844+
message(" release channel: ${openPMD_RELEASE_CHANNEL}")
835845
message(" C++ Compiler: ${CMAKE_CXX_COMPILER_ID} "
836846
"${CMAKE_CXX_COMPILER_VERSION} "
837847
"${CMAKE_CXX_COMPILER_WRAPPER}")

include/openPMD/version.hpp

+5
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,8 @@
3535
#define OPENPMD_STANDARD_MIN_MAJOR 1
3636
#define OPENPMD_STANDARD_MIN_MINOR 0
3737
#define OPENPMD_STANDARD_MIN_PATCH 0
38+
39+
// release channel
40+
#if !defined(OPENPMD_RELEASE_CHANNEL)
41+
# define OPENPMD_RELEASE_CHANNEL "source"
42+
#endif

openPMDConfig.cmake.in

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ include(CMakeFindDependencyMacro)
44

55
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/Modules")
66

7+
set(openPMD_RELEASE_CHANNEL @openPMD_RELEASE_CHANNEL@)
8+
79
set(openPMD_HAVE_MPI @openPMD_HAVE_MPI@)
810
if(openPMD_HAVE_MPI)
911
find_dependency(MPI)

0 commit comments

Comments
 (0)