Skip to content

Commit

Permalink
Merge pull request #19 from caps-tum/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
stepanvanecek authored Sep 5, 2023
2 parents f6d2293 + 5530726 commit 411f661
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 38 deletions.
27 changes: 15 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
endif()
endif()

project(sys-sage VERSION 0.4.0 LANGUAGES C CXX )
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}")
project(sys-sage VERSION 0.4.2 LANGUAGES C CXX )
#set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}")

####
#### dependencies
find_package(LibXml2 REQUIRED) # Use pkg-config via the LibXml2 find-module
execute_process(COMMAND xml2-config --cflags OUTPUT_VARIABLE LIBXML_F OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND xml2-config --libs OUTPUT_VARIABLE LIBXML_L OUTPUT_STRIP_TRAILING_WHITESPACE)
include_directories(${LIBXML_F})
link_libraries(${LIBXML_L})

include_directories(${LIBXML2_INCLUDE_DIR})
include_directories(${LIBXML2_INCLUDE_DIRS})
link_libraries(${LIBXML2_LIBRARY})
Expand All @@ -39,18 +38,22 @@ endif()


# Create and install package configuration and version files.
configure_file(${sys-sage_SOURCE_DIR}/pkg/sys-sage-config.cmake.in
${sys-sage_BINARY_DIR}/pkg/sys-sage-config.cmake @ONLY)
configure_file(${sys-sage_SOURCE_DIR}/pkg/sys-sage-config-version.cmake.in
${sys-sage_BINARY_DIR}/pkg/sys-sage-config-version.cmake @ONLY)
include(CMakePackageConfigHelpers)
configure_package_config_file(${sys-sage_SOURCE_DIR}/pkg/sys-sage-config.cmake.in
${sys-sage_BINARY_DIR}/pkg/sys-sage-config.cmake
INSTALL_DESTINATION lib/cmake/sys-sage)
#configure_package_config_file(${sys-sage_SOURCE_DIR}/pkg/sys-sage-config-version.cmake.in
# ${sys-sage_BINARY_DIR}/pkg/sys-sage-config-version.cmake
# INSTALL_DESTINATION lib/cmake/sys-sage)
install(FILES ${sys-sage_BINARY_DIR}/pkg/sys-sage-config.cmake
#${sys-sage_BINARY_DIR}/pkg/sys-sage-config-version.cmake
DESTINATION lib/cmake/sys-sage)

configure_file(${sys-sage_SOURCE_DIR}/pkg/sys-sage.pc.in
${sys-sage_BINARY_DIR}/pkg/sys-sage.pc @ONLY)

install(FILES ${sys-sage_BINARY_DIR}/pkg/sys-sage.pc
DESTINATION lib)
install(FILES ${sys-sage_BINARY_DIR}/pkg/sys-sage-config.cmake
${sys-sage_BINARY_DIR}/pkg/sys-sage-config-version.cmake
DESTINATION lib/cmake/sys-sage)



###Options:
Expand Down
File renamed without changes.
23 changes: 15 additions & 8 deletions pkg/sys-sage-config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# Compute installation prefix relative to this file.
get_filename_component(_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_prefix "${_dir}/.." ABSOLUTE)

# Import the targets.
#include("${_prefix}/lib/sys-sage-targets.cmake")

# Report other information.
set(sys-sage_LIBRARIES "${_prefix}/lib/libsys-sage.so")
set(sys-sage_INCLUDE_DIRS "${_prefix}/inc ")
@PACKAGE_INIT@

include(CMakeFindDependencyMacro)
find_dependency(LibXml2)
#TODO: the conditional options NVIDIA_MIG, DS_HWLOC will have to be set at the user's side (or the libraries present..) -- this should be included automatically if the options are set when building/installing
if(NVIDIA_MIG)
find_dependency(CUDAToolkit 10.0)
endif()
if(DATA_SOURCES OR DS_HWLOC)
find_dependency(HWLOC)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/sys-sage-targets.cmake")

check_required_components(sys-sage)
44 changes: 26 additions & 18 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,35 @@ set(HEADERS

add_library(sys-sage SHARED ${SOURCES} ${HEADERS})

set_target_properties(sys-sage PROPERTIES
# PUBLIC_HEADER "sys-sage.hpp;Topology.hpp;DataPath.hpp;xml_dump.hpp;parsers/hwloc.hpp;parsers/caps-numa-benchmark.hpp;parsers/gpu-topo.hpp"
VERSION ${PROJECT_VERSION}
SOVERSION 1
target_include_directories(sys-sage PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:inc>
$<INSTALL_INTERFACE:lib>
)
install(
TARGETS sys-sage
EXPORT sys-sage-targets
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib/cmake/lib
ARCHIVE DESTINATION lib/cmake/lib
)
#for spack
install(
EXPORT sys-sage-targets
FILE sys-sage-targets.cmake
DESTINATION lib/cmake/sys-sage
NAMESPACE sys-sage::
)

target_include_directories(sys-sage PRIVATE .)

install(DIRECTORY "."
DESTINATION inc
DESTINATION lib/cmake/inc
FILES_MATCHING PATTERN "*.hpp")
install(TARGETS sys-sage
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
# PUBLIC_HEADER DESTINATION inc
ARCHIVE DESTINATION lib)

#for spack
install(
TARGETS sys-sage
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(DIRECTORY "."
DESTINATION lib/cmake/inc
DESTINATION inc
FILES_MATCHING PATTERN "*.hpp")
install(TARGETS sys-sage
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
# PUBLIC_HEADER DESTINATION inc
ARCHIVE DESTINATION lib/cmake/lib)

0 comments on commit 411f661

Please sign in to comment.