Skip to content
Merged
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
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ else()
set(MULTI_LIB_HEADERS 0)
function(compile_option VAR VALUE)
target_compile_definitions(QuEST PRIVATE ${VAR}=${VALUE})
set(${VAR} ${VALUE})
set(${VAR} ${VALUE} PARENT_SCOPE)
endfunction()
endif()

Expand Down Expand Up @@ -576,13 +576,18 @@ install(FILES
DESTINATION "${QuEST_INSTALL_CONFIGDIR}"
)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/include/quest.h"
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/quest/include/quest.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/include/quest/include/config.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/quest/include"
)

install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/quest/include"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/quest"
FILES_MATCHING PATTERN "*.h"
PATTERN "quest.h" EXCLUDE
)

install(EXPORT QuESTTargets
Expand Down
2 changes: 1 addition & 1 deletion quest/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# @author Erich Essmann
# @author Luc Jaulmes (using config file)

configure_file(quest.h.in "${CMAKE_BINARY_DIR}/include/quest.h" @ONLY)
configure_file(config.h.in "${CMAKE_BINARY_DIR}/include/quest/include/config.h" @ONLY)
22 changes: 22 additions & 0 deletions quest/include/config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef CONFIG_H
#define CONFIG_H

// be warned, the below is sensitive to whitespace after the slash
#if !defined(FLOAT_PRECISION)\
|| !defined(COMPILE_MPI)\
|| !defined(COMPILE_OPENMP)\
|| !defined(COMPILE_CUDA)\
|| !defined(COMPILE_CUQUANTUM)

// bind compile settings to installed exec
#if !@MULTI_LIB_HEADERS@
#cmakedefine FLOAT_PRECISION @FLOAT_PRECISION@
#cmakedefine01 COMPILE_MPI
#cmakedefine01 COMPILE_OPENMP
#cmakedefine01 COMPILE_CUDA
#cmakedefine01 COMPILE_CUQUANTUM
#endif

#endif

#endif
21 changes: 1 addition & 20 deletions quest/include/modes.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,8 @@



// ensure all mode flags are defined

#ifndef COMPILE_MPI
#error "Compiler must define COMPILE_MPI"
#endif

#ifndef COMPILE_OPENMP
#error "Compiler must define COMPILE_OPENMP"
#endif

#ifndef COMPILE_CUDA
#error "Compiler must define COMPILE_CUDA"
#endif

#ifndef COMPILE_CUQUANTUM
#error "Compiler must define COMPILE_CUQUANTUM"
#endif



// ensure all mode flags are valid values
// undefined allowed as undefined == 0 in C/C++ standards

#if ! (COMPILE_MPI == 0 || COMPILE_MPI == 1)
#error "Macro COMPILE_MPI must have value 0 or 1"
Expand Down
12 changes: 2 additions & 10 deletions quest/include/quest.h.in → quest/include/quest.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,12 @@
#define QUEST_H


// bind compile settings to installed exec
#if !@MULTI_LIB_HEADERS@
#cmakedefine FLOAT_PRECISION @FLOAT_PRECISION@
#cmakedefine01 COMPILE_MPI
#cmakedefine01 COMPILE_OPENMP
#cmakedefine01 COMPILE_CUDA
#cmakedefine01 COMPILE_CUQUANTUM
#endif


// include version first so it is accessible to
// debuggers in case a subsequent include fails
#include "quest/include/version.h"

#include "quest/include/config.h"

// include before API headers since it validates
// preprocessor configuration, and affirms macro
// preconditions assumed by subsequent header
Expand Down