diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml
index d878d6dc..7a32d959 100644
--- a/.github/workflows/build_wheels.yml
+++ b/.github/workflows/build_wheels.yml
@@ -10,6 +10,7 @@ jobs:
matrix:
#os: [ubuntu-20.04, windows-2019, macos-11]
os: [ubuntu-20.04, macos-11]
+ arch: [x86_64, auto32, auto64, aarch64, ppc64le, s390x, arm64]
steps:
- name: Checkout LeptonInjector
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6c147ab3..dbff4e3d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,26 +58,8 @@ else()
endif()
# load python and pybind11
+include(Python)
include(pybind11)
-if(CMAKE_VERSION VERSION_LESS 3.12.0)
- if(Python_ROOT_DIR)
- MESSAGE(WARNING "Python_ROOT_DIR is set but will be ignored by this version of CMake; set PYTHON_EXECUTABLE instead")
- endif()
- find_package(PythonInterp)
- find_package(PythonLibs)
- set(PYTHON_FOUND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND)
-else()
- if(PYTHON_EXECUTABLE)
- MESSAGE(WARNING "PYTHON_EXECUTABLE is set but will be ignored by this version of CMake; set Python_ROOT_DIR instead")
- endif()
- find_package(Python COMPONENTS Interpreter Development)
- set(PYTHON_FOUND Python_Interpreter_FOUND AND Python_Development_FOUND)
- set(PYTHON_EXECUTABLE "${Python_EXECUTABLE}")
- set(PYTHON_INCLUDE_DIRS "${Python_INCLUDE_DIRS}")
- set(PYTHON_LIBRARIES "${Python_LIBRARIES}")
- set(PYTHON_VERSION_MAJOR "${Python_VERSION_MAJOR}")
- set(PYTHON_VERSION_MINOR "${Python_VERSION_MINOR}")
-endif()
# load project dependencies
include(rk)
@@ -105,33 +87,35 @@ add_library(LeptonInjector SHARED)
set_property(TARGET LeptonInjector PROPERTY POSITION_INDEPENDENT_CODE ON)
if(${MACOSX})
target_link_libraries(LeptonInjector
- LI_utilities
- LI_serialization
- LI_math
- LI_dataclasses
- LI_geometry
- LI_detector
- LI_crosssections
- LI_distributions
- LI_injection
- rk
- delabella
+ PRIVATE
+ PUBLIC
+ delabella_shared
+ photospline
+ LI_utilities
+ LI_serialization
+ LI_math
+ LI_dataclasses
+ LI_geometry
+ LI_detector
+ LI_crosssections
+ LI_distributions
+ LI_injection
)
else()
target_link_libraries(LeptonInjector
- LI_utilities
- LI_serialization
- LI_math
- LI_dataclasses
- LI_geometry
- LI_detector
- LI_crosssections
- LI_distributions
- LI_injection
- -Wl,--whole-archive
- rk
- delabella
- -Wl,--no-whole-archive
+ PRIVATE
+ PUBLIC
+ photospline
+ delabella_shared
+ LI_utilities
+ LI_serialization
+ LI_math
+ LI_dataclasses
+ LI_geometry
+ LI_detector
+ LI_crosssections
+ LI_distributions
+ LI_injection
)
endif()
@@ -144,15 +128,48 @@ if(DEFINED SKBUILD)
message(STATUS "Setting LeptonInjector install lib dir to: ${CI_INSTALL_PREFIX}/lib")
message(STATUS "Setting LeptonInjector install include dir to: ${CI_INSTALL_PREFIX}/include")
install(TARGETS LeptonInjector
+ delabella_shared
+ LI_utilities
+ LI_serialization
+ LI_math
+ LI_dataclasses
+ LI_geometry
+ LI_detector
+ LI_crosssections
+ LI_distributions
+ LI_injection
+ EXPORT ${PROJECT_NAME}Config
LIBRARY DESTINATION "${CI_INSTALL_PREFIX}/lib"
PUBLIC_HEADER DESTINATION "${CI_INSTALL_PREFIX}/include")
else()
install(TARGETS LeptonInjector
+ delabella_shared
+ LI_utilities
+ LI_serialization
+ LI_math
+ LI_dataclasses
+ LI_geometry
+ LI_detector
+ LI_crosssections
+ LI_distributions
+ LI_injection
+ EXPORT ${PROJECT_NAME}Config
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/leptoninjector.libs
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()
else()
install(TARGETS LeptonInjector
+ delabella_shared
+ LI_utilities
+ LI_serialization
+ LI_math
+ LI_dataclasses
+ LI_geometry
+ LI_detector
+ LI_crosssections
+ LI_distributions
+ LI_injection
+ EXPORT ${PROJECT_NAME}Config
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()
@@ -201,9 +218,30 @@ if(DEFINED SKBUILD)
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/leptoninjector)
install(TARGETS injection
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/leptoninjector)
- install(FILES ${PROJECT_SOURCE_DIR}/python/__init__.py DESTINATION ${CMAKE_INSTALL_LIBDIR}/leptoninjector)
+ install(FILES ${PROJECT_SOURCE_DIR}/python/__init__.py
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/leptoninjector)
endif()
+# Export targets for use in downstream CMake projects
+# -----------------------------------------------------------------------------
+include(CMakePackageConfigHelpers)
+# Make importable from build directory
+write_basic_package_version_file(
+ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
+ VERSION ${PROJECT_VERSION}
+ COMPATIBILITY AnyNewerVersion
+)
+export(EXPORT ${PROJECT_NAME}Config FILE ${PROJECT_NAME}Config.cmake)
+
+# Make importable from install location
+set(_config_dir share/${PROJECT_NAME}/cmake)
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
+ DESTINATION ${_config_dir}
+)
+install(EXPORT ${PROJECT_NAME}Config
+ DESTINATION ${_config_dir}
+)
+
MESSAGE("")
MESSAGE("Done!")
MESSAGE("Run `make` then `make install`")
diff --git a/cmake/Packages/Python.cmake b/cmake/Packages/Python.cmake
index 9b1e6b16..c79b2874 100644
--- a/cmake/Packages/Python.cmake
+++ b/cmake/Packages/Python.cmake
@@ -2,14 +2,23 @@ IF(CMAKE_VERSION VERSION_LESS 3.12.0)
IF(Python_ROOT_DIR)
MESSAGE(WARNING "Python_ROOT_DIR is set but will be ignored by this version of CMake; set PYTHON_EXECUTABLE instead")
ENDIF(Python_ROOT_DIR)
- find_package(PythonInterp)
- find_package(PythonLibs)
+ IF(PYTHON_VERSION)
+ find_package(PythonInterp ${PYTHON_VERSION})
+ find_package(PythonLibs ${PYTHON_VERSION})
+ ELSE(PYTHON_VERSION)
+ find_package(PythonInterp)
+ find_package(PythonLibs)
+ ENDIF(PYTHON_VERSION)
set(PYTHON_FOUND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND)
ELSE()
IF(PYTHON_EXECUTABLE)
MESSAGE(WARNING "PYTHON_EXECUTABLE is set but will be ignored by this version of CMake; set Python_ROOT_DIR instead")
ENDIF(PYTHON_EXECUTABLE)
- FIND_PACKAGE(Python COMPONENTS Interpreter Development)
+ IF(PYTHON_VERSION)
+ FIND_PACKAGE(Python ${PYTHON_VERSION} COMPONENTS Interpreter Development)
+ ELSE(PYTHON_VERSION)
+ FIND_PACKAGE(Python COMPONENTS Interpreter Development)
+ ENDIF(PYTHON_VERSION)
SET(PYTHON_FOUND "${Python_FOUND}")
SET(PYTHON_EXECUTABLE "${Python_EXECUTABLE}")
SET(PYTHON_INCLUDE_DIRS "${Python_INCLUDE_DIRS}")
diff --git a/cmake/Packages/cereal.cmake b/cmake/Packages/cereal.cmake
index df8ac12c..86b3fbbd 100644
--- a/cmake/Packages/cereal.cmake
+++ b/cmake/Packages/cereal.cmake
@@ -22,5 +22,5 @@ endif()
set(JUST_INSTALL_CEREAL ON CACHE INTERNAL "Cereal just install library.")
set(SKIP_PORTABILITY_TEST ON CACHE INTERNAL "Skip cereal portability tests.")
set(SKIP_PERFORMANCE_COMPARISON ON CACHE INTERNAL "Skip cereal performance comparison.")
-add_subdirectory("${PROJECT_SOURCE_DIR}/vendor/cereal" "extern/cereal" EXCLUDE_FROM_ALL)
+add_subdirectory("${PROJECT_SOURCE_DIR}/vendor/cereal" "extern/cereal")
include_directories("${PROJECT_SOURCE_DIR}/vendor/cereal/include")
diff --git a/cmake/Packages/delabella.cmake b/cmake/Packages/delabella.cmake
index 53c4314c..bfe5c53e 100644
--- a/cmake/Packages/delabella.cmake
+++ b/cmake/Packages/delabella.cmake
@@ -19,4 +19,14 @@ if(NOT EXISTS "${PROJECT_SOURCE_DIR}/vendor/delabella/CMakeLists.txt")
message(FATAL_ERROR "The delabella submodule was not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.")
endif()
-add_subdirectory(${PROJECT_SOURCE_DIR}/vendor/delabella EXCLUDE_FROM_ALL)
+add_subdirectory(${PROJECT_SOURCE_DIR}/vendor/delabella)
+#add_subdirectory(${PROJECT_SOURCE_DIR}/vendor/delabella)
+#install(TARGETS delabella_shared
+# ARCHIVE DESTINATION lib)
+#set(_config_dir share/delabella/cmake)
+#install(FILES "${CMAKE_CURRENT_BINARY_DIR}/delabellaConfigVersion.cmake"
+# DESTINATION ${_config_dir}
+#)
+#install(EXPORT delabellaConfig
+# DESTINATION ${_config_dir}
+#)
diff --git a/cmake/Packages/photospline.cmake b/cmake/Packages/photospline.cmake
index d0ab9e32..7394fb6c 100644
--- a/cmake/Packages/photospline.cmake
+++ b/cmake/Packages/photospline.cmake
@@ -19,7 +19,8 @@ if(NOT EXISTS "${PROJECT_SOURCE_DIR}/vendor/photospline/CMakeLists.txt")
message(FATAL_ERROR "The photospline submodule was not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.")
endif()
-add_subdirectory(${PROJECT_SOURCE_DIR}/vendor/photospline EXCLUDE_FROM_ALL)
+#add_subdirectory(${PROJECT_SOURCE_DIR}/vendor/photospline EXCLUDE_FROM_ALL)
+add_subdirectory(${PROJECT_SOURCE_DIR}/vendor/photospline)
if(DEFINED SKBUILD)
if(${CIBUILDWHEEL})
message(STATUS "Setting photospline install lib dir to: ${CI_INSTALL_PREFIX}/lib")
@@ -42,6 +43,6 @@ if(DEFINED SKBUILD)
# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/leptoninjector.libs
# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
else()
- install(TARGETS photospline DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ #install(TARGETS photospline DESTINATION ${CMAKE_INSTALL_LIBDIR})
#install(TARGETS spglam DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
diff --git a/cmake/testing.cmake b/cmake/testing.cmake
index ecd096c4..143dc604 100644
--- a/cmake/testing.cmake
+++ b/cmake/testing.cmake
@@ -13,7 +13,7 @@ set_target_properties(gmock_main PROPERTIES FOLDER extern)
macro(package_add_test TESTNAME)
add_executable(${TESTNAME} ${ARGN})
target_link_libraries(${TESTNAME} gtest gmock gtest_main LeptonInjector)
- add_dependencies(${TESTNAME} rk)
+ add_dependencies(${TESTNAME} rk_static)
add_test(NAME ${TESTNAME} COMMAND ${TESTNAME} WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
set_target_properties(${TESTNAME} PROPERTIES FOLDER tests)
endmacro()
diff --git a/projects/crosssections/CMakeLists.txt b/projects/crosssections/CMakeLists.txt
index 20ade2d9..79221590 100644
--- a/projects/crosssections/CMakeLists.txt
+++ b/projects/crosssections/CMakeLists.txt
@@ -7,28 +7,28 @@ LIST (APPEND crosssections_SOURCES
${PROJECT_SOURCE_DIR}/projects/crosssections/private/DipoleFromTable.cxx
${PROJECT_SOURCE_DIR}/projects/crosssections/private/NeutrissimoDecay.cxx
${PROJECT_SOURCE_DIR}/projects/crosssections/private/DISFromSpline.cxx
+ ${PROJECT_SOURCE_DIR}/projects/crosssections/private/HNLFromSpline.cxx
${PROJECT_SOURCE_DIR}/projects/crosssections/private/ElasticScattering.cxx
+ ${PROJECT_SOURCE_DIR}/projects/crosssections/private/DummyCrossSection.cxx
)
add_library(LI_crosssections OBJECT ${crosssections_SOURCES})
set_property(TARGET LI_crosssections PROPERTY POSITION_INDEPENDENT_CODE ON)
target_include_directories(LI_crosssections PUBLIC
- ${PROJECT_SOURCE_DIR}/projects/crosssections/public/
+ $
+ $
)
-add_dependencies(LI_crosssections rk)
-add_dependencies(LI_crosssections LI_serialization LI_utilities LI_math LI_dataclasses LI_detector)
-target_link_libraries(LI_crosssections photospline)
-target_link_libraries(LI_crosssections rk)
-
-target_include_directories(LI_crosssections PUBLIC ${PROJECT_SOURCE_DIR}/vendor/rk/include)
-target_include_directories(LI_crosssections PUBLIC ${PROJECT_SOURCE_DIR}/projects/serialization/public/)
-target_include_directories(LI_crosssections PUBLIC ${PROJECT_SOURCE_DIR}/projects/utilities/public/)
-target_include_directories(LI_crosssections PUBLIC ${PROJECT_SOURCE_DIR}/projects/math/public/)
-target_include_directories(LI_crosssections PUBLIC ${PROJECT_SOURCE_DIR}/projects/detector/public/)
-target_include_directories(LI_crosssections PUBLIC ${PROJECT_SOURCE_DIR}/projects/dataclasses/public/)
-
-install(TARGETS LI_crosssections
- PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+target_link_libraries(LI_crosssections
+ PRIVATE
+ $
+ PUBLIC
+ photospline
+ LI_serialization
+ LI_utilities
+ LI_math
+ LI_dataclasses
+ LI_detector
+)
install(DIRECTORY "${PROJECT_SOURCE_DIR}/projects/crosssections/public/"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
@@ -42,7 +42,7 @@ package_add_test(UnitTest_DipoleFromTable ${PROJECT_SOURCE_DIR}/projects/crossse
#package_add_test(UnitTest_ElasticScattering ${PROJECT_SOURCE_DIR}/projects/crosssections/private/test/ElasticScattering_TEST.cxx)
pybind11_add_module(crosssections ${PROJECT_SOURCE_DIR}/projects/crosssections/private/pybindings/crosssections.cxx)
-target_link_libraries(crosssections PRIVATE LeptonInjector photospline rk)
+target_link_libraries(crosssections PRIVATE LeptonInjector photospline rk_static)
if(DEFINED SKBUILD)
set_target_properties(crosssections PROPERTIES
BUILD_WITH_INSTALL_RPATH FALSE
diff --git a/projects/crosssections/private/CrossSectionCollection.cxx b/projects/crosssections/private/CrossSectionCollection.cxx
index 0c094eb1..9168e138 100644
--- a/projects/crosssections/private/CrossSectionCollection.cxx
+++ b/projects/crosssections/private/CrossSectionCollection.cxx
@@ -1,14 +1,18 @@
-#include