refcnt: build + install fixes
This commit is contained in:
parent
87b4bfa795
commit
b6723b921b
5 changed files with 80 additions and 30 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
project(xo-refcnt VERSION 0.1)
|
project(refcnt VERSION 0.1)
|
||||||
enable_language(CXX)
|
enable_language(CXX)
|
||||||
|
|
||||||
include(cmake/cxx.cmake)
|
include(cmake/cxx.cmake)
|
||||||
|
|
@ -13,7 +13,6 @@ include(cmake/code-coverage.cmake)
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
|
|
||||||
# activate code coverage for all executables + libraries (when configured with -DCODE_COVERAGE=ON)
|
# activate code coverage for all executables + libraries (when configured with -DCODE_COVERAGE=ON)
|
||||||
add_code_coverage()
|
add_code_coverage()
|
||||||
# 1. assuming that /nix/store/ prefixes .hpp files belonging to gcc, catch2 etc.
|
# 1. assuming that /nix/store/ prefixes .hpp files belonging to gcc, catch2 etc.
|
||||||
|
|
@ -26,6 +25,7 @@ add_code_coverage_all_targets(EXCLUDE /nix/store/* utest/*)
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
# c++ settings
|
# c++ settings
|
||||||
|
|
||||||
|
set(XO_PROJECT_NAME refcnt)
|
||||||
set(PROJECT_CXX_FLAGS "-fconcepts-diagnostics-depth=2")
|
set(PROJECT_CXX_FLAGS "-fconcepts-diagnostics-depth=2")
|
||||||
|
|
||||||
add_definitions(${PROJECT_CXX_FLAGS})
|
add_definitions(${PROJECT_CXX_FLAGS})
|
||||||
|
|
@ -43,6 +43,42 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "")
|
||||||
# sources
|
# sources
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
add_subdirectory(utest)
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
# cmake export
|
||||||
|
|
||||||
|
set(XO_PROJECT_CONFIG_VERSION "${XO_PROJECT_NAME}ConfigVersion.cmake")
|
||||||
|
set(XO_PROJECT_CONFIG "${XO_PROJECT_NAME}Config.cmake")
|
||||||
|
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
write_basic_package_version_file("${PROJECT_BINARY_DIR}/${XO_PROJECT_CONFIG_VERSION}"
|
||||||
|
VERSION 0.1
|
||||||
|
COMPATIBILITY AnyNewerVersion
|
||||||
|
)
|
||||||
|
|
||||||
|
#install(
|
||||||
|
# TARGETS ${XO_PROJECT_NAME}
|
||||||
|
# EXPORT ${XO_PROJECT_NAME}Targets
|
||||||
|
# LIBRARY DESTINATION lib COMPONENT Runtime
|
||||||
|
# ARCHIVE DESTINATION lib COMPONENT Development
|
||||||
|
# RUNTIME DESTINATION bin COMPONENT Runtime
|
||||||
|
# PUBLIC_HEADER DESTINATION include COMPONENT Development
|
||||||
|
# BUNDLE DESTINATION bin COMPONENT Runtime
|
||||||
|
# )
|
||||||
|
|
||||||
|
configure_package_config_file(
|
||||||
|
"${PROJECT_SOURCE_DIR}/cmake/${XO_PROJECT_NAME}Config.cmake.in"
|
||||||
|
"${PROJECT_BINARY_DIR}/${XO_PROJECT_CONFIG}"
|
||||||
|
INSTALL_DESTINATION lib/cmake/${XO_PROJECT_NAME}
|
||||||
|
)
|
||||||
|
|
||||||
|
install(EXPORT ${XO_PROJECT_NAME}Targets DESTINATION lib/cmake/${XO_PROJECT_NAME})
|
||||||
|
install(
|
||||||
|
FILES
|
||||||
|
"${PROJECT_BINARY_DIR}/${XO_PROJECT_CONFIG_VERSION}"
|
||||||
|
"${PROJECT_BINARY_DIR}/${XO_PROJECT_CONFIG}"
|
||||||
|
DESTINATION lib/cmake/${XO_PROJECT_NAME})
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
# install .hpp
|
# install .hpp
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,11 @@ macro(xo_include_options target)
|
||||||
#
|
#
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
${target} PUBLIC
|
${target} PUBLIC
|
||||||
${PROJECT_SOURCE_DIR}/include # e.g. for #include "indentlog/scope.hpp"
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> # e.g. for #include "indentlog/scope.hpp"
|
||||||
${PROJECT_SOURCE_DIR}/include/${target} # e.g. for #include "Refcounted.hpp" in refcnt/src
|
$<INSTALL_INTERFACE:include>
|
||||||
${PROJECT_BINARY_DIR} # e.g. for generated config.hpp file
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/${target}> # e.g. for #include "Refcounted.hpp" in refcnt/src
|
||||||
|
$<INSTALL_INTERFACE:include/${target}>
|
||||||
|
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}> # e.g. for generated config.hpp file
|
||||||
)
|
)
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
|
|
@ -72,7 +74,15 @@ endmacro()
|
||||||
# use this for a subdir that builds a library
|
# use this for a subdir that builds a library
|
||||||
#
|
#
|
||||||
macro(xo_install_library target)
|
macro(xo_install_library target)
|
||||||
install(TARGETS ${target} DESTINATION lib)
|
install(
|
||||||
|
TARGETS ${target}
|
||||||
|
EXPORT ${target}Targets
|
||||||
|
LIBRARY DESTINATION lib COMPONENT Runtime
|
||||||
|
ARCHIVE DESTINATION lib COMPONENT Development
|
||||||
|
RUNTIME DESTINATION bin COMPONENT Runtime
|
||||||
|
PUBLIC_HEADER DESTINATION include COMPONENT Development
|
||||||
|
BUNDLE DESTINATION bin COMPONENT Runtime
|
||||||
|
)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
|
|
|
||||||
4
cmake/refcntConfig.cmake.in
Normal file
4
cmake/refcntConfig.cmake.in
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/@XO_PROJECT_NAME@Targets.cmake")
|
||||||
|
check_required_components("@PROJECT_NAME@")
|
||||||
|
|
@ -171,31 +171,31 @@ namespace xo {
|
||||||
return 0;
|
return 0;
|
||||||
} /*intrusive_ptr_refcount*/
|
} /*intrusive_ptr_refcount*/
|
||||||
|
|
||||||
void intrusive_ptr_set_debug(bool x);
|
extern void intrusive_ptr_set_debug(bool x);
|
||||||
void intrusive_ptr_log_ctor(std::string_view const & self_type,
|
extern void intrusive_ptr_log_ctor(std::string_view const & self_type,
|
||||||
void * this_ptr,
|
void * this_ptr,
|
||||||
Refcount * x);
|
Refcount * x);
|
||||||
/* here actor short for 'aliasing ctor' */
|
/* here actor short for 'aliasing ctor' */
|
||||||
void intrusive_ptr_log_actor(std::string_view const & self_type,
|
extern void intrusive_ptr_log_actor(std::string_view const & self_type,
|
||||||
void * this_ptr,
|
void * this_ptr,
|
||||||
Refcount * x);
|
Refcount * x);
|
||||||
void intrusive_ptr_log_cctor(std::string_view const & self_type,
|
extern void intrusive_ptr_log_cctor(std::string_view const & self_type,
|
||||||
void * this_ptr,
|
void * this_ptr,
|
||||||
Refcount * x);
|
Refcount * x);
|
||||||
void intrusive_ptr_log_mctor(std::string_view const & self_type,
|
extern void intrusive_ptr_log_mctor(std::string_view const & self_type,
|
||||||
void *this_ptr,
|
void *this_ptr,
|
||||||
Refcount * x);
|
Refcount * x);
|
||||||
void intrusive_ptr_log_dtor(std::string_view const & self_type,
|
extern void intrusive_ptr_log_dtor(std::string_view const & self_type,
|
||||||
void * this_ptr,
|
void * this_ptr,
|
||||||
Refcount * x);
|
Refcount * x);
|
||||||
void intrusive_ptr_log_assign(std::string_view const & self_type,
|
extern void intrusive_ptr_log_assign(std::string_view const & self_type,
|
||||||
void * this_ptr,
|
void * this_ptr,
|
||||||
Refcount * x);
|
Refcount * x);
|
||||||
void intrusive_ptr_log_massign(std::string_view const & self_type,
|
extern void intrusive_ptr_log_massign(std::string_view const & self_type,
|
||||||
void *this_ptr,
|
void *this_ptr,
|
||||||
Refcount * x);
|
Refcount * x);
|
||||||
void intrusive_ptr_add_ref(Refcount * x);
|
extern void intrusive_ptr_add_ref(Refcount * x);
|
||||||
void intrusive_ptr_release(Refcount * x);
|
extern void intrusive_ptr_release(Refcount * x);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline std::ostream &
|
inline std::ostream &
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ namespace xo {
|
||||||
} /*intrusive_ptr_log_aux*/
|
} /*intrusive_ptr_log_aux*/
|
||||||
} /*namespace*/
|
} /*namespace*/
|
||||||
|
|
||||||
bool
|
void
|
||||||
intrusive_ptr_set_debug(bool debug_flag) {
|
intrusive_ptr_set_debug(bool debug_flag) {
|
||||||
s_logging_enabled = debug_flag;
|
s_logging_enabled = debug_flag;
|
||||||
} /*intrusive_ptr_set_debug*/
|
} /*intrusive_ptr_set_debug*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue