-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hide json library from public headers (#182)
The json library is now only included in private headers/.cpp-files. This resolves some issues when compiling user-code which includes serialbox with nvcc.
- Loading branch information
Showing
36 changed files
with
969 additions
and
788 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,59 @@ | ||
##===------------------------------------------------------------------------------*- CMake -*-===## | ||
## | ||
## S E R I A L B O X | ||
## | ||
## This file is distributed under terms of BSD license. | ||
## See LICENSE.txt for more information. | ||
## | ||
##===------------------------------------------------------------------------------------------===## | ||
|
||
cmake_minimum_required(VERSION 3.12) | ||
|
||
## serialbox_add_gridtools_example | ||
## ------------------------------- | ||
## | ||
## Create and install a gridtools example | ||
## | ||
## NAME:STRING=<> - Name of target and executable | ||
## ARGN:STRINGS=<> - List of source files | ||
## | ||
function(serialbox_add_gridtools_example NAME) | ||
add_executable(${NAME} ${ARGN}) | ||
target_link_libraries(${NAME} | ||
SerialboxStatic | ||
GridTools_TARGET | ||
${CMAKE_THREAD_LIBS_INIT}) | ||
target_compile_definitions(${NAME} PUBLIC BOOST_NO_CXX11_DECLTYPE) | ||
install(TARGETS ${NAME} DESTINATION bin) | ||
|
||
if(SERIALBOX_TESTING) | ||
serialbox_add_test(TARGET ${NAME} EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/${NAME}) | ||
endif(SERIALBOX_TESTING) | ||
endfunction(serialbox_add_gridtools_example) | ||
|
||
## serialbox_add_python_example | ||
## ---------------------------- | ||
## | ||
## Install a python example | ||
## | ||
## ARGN:STRINGS=<> - List of source files | ||
## | ||
function(serialbox_add_python_example NAME) | ||
install(FILES ${NAME} ${ARGN} DESTINATION bin) | ||
endfunction(serialbox_add_python_example) | ||
|
||
## Build examples | ||
if(SERIALBOX_ENABLE_C) | ||
add_subdirectory(c) | ||
endif() | ||
|
||
if(SERIALBOX_ENABLE_FORTRAN) | ||
add_subdirectory(fortran) | ||
endif() | ||
|
||
if(SERIALBOX_ENABLE_PYTHON) | ||
add_subdirectory(python) | ||
endif() | ||
|
||
if(SERIALBOX_TESTING_GRIDTOOLS) | ||
add_subdirectory(gridtools) | ||
endif() | ||
|
||
##===------------------------------------------------------------------------------*- CMake -*-===## | ||
## | ||
## S E R I A L B O X | ||
## | ||
## This file is distributed under terms of BSD license. | ||
## See LICENSE.txt for more information. | ||
## | ||
##===------------------------------------------------------------------------------------------===## | ||
|
||
cmake_minimum_required(VERSION 3.12) | ||
|
||
## serialbox_add_gridtools_example | ||
## ------------------------------- | ||
## | ||
## Create and install a gridtools example | ||
## | ||
## NAME:STRING=<> - Name of target and executable | ||
## ARGN:STRINGS=<> - List of source files | ||
## | ||
function(serialbox_add_gridtools_example NAME) | ||
add_executable(${NAME} ${ARGN}) | ||
target_link_libraries(${NAME} | ||
SerialboxStatic | ||
GridTools_TARGET | ||
${CMAKE_THREAD_LIBS_INIT}) | ||
target_compile_definitions(${NAME} PUBLIC BOOST_NO_CXX11_DECLTYPE) | ||
install(TARGETS ${NAME} DESTINATION bin) | ||
if(SERIALBOX_TESTING) | ||
serialbox_add_test(TARGET ${NAME} EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/${NAME}) | ||
endif(SERIALBOX_TESTING) | ||
endfunction(serialbox_add_gridtools_example) | ||
|
||
## serialbox_add_python_example | ||
## ---------------------------- | ||
## | ||
## Install a python example | ||
## | ||
## ARGN:STRINGS=<> - List of source files | ||
## | ||
function(serialbox_add_python_example NAME) | ||
install(FILES ${NAME} ${ARGN} DESTINATION bin) | ||
endfunction(serialbox_add_python_example) | ||
|
||
## Build examples | ||
if(SERIALBOX_ENABLE_C) | ||
add_subdirectory(c) | ||
endif() | ||
|
||
if(SERIALBOX_ENABLE_FORTRAN) | ||
add_subdirectory(fortran) | ||
endif() | ||
|
||
if(SERIALBOX_ENABLE_PYTHON) | ||
add_subdirectory(python) | ||
endif() | ||
|
||
if(SERIALBOX_TESTING_GRIDTOOLS) | ||
add_subdirectory(gridtools) | ||
endif() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,108 +1,120 @@ | ||
##===------------------------------------------------------------------------------*- CMake -*-===## | ||
## | ||
## S E R I A L B O X | ||
## | ||
## This file is distributed under terms of BSD license. | ||
## See LICENSE.txt for more information. | ||
## | ||
##===------------------------------------------------------------------------------------------===## | ||
|
||
cmake_minimum_required(VERSION 3.12) | ||
|
||
set(SOURCES | ||
FieldMap.cpp | ||
FieldMap.h | ||
FieldMetainfoImpl.cpp | ||
FieldMetainfoImpl.h | ||
FieldID.cpp | ||
FieldID.h | ||
Logging.cpp | ||
Logging.h | ||
MetainfoMapImpl.cpp | ||
MetainfoMapImpl.h | ||
MetainfoValueImpl.cpp | ||
MetainfoValueImpl.h | ||
SavepointImpl.cpp | ||
SavepointImpl.h | ||
SavepointVector.cpp | ||
SavepointVector.h | ||
SerializerImpl.cpp | ||
SerializerImpl.h | ||
StorageView.cpp | ||
StorageView.h | ||
Type.cpp | ||
Type.h | ||
Unreachable.cpp | ||
Unreachable.h | ||
|
||
hash/HashFactory.cpp | ||
hash/HashFactory.h | ||
hash/SHA256.cpp | ||
hash/SHA256.h | ||
hash/MD5.cpp | ||
hash/MD5.h | ||
|
||
archive/ArchiveFactory.cpp | ||
archive/ArchiveFactory.h | ||
archive/BinaryArchive.cpp | ||
archive/BinaryArchive.h | ||
archive/NetCDFArchive.cpp | ||
archive/NetCDFArchive.h | ||
archive/MockArchive.cpp | ||
archive/MockArchive.h | ||
|
||
frontend/stella/MetainfoSet.cpp | ||
frontend/stella/MetainfoSet.h | ||
frontend/stella/Savepoint.cpp | ||
frontend/stella/Savepoint.h | ||
frontend/stella/Serializer.cpp | ||
frontend/stella/Serializer.h | ||
frontend/stella/DataFieldInfo.cpp | ||
frontend/stella/DataFieldInfo.h | ||
) | ||
|
||
add_library(SerialboxObjects OBJECT ${SOURCES}) | ||
target_include_directories(SerialboxObjects | ||
PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src> | ||
$<INSTALL_INTERFACE:include> | ||
) | ||
target_link_libraries(SerialboxObjects PUBLIC Boost::boost) | ||
target_link_libraries(SerialboxObjects PUBLIC SerialboxFilesytemTarget) | ||
target_link_libraries(SerialboxObjects PUBLIC ${CMAKE_THREAD_LIBS_INIT}) # TODO target based | ||
|
||
add_library(SerialboxStatic STATIC $<TARGET_OBJECTS:SerialboxObjects>) | ||
set_target_properties(SerialboxStatic PROPERTIES VERSION ${Serialbox_VERSION_STRING}) | ||
target_link_libraries(SerialboxStatic PUBLIC SerialboxObjects) | ||
if(BUILD_SHARED_LIBS) | ||
add_library(SerialboxShared $<TARGET_OBJECTS:SerialboxObjects>) | ||
set_target_properties(SerialboxShared PROPERTIES VERSION ${Serialbox_VERSION_STRING}) | ||
target_link_libraries(SerialboxShared PUBLIC SerialboxObjects) | ||
endif() | ||
|
||
if(SERIALBOX_USE_NETCDF) | ||
target_link_libraries(SerialboxStatic PRIVATE NETCDF_TARGET) | ||
if(BUILD_SHARED_LIBS) | ||
target_link_libraries(SerialboxShared PUBLIC NETCDF_TARGET) | ||
endif() | ||
#TODO try to make private once we protect our headers | ||
target_include_directories(SerialboxObjects PUBLIC SYSTEM ${NETCDF_INCLUDES}) | ||
endif() | ||
|
||
if(BUILD_SHARED_LIBS) | ||
set_property(TARGET SerialboxObjects PROPERTY POSITION_INDEPENDENT_CODE 1) | ||
endif() | ||
|
||
install(TARGETS SerialboxStatic SerialboxObjects | ||
EXPORT SerialboxTargets | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib | ||
) | ||
|
||
if(BUILD_SHARED_LIBS) | ||
install(TARGETS SerialboxShared | ||
EXPORT SerialboxTargets | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib | ||
) | ||
##===------------------------------------------------------------------------------*- CMake -*-===## | ||
## | ||
## S E R I A L B O X | ||
## | ||
## This file is distributed under terms of BSD license. | ||
## See LICENSE.txt for more information. | ||
## | ||
##===------------------------------------------------------------------------------------------===## | ||
|
||
cmake_minimum_required(VERSION 3.12) | ||
|
||
set(SOURCES | ||
FieldMap.cpp | ||
FieldMap.h | ||
FieldMapSerializer.h | ||
FieldMapSerializer.cpp | ||
FieldMetainfoImpl.cpp | ||
FieldMetainfoImpl.h | ||
FieldMetainfoImplSerializer.cpp | ||
FieldMetainfoImplSerializer.h | ||
FieldID.cpp | ||
FieldID.h | ||
Logging.cpp | ||
Logging.h | ||
MetainfoMapImpl.cpp | ||
MetainfoMapImpl.h | ||
MetainfoMapImplSerializer.cpp | ||
MetainfoMapImplSerializer.h | ||
MetainfoValueImpl.cpp | ||
MetainfoValueImpl.h | ||
SavepointImpl.cpp | ||
SavepointImpl.h | ||
SavepointImplSerializer.cpp | ||
SavepointImplSerializer.h | ||
SavepointVector.cpp | ||
SavepointVector.h | ||
SavepointVectorSerializer.cpp | ||
SavepointVectorSerializer.h | ||
SerializerImpl.cpp | ||
SerializerImpl.h | ||
StorageView.cpp | ||
StorageView.h | ||
Type.cpp | ||
Type.h | ||
Unreachable.cpp | ||
Unreachable.h | ||
|
||
hash/HashFactory.cpp | ||
hash/HashFactory.h | ||
hash/SHA256.cpp | ||
hash/SHA256.h | ||
hash/MD5.cpp | ||
hash/MD5.h | ||
|
||
archive/ArchiveFactory.cpp | ||
archive/ArchiveFactory.h | ||
archive/BinaryArchive.cpp | ||
archive/BinaryArchive.h | ||
archive/NetCDFArchive.cpp | ||
archive/NetCDFArchive.h | ||
archive/MockArchive.cpp | ||
archive/MockArchive.h | ||
|
||
frontend/stella/MetainfoSet.cpp | ||
frontend/stella/MetainfoSet.h | ||
frontend/stella/Savepoint.cpp | ||
frontend/stella/Savepoint.h | ||
frontend/stella/Serializer.cpp | ||
frontend/stella/Serializer.h | ||
frontend/stella/DataFieldInfo.cpp | ||
frontend/stella/DataFieldInfo.h | ||
) | ||
|
||
add_library(SerialboxObjects OBJECT ${SOURCES}) | ||
target_include_directories(SerialboxObjects | ||
PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src> | ||
$<INSTALL_INTERFACE:include> | ||
) | ||
target_link_libraries(SerialboxObjects PUBLIC Boost::boost) | ||
target_link_libraries(SerialboxObjects PUBLIC SerialboxFilesytemTarget) | ||
# we use "-lpthread" instead of ${CMAKE_THREAD_LIBS_INIT} on purpose, because ${CMAKE_THREAD_LIBS_INIT} | ||
# contains "-pthread" instead of "-lpthread" which is a problem if it propagates to nvcc via the target | ||
target_link_libraries(SerialboxObjects PUBLIC pthread) | ||
|
||
add_library(SerialboxStatic STATIC $<TARGET_OBJECTS:SerialboxObjects>) | ||
set_target_properties(SerialboxStatic PROPERTIES VERSION ${Serialbox_VERSION_STRING}) | ||
target_link_libraries(SerialboxStatic PUBLIC SerialboxObjects) | ||
if(BUILD_SHARED_LIBS) | ||
add_library(SerialboxShared $<TARGET_OBJECTS:SerialboxObjects>) | ||
set_target_properties(SerialboxShared PROPERTIES VERSION ${Serialbox_VERSION_STRING}) | ||
target_link_libraries(SerialboxShared PUBLIC SerialboxObjects) | ||
endif() | ||
|
||
if(SERIALBOX_USE_NETCDF) | ||
target_link_libraries(SerialboxStatic PRIVATE NETCDF_TARGET) | ||
if(BUILD_SHARED_LIBS) | ||
target_link_libraries(SerialboxShared PUBLIC NETCDF_TARGET) | ||
endif() | ||
#TODO try to make private once we protect our headers | ||
target_include_directories(SerialboxObjects PUBLIC SYSTEM ${NETCDF_INCLUDES}) | ||
endif() | ||
|
||
if(BUILD_SHARED_LIBS) | ||
set_property(TARGET SerialboxObjects PROPERTY POSITION_INDEPENDENT_CODE 1) | ||
endif() | ||
|
||
install(TARGETS SerialboxStatic SerialboxObjects | ||
EXPORT SerialboxTargets | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib | ||
) | ||
|
||
if(BUILD_SHARED_LIBS) | ||
install(TARGETS SerialboxShared | ||
EXPORT SerialboxTargets | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib | ||
) | ||
endif() |
Oops, something went wrong.