Skip to content
Merged
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
24 changes: 13 additions & 11 deletions doc/modules/ROOT/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,27 @@ file(GLOB cpp_files "*.cpp")

foreach (cpp ${cpp_files})
get_filename_component(stem ${cpp} NAME_WE)
add_executable(${stem} ${cpp})
target_link_libraries(${stem} PRIVATE Boost::openmethod Boost::unit_test_framework)
add_test(NAME ${stem} COMMAND ${stem})
add_dependencies(tests ${stem})
set(test_target "boost_openmethod-${stem}")
add_executable(${test_target} ${cpp})
target_link_libraries(${test_target} PRIVATE Boost::openmethod Boost::unit_test_framework)
add_test(NAME ${test_target} COMMAND ${test_target})
add_dependencies(tests ${test_target})
endforeach()

function(add_step_by_step dir)
function(boost_openmethod_add_step_by_step dir)
set(add_test "")
if(ARGC GREATER 1)
set(add_test "${ARGV1}")
else()
set(add_test "ON")
endif()

file(GLOB subdirs "${dir}/*")

foreach (subdir ${subdirs})
string(REGEX REPLACE ".*/" "" subex ${subdir})
file(GLOB cpp_files "${subdir}/*.cpp")
set(target "${dir}_${subex}")
set(target "boost_openmethod-${dir}_${subex}")
add_executable(${target} ${cpp_files})
target_link_libraries(${target} PRIVATE Boost::openmethod)
set(output_dir openmethod/${dir}/${subex})
Expand All @@ -53,11 +55,11 @@ function(add_step_by_step dir)
endforeach()
endfunction()

add_step_by_step(rolex)
add_step_by_step(ambiguities OFF)
add_step_by_step(core_api)
add_step_by_step(custom_rtti)
add_step_by_step(virtual_ptr_alt)
boost_openmethod_add_step_by_step(rolex)
boost_openmethod_add_step_by_step(ambiguities OFF)
boost_openmethod_add_step_by_step(core_api)
boost_openmethod_add_step_by_step(custom_rtti)
boost_openmethod_add_step_by_step(virtual_ptr_alt)

if (NOT WIN32)
add_subdirectory(shared_libs)
Expand Down
42 changes: 21 additions & 21 deletions doc/modules/ROOT/examples/shared_libs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,40 @@ add_compile_definitions(BOOST_OPENMETHOD_ENABLE_RUNTIME_CHECKS)
# ------------------------------------------------------------------------------
# static linking

add_library(shared SHARED extensions.cpp)
target_link_libraries(shared Boost::openmethod)
set_target_properties(shared PROPERTIES ENABLE_EXPORTS ON)
add_library(boost_openmethod-shared SHARED extensions.cpp)
target_link_libraries(boost_openmethod-shared Boost::openmethod)
set_target_properties(boost_openmethod-shared PROPERTIES ENABLE_EXPORTS ON)

add_executable(static static_main.cpp)
target_link_libraries(static Boost::openmethod Boost::dll shared)
add_test(NAME static_shared COMMAND static)
add_executable(boost_openmethod-static static_main.cpp)
target_link_libraries(boost_openmethod-static Boost::openmethod Boost::dll boost_openmethod-shared)
add_test(NAME boost_openmethod-static COMMAND boost_openmethod-static)

# ------------------------------------------------------------------------------
# dynamic loading, direct virtual_ptrs

add_executable(dynamic dynamic_main.cpp)
set_target_properties(dynamic PROPERTIES ENABLE_EXPORTS ON)
target_link_libraries(dynamic Boost::openmethod Boost::dll)
add_dependencies(dynamic shared)
add_executable(boost_openmethod-dynamic dynamic_main.cpp)
set_target_properties(boost_openmethod-dynamic PROPERTIES ENABLE_EXPORTS ON)
target_link_libraries(boost_openmethod-dynamic Boost::openmethod Boost::dll)
add_dependencies(boost_openmethod-dynamic boost_openmethod-shared)
if (NOT WIN32)
add_test(NAME dynamic_shared COMMAND dynamic)
add_test(NAME boost_openmethod-dynamic COMMAND boost_openmethod-dynamic)
endif()

# ------------------------------------------------------------------------------
# dynamic loading, indirect virtual_ptrs

add_library(indirect_shared SHARED indirect_extensions.cpp)
add_library(boost_openmethod-indirect_shared SHARED indirect_extensions.cpp)
target_compile_definitions(
indirect_shared PUBLIC BOOST_OPENMETHOD_DEFAULT_REGISTRY=indirect_registry)
target_link_libraries(indirect_shared PRIVATE Boost::openmethod Boost::dll)
set_target_properties(indirect_shared PROPERTIES ENABLE_EXPORTS ON)
boost_openmethod-indirect_shared PUBLIC BOOST_OPENMETHOD_DEFAULT_REGISTRY=indirect_registry)
target_link_libraries(boost_openmethod-indirect_shared PRIVATE Boost::openmethod Boost::dll)
set_target_properties(boost_openmethod-indirect_shared PROPERTIES ENABLE_EXPORTS ON)

add_executable(indirect indirect_main.cpp)
add_executable(boost_openmethod-indirect indirect_main.cpp)
target_compile_definitions(
indirect PUBLIC BOOST_OPENMETHOD_DEFAULT_REGISTRY=indirect_registry)
set_target_properties(indirect PROPERTIES ENABLE_EXPORTS ON)
target_link_libraries(indirect PRIVATE Boost::openmethod Boost::dll)
add_dependencies(indirect indirect_shared)
boost_openmethod-indirect PUBLIC BOOST_OPENMETHOD_DEFAULT_REGISTRY=indirect_registry)
set_target_properties(boost_openmethod-indirect PROPERTIES ENABLE_EXPORTS ON)
target_link_libraries(boost_openmethod-indirect PRIVATE Boost::openmethod Boost::dll)
add_dependencies(boost_openmethod-indirect boost_openmethod-indirect_shared)
if (NOT WIN32)
add_test(NAME indirect_shared COMMAND indirect)
add_test(NAME boost_openmethod-indirect COMMAND boost_openmethod-indirect)
endif()
1 change: 1 addition & 0 deletions include/boost/openmethod/policies/fast_perfect_hash.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ void fast_perfect_hash::fn<Registry>::initialize(
using namespace policies;

const auto N = std::distance(first, last);
(void)opts;

if constexpr (
detail::has_option<trace, Options...> && Registry::has_output) {
Expand Down
30 changes: 16 additions & 14 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,26 @@ file(GLOB test_cpp_files "test_*.cpp")

foreach(test_cpp ${test_cpp_files})
get_filename_component(test ${test_cpp} NAME_WE)
add_executable(${test} EXCLUDE_FROM_ALL ${test_cpp})
target_link_libraries(${test} PRIVATE Boost::openmethod Boost::unit_test_framework)
add_test(NAME ${test} COMMAND ${test})
add_dependencies(tests ${test})
set(test_target "boost_openmethod-${test}")
add_executable(${test_target} EXCLUDE_FROM_ALL ${test_cpp})
target_link_libraries(${test_target} PRIVATE Boost::openmethod Boost::unit_test_framework)
add_test(NAME ${test_target} COMMAND ${test_target})
add_dependencies(tests ${test_target})
endforeach()

add_executable(test_mix_release_debug EXCLUDE_FROM_ALL mix_release_debug/main.cpp mix_release_debug/lib.cpp)
target_link_libraries(test_mix_release_debug PRIVATE Boost::openmethod Boost::unit_test_framework)
add_test(NAME test_mix_release_debug COMMAND test_mix_release_debug)
add_dependencies(tests test_mix_release_debug)
add_executable(boost_openmethod-test_mix_release_debug EXCLUDE_FROM_ALL mix_release_debug/main.cpp mix_release_debug/lib.cpp)
target_link_libraries(boost_openmethod-test_mix_release_debug PRIVATE Boost::openmethod Boost::unit_test_framework)
add_test(NAME boost_openmethod-test_mix_release_debug COMMAND boost_openmethod-test_mix_release_debug)
add_dependencies(tests boost_openmethod-test_mix_release_debug)

function(openmethod_compile_fail_test testname fail_regex)
add_library("compile-fail-${testname}" STATIC EXCLUDE_FROM_ALL "${testname}.cpp")
target_link_libraries("compile-fail-${testname}" PRIVATE Boost::openmethod)
add_test(
NAME "openmethod-${testname}"
COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target "compile-fail-${testname}" --config $<CONFIG>)
set_property(TEST "openmethod-${testname}" PROPERTY PASS_REGULAR_EXPRESSION "${fail_regex}")
set(test_target "boost_openmethod-${testname}")
add_library(${test_target} STATIC EXCLUDE_FROM_ALL "${testname}.cpp")
target_link_libraries(${test_target} PRIVATE Boost::openmethod)
add_test(
NAME "${test_target}"
COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target "${test_target}" --config $<CONFIG>)
set_property(TEST "${test_target}" PROPERTY PASS_REGULAR_EXPRESSION "${fail_regex}")
endfunction()

openmethod_compile_fail_test(
Expand Down
6 changes: 3 additions & 3 deletions test/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ project

<toolset>msvc:<warnings-as-errors>on
<toolset>gcc:<warnings-as-errors>on
<toolset>clang,<os>!NT:<warnings-as-errors>on
# !NT because it causes errors when builting unit-test
<toolset>clang,<target-os>linux:<warnings-as-errors>on
<toolset>clang,<target-os>darwin:<warnings-as-errors>on
;

alias unit_test_framework
: # sources
/boost/test//boost_unit_test_framework
/boost/test//boost_unit_test_framework/<warnings>off
;

for local src in [ glob test_*.cpp ]
Expand Down
Loading