Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ builtin_freetype=ON
builtin_ftgl=ON
builtin_gif=ON
builtin_gl2ps=ON
builtin_gsl=ON
builtin_jpeg=ON
builtin_lz4=ON
builtin_lzma=ON
Expand Down
49 changes: 49 additions & 0 deletions builtins/gsl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
set(ROOT_GSL_VERSION 2.8)
message(STATUS "Downloading and building GSL version ${ROOT_GSL_VERSION}")
set(ROOT_GSL_PREFIX ${CMAKE_BINARY_DIR}/builtins/GSL-prefix)
set(ROOT_GSL_LIBRARY ${ROOT_GSL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gsl${CMAKE_STATIC_LIBRARY_SUFFIX})
set(ROOT_GSL_CBLAS_LIBRARY ${ROOT_GSL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gslcblas${CMAKE_STATIC_LIBRARY_SUFFIX})
set(ROOT_GSL_LIBRARIES ${ROOT_GSL_LIBRARY} ${ROOT_GSL_CBLAS_LIBRARY})
if(CMAKE_OSX_SYSROOT)
set(_gsl_cppflags "-isysroot ${CMAKE_OSX_SYSROOT}")
set(_gsl_ldflags "-isysroot ${CMAKE_OSX_SYSROOT}")
endif()
ExternalProject_Add(
BUILTIN_GSL
PREFIX ${ROOT_GSL_PREFIX}
# http://mirror.switch.ch/ftp/mirror/gnu/gsl/gsl-${ROOT_GSL_VERSION}.tar.gz
URL ${lcgpackages}/gsl-${ROOT_GSL_VERSION}.tar.gz
URL_HASH SHA256=6a99eeed15632c6354895b1dd542ed5a855c0f15d9ad1326c6fe2b2c9e423190
SOURCE_DIR GSL-src # prevent "<gsl/...>" vs GSL/ macOS warning
INSTALL_DIR ${ROOT_GSL_PREFIX}
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix <INSTALL_DIR>
--libdir=<INSTALL_DIR>/lib
--enable-shared=no --with-pic
CC=${CMAKE_C_COMPILER}
CFLAGS=${CMAKE_C_FLAGS}
CPPFLAGS=${_gsl_cppflags}
LDFLAGS=${_gsl_ldflags}
LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 LOG_OUTPUT_ON_FAILURE 1
BUILD_BYPRODUCTS ${ROOT_GSL_LIBRARIES}
TIMEOUT 600
)

# FIXME: one need to find better way to extract path with GSL include files
set(ROOT_GSL_INCLUDE_DIR ${ROOT_GSL_PREFIX}/src/BUILTIN_GSL-build)

file(MAKE_DIRECTORY ${ROOT_GSL_INCLUDE_DIR})
add_library(GSL::gsl IMPORTED STATIC GLOBAL)
add_dependencies(GSL::gsl BUILTIN_GSL)
set_target_properties(GSL::gsl PROPERTIES
IMPORTED_LOCATION ${ROOT_GSL_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${ROOT_GSL_INCLUDE_DIR})
add_library(GSL::gslcblas IMPORTED STATIC GLOBAL)
add_dependencies(GSL::gslcblas BUILTIN_GSL)
set_target_properties(GSL::gslcblas PROPERTIES
IMPORTED_LOCATION ${ROOT_GSL_CBLAS_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${ROOT_GSL_INCLUDE_DIR})

set(GSL_INCLUDE_DIRS ${ROOT_GSL_INCLUDE_DIR} PARENT_SCOPE)
set(GSL_FOUND ON PARENT_SCOPE)
set(GSL_VERSION ${ROOT_GSL_VERSION} PARENT_SCOPE)
set(GSL_LIBRARIES ${ROOT_GSL_LIBRARIES} PARENT_SCOPE)
48 changes: 8 additions & 40 deletions cmake/modules/SearchInstalledSoftware.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1229,38 +1229,8 @@ if(mathmore OR builtin_gsl OR (tmva-cpu AND use_gsl_cblas))
endif()
endif()
else()
set(gsl_version 2.8)
message(STATUS "Downloading and building GSL version ${gsl_version}")
foreach(l gsl gslcblas)
list(APPEND GSL_LIBRARIES ${CMAKE_BINARY_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${l}${CMAKE_STATIC_LIBRARY_SUFFIX})
endforeach()
set(GSL_CBLAS_LIBRARY ${CMAKE_BINARY_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gslcblas${CMAKE_STATIC_LIBRARY_SUFFIX})
if(CMAKE_OSX_SYSROOT)
set(_gsl_cppflags "-isysroot ${CMAKE_OSX_SYSROOT}")
set(_gsl_ldflags "-isysroot ${CMAKE_OSX_SYSROOT}")
endif()
ExternalProject_Add(
GSL
# http://mirror.switch.ch/ftp/mirror/gnu/gsl/gsl-${gsl_version}.tar.gz
URL ${lcgpackages}/gsl-${gsl_version}.tar.gz
URL_HASH SHA256=6a99eeed15632c6354895b1dd542ed5a855c0f15d9ad1326c6fe2b2c9e423190
SOURCE_DIR GSL-src # prevent "<gsl/...>" vs GSL/ macOS warning
INSTALL_DIR ${CMAKE_BINARY_DIR}
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix <INSTALL_DIR>
--libdir=<INSTALL_DIR>/lib
--enable-shared=no --with-pic
CC=${CMAKE_C_COMPILER}
CFLAGS=${CMAKE_C_FLAGS}
CPPFLAGS=${_gsl_cppflags}
LDFLAGS=${_gsl_ldflags}
LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 LOG_OUTPUT_ON_FAILURE 1
BUILD_BYPRODUCTS ${GSL_LIBRARIES}
TIMEOUT 600
)
set(GSL_TARGET GSL)
# FIXME: one need to find better way to extract path with GSL include files
set(GSL_INCLUDE_DIR ${CMAKE_BINARY_DIR}/GSL-prefix/src/GSL-build)
set(GSL_FOUND ON)
list(APPEND ROOT_BUILTINS BUILTIN_GSL)
add_subdirectory(builtins/gsl)
set(mathmore ON CACHE BOOL "Enabled because builtin_gsl requested (${mathmore_description})" FORCE)
endif()
endif()
Expand All @@ -1272,16 +1242,14 @@ if(tmva-cpu)
add_library(ROOT::BLAS ALIAS Blas)
if (NOT use_gsl_cblas AND BLAS_FOUND)
target_link_libraries(Blas INTERFACE BLAS::BLAS)
elseif(use_gsl_cblas AND builtin_gsl)
message(STATUS "Using builtin GSL CBLAS for optional parts of TMVA")
add_dependencies(Blas GSL)
target_include_directories(Blas INTERFACE ${GSL_INCLUDE_DIR})
target_link_libraries(Blas INTERFACE ${GSL_CBLAS_LIBRARY})
target_compile_definitions(Blas INTERFACE -DR__USE_CBLAS)
elseif(use_gsl_cblas AND GSL_FOUND)
message(STATUS "Using GSL CBLAS for optional parts of TMVA")
target_link_libraries(Blas INTERFACE GSL::gslcblas)
if (builtin_gsl)
message(STATUS "Using builtin GSL CBLAS for optional parts of TMVA")
else()
message(STATUS "Using system GSL CBLAS for optional parts of TMVA")
endif()
target_compile_definitions(Blas INTERFACE -DR__USE_CBLAS)
target_link_libraries(Blas INTERFACE GSL::gslcblas)
else()
if(fail-on-missing)
message(SEND_ERROR "tmva-cpu can't be built because BLAS was not found!")
Expand Down
5 changes: 1 addition & 4 deletions math/mathmore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,8 @@ SOURCES
Math/LinkDef.h
DEPENDENCIES
MathCore
BUILTINS
GSL
)

target_include_directories(MathMore SYSTEM PRIVATE ${GSL_INCLUDE_DIR})
target_link_libraries(MathMore PRIVATE ${GSL_LIBRARIES})
target_link_libraries(MathMore PRIVATE GSL::gsl GSL::gslcblas)

ROOT_ADD_TEST_SUBDIRECTORY(test)
2 changes: 1 addition & 1 deletion math/mathmore/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ add_definitions(-DHAVE_ROOTLIBS)
#---Build and add all the defined test in the list---------------
foreach(file ${TestMathMoreSource})
get_filename_component(testname ${file} NAME_WE)
ROOT_EXECUTABLE(${testname} ${file} LIBRARIES ${GSL_LIBRARIES} ${Libraries})
ROOT_EXECUTABLE(${testname} ${file} LIBRARIES GSL::gsl GSL::gslcblas ${Libraries})
ROOT_ADD_TEST(mathmore-${testname} COMMAND ${testname} LABELS ${${testname}_LABELS})
endforeach()

Expand Down
5 changes: 1 addition & 4 deletions roofit/roofitmore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,10 @@ ROOT_STANDARD_LIBRARY_PACKAGE(RooFitMore
RIO
MathCore
Foam
BUILTINS
GSL
${EXTRA_DICT_OPTS}
)

target_include_directories(RooFitMore SYSTEM PRIVATE ${GSL_INCLUDE_DIR})
target_link_libraries(RooFitMore PRIVATE ${GSL_LIBRARIES})
target_link_libraries(RooFitMore PRIVATE GSL::gsl GSL::gslcblas)

# For recent clang, this can facilitate auto-vectorisation.
# In RooFit, the errno side effect is not needed, anyway:
Expand Down
Loading