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/v1.0.1 #133

Merged
merged 7 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
104 changes: 82 additions & 22 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 All @@ -25,20 +25,24 @@ include( GNUInstallDirs )
set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_STANDARD_REQUIRED YES )

cmake_dependent_option(
cmake_dependent_option(
ACEtk.tests
"Build the ACEtk unit tests and integrate with ctest" ON
"BUILD_TESTING AND NOT ${subproject}" OFF
"Build the ACEtk unit tests and integrate with ctest" ON
"BUILD_TESTING AND NOT ${subproject}" OFF
)

cmake_dependent_option(
ACEtk.python
"Build ACEtk python bindings" ON
"NOT ${subproject} OR DEFINED require.ACEtk.python " OFF
)

if ( ACEtk.python )
set( require.tools.python CACHE BOOL ON )
endif()

option( ACEtk.installation "Install ACEtk" ON )

########################################################################
# Dependencies
########################################################################
Expand Down Expand Up @@ -66,17 +70,20 @@ endif()
# Project targets
########################################################################

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

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# ACEtk : library
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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

target_include_directories( ACEtk INTERFACE ${prefix} )

target_link_libraries( ACEtk
INTERFACE
njoy::tools
Expand All @@ -86,11 +93,12 @@ target_link_libraries( ACEtk
# ACEtk : python bindings
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

if( ACEtk.python )
if (ACEtk.python AND NOT TARGET njoy::tools.python)
message(WARNING "njoy::tools was not built with python enabled. Disabling build of ACEtk's python API.")
set(ACEtk.python OFF)
endif()

FetchContent_MakeAvailable(
pybind11
)
if(ACEtk.python)

pybind11_add_module( ACEtk.python
${CMAKE_CURRENT_SOURCE_DIR}/python/src/ACEtk.python.cpp
Expand Down Expand Up @@ -202,8 +210,8 @@ if( ACEtk.python )
${CMAKE_CURRENT_SOURCE_DIR}/python/src/PhotonuclearTable.python.cpp
)

target_link_libraries( ACEtk.python PRIVATE ACEtk )
add_dependencies( ACEtk.python tools.python )
target_link_libraries(ACEtk.python PRIVATE njoy::ACEtk)
add_dependencies( ACEtk.python njoy::tools.python)
target_include_directories( ACEtk.python PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/python/src )
target_compile_options( ACEtk.python PRIVATE -fvisibility=hidden )
set_target_properties( ACEtk.python PROPERTIES OUTPUT_NAME ACEtk )
Expand All @@ -212,17 +220,69 @@ if( ACEtk.python )

message( STATUS "Building ACEtk's python API" )

list( APPEND ACEtk_PYTHONPATH ${CMAKE_CURRENT_BINARY_DIR} )
list( APPEND tools_PYTHONPATH ${CMAKE_CURRENT_BINARY_DIR}/_deps/tools-build )
set( ACEtk_PYTHONPATH "${CMAKE_CURRENT_BINARY_DIR}" )
# Append potential installation and build paths for tools python module
set( tools_PYTHONPATH "${CMAKE_CURRENT_BINARY_DIR}/_deps/tools-build" )
if (tools_DIR)
set( tools_PYTHONPATH "${tools_PYTHONPATH}:${tools_DIR}/../../../lib64" )
endif()

if( ACEtk.tests )
include( cmake/unit_testing_python.cmake )
endif()

endif()

if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
if( ACEtk.tests )
include( cmake/unit_testing.cmake )
endif()
if( ${ACEtk.tests} )
include( cmake/unit_testing.cmake )
endif()

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

if(ACEtk.installation)
include(CMakePackageConfigHelpers)

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

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

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

string(TOLOWER ACEtk lowercasePackageName)

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

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

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

if(NOT subproject)
set(CPACK_PACKAGE_VENDOR "Los Alamos National Laboratory")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
include(CPack)
endif()
endif()
3 changes: 3 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Release Notes&mdash;ACEtk
Given here are some release notes for ACEtk.

## [ACEtk v1.0.1](https://github.com/njoy/ENDFtk/pull/133)
This updates the build system for ACEtk and contains no functional changes.

## [ACEtk v1.0.0](https://github.com/njoy/ENDFtk/pull/130)
This represents the first proper release of ACEtk.

Expand Down
7 changes: 7 additions & 0 deletions cmake/acetk-config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include(CMakeFindDependencyMacro)

if (NOT TARGET njoy::tools)
find_dependency(tools)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/ACEtk-targets.cmake")
42 changes: 27 additions & 15 deletions cmake/develop_dependencies.cmake
Original file line number Diff line number Diff line change
@@ -1,31 +1,43 @@
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( tools
GIT_REPOSITORY https://github.com/njoy/tools
GIT_TAG v0.3.0
GIT_REPOSITORY ../../njoy/tools
GIT_TAG v0.3.1
GIT_SHALLOW TRUE
)

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
)

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

if(ACEtk.python)
FetchContent_Declare( pybind11
GIT_REPOSITORY ../../pybind/pybind11
GIT_TAG v2.10.4
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(
pybind11
)
endif()

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

FetchContent_MakeAvailable(
tools
)
)
48 changes: 30 additions & 18 deletions cmake/release_dependencies.cmake
Original file line number Diff line number Diff line change
@@ -1,42 +1,54 @@
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 )
set( SPDLOG_INSTALL CACHE INTERNAL BOOL ON )

FetchContent_Declare( tools
GIT_REPOSITORY https://github.com/njoy/tools
GIT_TAG 368dbd9bd44754de616c46ffed0f80d2d16d8360 # tag: v0.3.0
GIT_REPOSITORY ../../njoy/tools
GIT_TAG 5f8429f804a842d165e0efdf1ca1d2d06e720f45 # tag: v0.3.1
)

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

if(ACEtk.python)
FetchContent_Declare( pybind11
GIT_REPOSITORY ../../pybind/pybind11
GIT_TAG 5b0a6fc2017fcc176545afe3e09c9f9885283242 # tag: v2.10.4
)
FetchContent_MakeAvailable(
pybind11
)
endif()

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

FetchContent_MakeAvailable(
fast_float
FastFloat
spdlog
tools
)

2 changes: 0 additions & 2 deletions cmake/unit_testing.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

enable_testing()

FetchContent_MakeAvailable( Catch2 )

function( add_cpp_test name source )

set( test_name "ACEtk.${name}.test" )
Expand Down