Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rc/v0.3.1 #41

Merged
merged 5 commits into from
Jul 2, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/ContinuousIntegration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ ubuntu-20.04, macos-11 ]
cxx: [ clang++, g++-10 ]
os: [ ubuntu-22.04, macos-12 ]
cxx: [ clang++, g++-11 ]
build_type: [ Debug, Release ]

steps:
Expand Down
76 changes: 69 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Preamble
########################################################################

cmake_minimum_required( VERSION 3.14 )
cmake_minimum_required( VERSION 3.27 )

set( subproject OFF )
if( DEFINED PROJECT_NAME )
Expand Down Expand Up @@ -35,6 +35,7 @@ cmake_dependent_option(
"Build tools python bindings" ON
"NOT ${subproject} OR DEFINED require.tools.python " OFF
)
option( tools.installation "Install njoy::tools" ON )

########################################################################
# Dependencies
Expand Down Expand Up @@ -69,11 +70,14 @@ endif()

add_library( tools INTERFACE )
add_library( njoy::tools ALIAS tools )
target_include_directories( tools
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>

string( CONCAT prefix
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)

target_include_directories( tools INTERFACE ${prefix} )

target_link_libraries( tools
INTERFACE
spdlog::spdlog
Expand All @@ -88,11 +92,10 @@ target_compile_definitions( tools INTERFACE -DNANORANGE_NO_STD_FORWARD_DECLARATI

if( tools.python )

FetchContent_MakeAvailable( pybind11 )

pybind11_add_module( tools.python
python/src/tools.python.cpp
)
add_library( njoy::tools.python ALIAS tools.python )

target_link_libraries( tools.python PRIVATE tools )
target_include_directories( tools.python PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/python/src )
Expand All @@ -116,3 +119,62 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
include( cmake/unit_testing.cmake )
endif()
endif()

#######################################################################
# Installation
#######################################################################

if(tools.installation)
include(CMakePackageConfigHelpers)

install(TARGETS tools EXPORT tools-targets
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)

install(EXPORT tools-targets
FILE "tools-targets.cmake"
NAMESPACE njoy::
DESTINATION share/cmake/tools
)

install(DIRECTORY src/
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
FILES_MATCHING PATTERN "*.hpp"
PATTERN "*test*" EXCLUDE
)

write_basic_package_version_file("tools-config-version.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion)

configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/tools-config.cmake.in
${PROJECT_BINARY_DIR}/tools-config.cmake
INSTALL_DESTINATION share/cmake/tools
)

install(FILES
"${PROJECT_BINARY_DIR}/tools-config.cmake"
"${PROJECT_BINARY_DIR}/tools-config-version.cmake"
DESTINATION share/cmake/tools
)

if(NOT subproject)
set(CPACK_PACKAGE_VENDOR "Los Alamos National Laboratory")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
include(CPack)
endif()

if(tools.python)

install(TARGETS tools.python EXPORT tools-targets
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
)

endif()

endif()
55 changes: 34 additions & 21 deletions cmake/develop_dependencies.cmake
Original file line number Diff line number Diff line change
@@ -1,40 +1,53 @@
cmake_minimum_required( VERSION 3.14 )
cmake_minimum_required( VERSION 3.27 )
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/.cmake)
include( FetchContent )

#######################################################################
# Declare project dependencies
#######################################################################

FetchContent_Declare( spdlog
GIT_REPOSITORY https://github.com/gabime/spdlog
GIT_TAG v1.11.0
GIT_SHALLOW TRUE
)
set( SPDLOG_BUILD_PIC CACHE INTERNAL BOOL ON )

FetchContent_Declare( Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2
GIT_TAG v3.3.2
GIT_SHALLOW TRUE
)

FetchContent_Declare( pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11
GIT_TAG v2.10.4
FetchContent_Declare( FastFloat
GIT_REPOSITORY ../../fastfloat/fast_float
GIT_TAG v6.1.1
GIT_SHALLOW TRUE
)

FetchContent_Declare( fast_float
GIT_REPOSITORY https://github.com/fastfloat/fast_float
GIT_TAG v6.1.1
FetchContent_Declare( spdlog
GIT_REPOSITORY ../../gabime/spdlog
GIT_TAG v1.11.0
GIT_SHALLOW TRUE
)
set( SPDLOG_BUILD_PIC CACHE INTERNAL BOOL ON )
if (tools.installation)
set( SPDLOG_INSTALL CACHE INTERNAL BOOL ON )
else()
set( SPDLOG_INSTALL CACHE INTERNAL BOOL OFF )
endif()

#######################################################################
# Load dependencies
#######################################################################

FetchContent_MakeAvailable(
spdlog
fast_float
)
FastFloat
)

if (tools.tests)
FetchContent_Declare( Catch2
GIT_REPOSITORY ../../catchorg/catch2
GIT_TAG v3.3.2
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(Catch2)
endif()

if (tools.python)
FetchContent_Declare( pybind11
GIT_REPOSITORY ../../pybind/pybind11
GIT_TAG v2.10.4
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(pybind11)
endif()
45 changes: 29 additions & 16 deletions cmake/release_dependencies.cmake
Original file line number Diff line number Diff line change
@@ -1,36 +1,49 @@
cmake_minimum_required( VERSION 3.14 )
cmake_minimum_required( VERSION 3.27 )
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/.cmake)
include( FetchContent )

#######################################################################
# Declare project dependencies
#######################################################################

FetchContent_Declare( Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2
GIT_TAG 3f0283de7a9c43200033da996ff9093be3ac84dc # tag: v3.3.2
)

FetchContent_Declare( fast_float
GIT_REPOSITORY https://github.com/fastfloat/fast_float
FetchContent_Declare( FastFloat
GIT_REPOSITORY ../../fastfloat/fast_float
GIT_TAG f476bc713fda06fbd34dc621b466745a574b3d4c # tag: v6.1.1
)

FetchContent_Declare( pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11
GIT_TAG 5b0a6fc2017fcc176545afe3e09c9f9885283242 # tag: v2.10.4
)

FetchContent_Declare( spdlog
GIT_REPOSITORY https://github.com/gabime/spdlog
GIT_REPOSITORY ../../gabime/spdlog
GIT_TAG ad0e89cbfb4d0c1ce4d097e134eb7be67baebb36 # tag: v1.11.0
)
set( SPDLOG_BUILD_PIC CACHE INTERNAL BOOL ON )

if (tools.installation)
set( SPDLOG_INSTALL CACHE INTERNAL BOOL ON )
else()
set( SPDLOG_INSTALL CACHE INTERNAL BOOL OFF )
endif()

#######################################################################
# Load dependencies
#######################################################################

FetchContent_MakeAvailable(
fast_float
FastFloat
spdlog
)

if (tools.tests)
FetchContent_Declare( Catch2
GIT_REPOSITORY ../../catchorg/Catch2
GIT_TAG 3f0283de7a9c43200033da996ff9093be3ac84dc # tag: v3.3.2
)

FetchContent_MakeAvailable(Catch2)
endif()

if (tools.python)
FetchContent_Declare( pybind11
GIT_REPOSITORY ../../pybind/pybind11
GIT_TAG 5b0a6fc2017fcc176545afe3e09c9f9885283242 # tag: v2.10.4
)
FetchContent_MakeAvailable(pybind11)
endif()
12 changes: 12 additions & 0 deletions cmake/tools-config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
include(CMakeFindDependencyMacro)

if (NOT TARGET spdlog::spdlog)
find_dependency(spdlog)
endif()


if (NOT TARGET FastFloat::fast_float)
find_dependency(FastFloat)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/tools-targets.cmake")
2 changes: 0 additions & 2 deletions cmake/unit_testing.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
message( STATUS "Adding tools unit testing" )
enable_testing()

FetchContent_MakeAvailable( Catch2 )

function( add_cpp_test name source )

set( test_name "tools.${name}.test" )
Expand Down
1 change: 1 addition & 0 deletions src/tools/disco/Record/test/Record.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

// other includes
#include <vector>
#include <tuple>
#include "tools/disco/Integer.hpp"
#include "tools/disco/Scientific.hpp"
#include "tools/disco/Column.hpp"
Expand Down