Skip to content

Commit 0d7a0e1

Browse files
authored
Merge pull request #2006 from kkiesling/thirdparty_libs
Update Cmake to allow third-party libraries
2 parents 44d0e81 + ea551e3 commit 0d7a0e1

3 files changed

Lines changed: 33 additions & 11 deletions

File tree

‎CMakeLists.txt‎

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,18 @@ if(pugixml_FOUND)
7171
else()
7272
message(STATUS "Did not find pugixml, will use submodule instead")
7373
endif()
74-
74+
find_package(xtensor QUIET NO_SYSTEM_ENVIRONMENT_PATH)
75+
if(xtensor_FOUND)
76+
message(STATUS "Found xtensor: ${xtensor_DIR} (version ${xtensor_VERSION})")
77+
else()
78+
message(STATUS "Did not find xtensor, will use submodule instead")
79+
endif()
80+
find_package(gsl-lite QUIET NO_SYSTEM_ENVIRONMENT_PATH)
81+
if(gsl-lite_FOUND)
82+
message(STATUS "Found gsl-lite: ${gsl-lite_DIR} (version ${gsl-lite_VERSION})")
83+
else()
84+
message(STATUS "Did not find gsl-lite, will use submodule instead")
85+
endif()
7586
#===============================================================================
7687
# libMesh Unstructured Mesh Support
7788
#===============================================================================
@@ -211,19 +222,23 @@ if (NOT (CMAKE_VERSION VERSION_LESS 3.13))
211222
cmake_policy(SET CMP0079 NEW)
212223
endif()
213224

214-
add_subdirectory(vendor/xtl)
215-
set(xtl_DIR ${CMAKE_CURRENT_BINARY_DIR}/vendor/xtl)
216-
add_subdirectory(vendor/xtensor)
225+
if (NOT xtensor_FOUND)
226+
add_subdirectory(vendor/xtl)
227+
set(xtl_DIR ${CMAKE_CURRENT_BINARY_DIR}/vendor/xtl)
228+
add_subdirectory(vendor/xtensor)
229+
endif()
217230

218231
#===============================================================================
219232
# GSL header-only library
220233
#===============================================================================
221234

222-
add_subdirectory(vendor/gsl-lite)
235+
if (NOT gsl-lite_FOUND)
236+
add_subdirectory(vendor/gsl-lite)
223237

224-
# Make sure contract violations throw exceptions
225-
target_compile_definitions(gsl-lite-v1 INTERFACE GSL_THROW_ON_CONTRACT_VIOLATION)
226-
target_compile_definitions(gsl-lite-v1 INTERFACE gsl_CONFIG_ALLOWS_NONSTRICT_SPAN_COMPARISON=1)
238+
# Make sure contract violations throw exceptions
239+
target_compile_definitions(gsl-lite-v1 INTERFACE GSL_THROW_ON_CONTRACT_VIOLATION)
240+
target_compile_definitions(gsl-lite-v1 INTERFACE gsl_CONFIG_ALLOWS_NONSTRICT_SPAN_COMPARISON=1)
241+
endif()
227242

228243
#===============================================================================
229244
# RPATH information
@@ -422,7 +437,13 @@ endif()
422437
# target_link_libraries treats any arguments starting with - but not -l as
423438
# linker flags. Thus, we can pass both linker flags and libraries together.
424439
target_link_libraries(libopenmc ${ldflags} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES}
425-
pugixml faddeeva xtensor gsl-lite-v1 fmt::fmt)
440+
faddeeva xtensor gsl::gsl-lite-v1 fmt::fmt)
441+
442+
if(TARGET pugixml::pugixml)
443+
target_link_libraries(libopenmc pugixml::pugixml)
444+
else()
445+
target_link_libraries(libopenmc pugixml)
446+
endif()
426447

427448
if(dagmc)
428449
target_compile_definitions(libopenmc PRIVATE DAGMC)

‎src/plot.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <sstream>
77

88
#include "xtensor/xview.hpp"
9+
#include "xtensor/xmanipulation.hpp"
910
#include <fmt/core.h>
1011
#include <fmt/ostream.h>
1112
#ifdef USE_LIBPNG

‎tools/ci/gha-install-vectfit.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ set -ex
44
PYBIND_BRANCH='master'
55
PYBIND_REPO='https://github.com/pybind/pybind11'
66

7-
XTL_BRANCH='0.6.9'
7+
XTL_BRANCH='0.6.13'
88
XTL_REPO='https://github.com/xtensor-stack/xtl'
99

10-
XTENSOR_BRANCH='0.21.2'
10+
XTENSOR_BRANCH='0.21.3'
1111
XTENSOR_REPO='https://github.com/xtensor-stack/xtensor'
1212

1313
XTENSOR_PYTHON_BRANCH='0.24.1'

0 commit comments

Comments
 (0)