67 lines
3.1 KiB
CMake
67 lines
3.1 KiB
CMake
project(librexy)
|
|
cmake_minimum_required(VERSION 3.0.2)
|
|
include(GNUInstallDirs)
|
|
|
|
set(librexy_VERSION_STRING "000010000L")
|
|
set(librexy_VERSION_MAJOR 0)
|
|
set(librexy_VERSION_MINOR 1)
|
|
set(librexy_VERSION_REVISION 0)
|
|
set(INCLUDE_PATH ${CMAKE_SOURCE_DIR}/include)
|
|
include_directories(BEFORE SYSTEM "${INCLUDE_PATH}")
|
|
|
|
|
|
option(ENABLE_SHARED "Build shared library" ON)
|
|
option(ENABLE_PROFILING "Enable asan" OFF)
|
|
option(BUILD_TESTS "Enable testing" OFF)
|
|
mark_as_advanced(ENABLE_PROFILING)
|
|
|
|
set(SOURCE_LIST "src/filerd.cpp" "src/string.cpp" "src/binary.cpp" "src/static_string.cpp" "src/threadpool.cpp")
|
|
add_library(ensure OBJECT "src/ensure.cpp")
|
|
target_compile_options(ensure PRIVATE -Wall -Wextra -pedantic -std=c++17)
|
|
if(ENABLE_SHARED)
|
|
add_library(rexy SHARED ${SOURCE_LIST})
|
|
set_target_properties(rexy PROPERTIES SOVERSION "${librexy_VERSION_MAJOR}.${librexy_VERSION_MINOR}")
|
|
set(LIBREXY_LIBFLAGS "-lrexy")
|
|
target_link_libraries(rexy "-lpthread")
|
|
else()
|
|
add_library(rexy STATIC ${SOURCE_LIST})
|
|
set(LIBREXY_LIBFLAGS "-lrexy -lpthread")
|
|
target_link_libraries(rexy "-lpthread")
|
|
endif()
|
|
set_target_properties(rexy PROPERTIES VERSION "${librexy_VERSION_MAJOR}.${librexy_VERSION_MINOR}.${librexy_VERSION_REVISION}")
|
|
|
|
if(ENABLE_PROFILING)
|
|
target_compile_options(rexy PRIVATE -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls)
|
|
target_link_options(rexy PRIVATE -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls)
|
|
endif()
|
|
if(BUILD_TESTS)
|
|
enable_testing()
|
|
add_subdirectory(tests)
|
|
endif()
|
|
|
|
set(LIBREXY_PUBLIC_HEADERS "include/rexy/rexy.hpp" "include/rexy/algorithm.hpp" "include/rexy/utility.hpp" "include/rexy/basic_string_hash.hpp" "include/rexy/hash.hpp" "include/rexy/static_string_hash.hpp" "include/rexy/string_hash.hpp" "include/rexy/mpmc_queue.hpp" "include/rexy/mpmc_queue.tpp" "include/rexy/traits.hpp" "include/rexy/steal.hpp" "include/rexy/binary.hpp" "include/rexy/expression.hpp" "include/rexy/binary_base.hpp" "include/rexy/binary_base.tpp" "include/rexy/string_base.hpp" "include/rexy/string.hpp" "include/rexy/filerd.hpp" "include/rexy/string_base.tpp" "include/rexy/allocator.hpp" "include/rexy/meta.hpp" "include/rexy/buffer.hpp" "include/rexy/buffer.tpp")
|
|
target_compile_options(rexy PRIVATE -Wall -Wextra -pedantic -std=c++17)
|
|
|
|
install(TARGETS rexy
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
)
|
|
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/pc/librexy.pc"
|
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
|
|
)
|
|
install(FILES ${LIBREXY_PUBLIC_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/rexy/")
|
|
install(DIRECTORY "include/rexy/detail" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/rexy" FILES_MATCHING PATTERN "*.hpp" PATTERN "*.tpp")
|
|
install(DIRECTORY "include/rexy/cx" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/rexy" FILES_MATCHING PATTERN "*.hpp" PATTERN "*.tpp")
|
|
|
|
configure_file(
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/pc/librexy.pc.cmake.in"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/pc/librexy.pc"
|
|
@ONLY
|
|
)
|
|
configure_file(
|
|
"${INCLUDE_PATH}/rexy/rexy.hpp.in"
|
|
"${INCLUDE_PATH}/rexy/rexy.hpp"
|
|
)
|
|
|
|
add_custom_target(uninstall cat install_manifest.txt | xargs rm)
|