From aa34efb0a8b7758c18c01978440a593abd375bd2 Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Sat, 5 May 2018 21:02:48 +0200 Subject: [PATCH] add nonlocal sc support via cmake. --- CMakeLists.txt | 2 +- src/classes/CMakeLists.txt | 4 ++ src/external/CMakeLists.txt | 4 +- src/external/Nonlocal/CMakeLists.txt | 62 +++++++++++++++++++ src/external/Nonlocal/PNL_PippardFitter.pc.in | 10 +++ 5 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 src/external/Nonlocal/CMakeLists.txt create mode 100644 src/external/Nonlocal/PNL_PippardFitter.pc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 154ea52e..fbbc33aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,7 +111,7 @@ message(" BOOST found in ${Boost_INCLUDE_DIRS}") message(" LibXML2 found in ${LIBXML2_INCLUDE_DIR}") message(" ROOT found in ${ROOT_INCLUDE_DIRS}") if (OpenMP_FOUND) - message(" OpenMP found (version ${OpenMP_VERSION})") + message(" OpenMP found (version ${OpenMP_CXX_VERSION})") endif (OpenMP_FOUND) if (nexus) diff --git a/src/classes/CMakeLists.txt b/src/classes/CMakeLists.txt index 619d9864..e87ddab4 100644 --- a/src/classes/CMakeLists.txt +++ b/src/classes/CMakeLists.txt @@ -93,6 +93,10 @@ add_library(PUserFcnBase SHARED target_include_directories( PUserFcnBase BEFORE PRIVATE $ ) +#--- add OpenMP compile options if needed ------------------------------------- +if (OpenMP_FOUND) + target_compile_options(PMusr PUBLIC ${OpenMP_CXX_FLAGS}) +endif (OpenMP_FOUND) #--- add library dependencies ------------------------------------------------- set(DependOnLibs ${ROOT_LIBARIES}) diff --git a/src/external/CMakeLists.txt b/src/external/CMakeLists.txt index c2e7379b..609d3607 100644 --- a/src/external/CMakeLists.txt +++ b/src/external/CMakeLists.txt @@ -1,11 +1,13 @@ -#[==[ if (ASlibs) add_subdirectory(Nonlocal) +#[==[ add_subdirectory(MagProximity) add_subdirectory(libPhotoMeissner) add_subdirectory(libSpinValve) +#]==] endif (ASlibs) +#[==[ if (BMWlibs) add_subdirectory(libCuba) add_subdirectory(BMWtools) diff --git a/src/external/Nonlocal/CMakeLists.txt b/src/external/Nonlocal/CMakeLists.txt new file mode 100644 index 00000000..19e67c3d --- /dev/null +++ b/src/external/Nonlocal/CMakeLists.txt @@ -0,0 +1,62 @@ +# - Nonlocal library ---------------------------------------------------------- + +#--- generate necessary dictionaries ------------------------------------------ +root_generate_dictionary( + PNL_PippardFitterDict PNL_PippardFitter.h LINKDEF PNL_PippardFitterLinkDef.h +) +root_generate_dictionary( + PNL_StartupHandlerDict PNL_StartupHandler.h LINKDEF PNL_StartupHandlerLinkDef.h +) + +#--- create pkg-config info --------------------------------------------------- +set(prefix "${CMAKE_INSTALL_PREFIX}") +set(exec_prefix "\$\{prefix\}") +set(libdir "\$\{exec_prefix\}/lib") +set(includedir "\$\{prefix\}/include") +set(PNL_PIPPARDFITTER_VERSION "1.0.0") +set(PNL_PIPPARDFITTER_LIBRARY_NAME "PNL_PippardFitter") +configure_file("PNL_PippardFitter.pc.in" "PNL_PippardFitter.pc" @ONLY) + +#--- lib creation ------------------------------------------------------------- +add_library(PNL_PippardFitter SHARED + PNL_PippardFitter.cpp + PNL_PippardFitterDict.cxx + PNL_RgeHandler.cpp + PNL_StartupHandler.cpp + PNL_StartupHandlerDict.cxx +) +#--- make sure that the include directory is found ---------------------------- +target_include_directories( + PNL_PippardFitter BEFORE PRIVATE $ +) + +#--- add library dependencies ------------------------------------------------- +target_link_libraries(PNL_PippardFitter PUserFcnBase ${FFTW3_LIBRARIES} ${ROOT_LIBRARIES}) + +#--- install TMusrRunHeader solib --------------------------------------------- +install(TARGETS PNL_PippardFitter DESTINATION lib) + +#--- install root pcm's and rootmaps ------------------------------------------ +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/libPNL_PippardFitterDict_rdict.pcm + ${CMAKE_CURRENT_BINARY_DIR}/libPNL_PippardFitterDict.rootmap + ${CMAKE_CURRENT_BINARY_DIR}/libPNL_StartupHandlerDict_rdict.pcm + ${CMAKE_CURRENT_BINARY_DIR}/libPNL_StartupHandlerDict.rootmap + DESTINATION lib +) + +#--- install TMusrRunHeader header -------------------------------------------- +install( + FILES + PNL_PippardFitter.h + PNL_RgeHandler.h + PNL_StartupHandler.h + DESTINATION + include +) + +#--- install pkg-config info -------------------------------------------------- +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/PNL_PippardFitter.pc + DESTINATION lib/pkgconfig +) diff --git a/src/external/Nonlocal/PNL_PippardFitter.pc.in b/src/external/Nonlocal/PNL_PippardFitter.pc.in new file mode 100644 index 00000000..2ff098d4 --- /dev/null +++ b/src/external/Nonlocal/PNL_PippardFitter.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: PNL_PippardFitter +Description: C++ shared library providing the nonlocal sc fitter class +Version: @PNL_PIPPARDFITTER_VERSION@ +Libs: -L${libdir} -l@PNL_PIPPARDFITTER_LIBRARY_NAME@ +Cflags: -I${includedir}