diff --git a/.github/workflows/windows_debug.yml b/.github/workflows/windows_debug.yml index aee080eceb82..04c9ab88e75e 100644 --- a/.github/workflows/windows_debug.yml +++ b/.github/workflows/windows_debug.yml @@ -29,9 +29,33 @@ jobs: run: | cmake --build build --config Debug \ --target ALL_BUILD \ - cmake_build_dir_targets_test.make_compile \ - cmake_build_dir_macros_test.make_compile \ + cmake_debug_build_dir_targets_test \ + cmake_minsizerel_build_dir_targets_test \ + cmake_release_build_dir_targets_test \ + cmake_relwithdebinfo_build_dir_targets_test \ + cmake_debug_build_dir_macros_test \ + cmake_minsizerel_build_dir_macros_test \ + cmake_release_build_dir_macros_test \ + cmake_relwithdebinfo_build_dir_macros_test \ -- -maxcpucount -verbosity:minimal -nologo + - name: Install + shell: bash + run: | + cmake --install build + - name: Build External + shell: bash + run: | + cmake --build build --config Release \ + --target \ + cmake_debug_install_dir_targets_test \ + cmake_minsizerel_install_dir_targets_test \ + cmake_release_install_dir_targets_test \ + cmake_relwithdebinfo_install_dir_targets_test \ + cmake_debug_install_dir_macros_test \ + cmake_minsizerel_install_dir_macros_test \ + cmake_release_install_dir_macros_test \ + cmake_relwithdebinfo_install_dir_macros_test \ + -- -maxcpucount -verbosity:minimal -nologo - name: Test shell: bash run: | diff --git a/.github/workflows/windows_release.yml b/.github/workflows/windows_release.yml index 5c91392a748f..07ea5ce01d45 100644 --- a/.github/workflows/windows_release.yml +++ b/.github/workflows/windows_release.yml @@ -29,8 +29,14 @@ jobs: run: | cmake --build build --config Release \ --target ALL_BUILD \ - cmake_build_dir_targets_test.make_compile \ - cmake_build_dir_macros_test.make_compile \ + cmake_debug_build_dir_targets_test \ + cmake_minsizerel_build_dir_targets_test \ + cmake_release_build_dir_targets_test \ + cmake_relwithdebinfo_build_dir_targets_test \ + cmake_debug_build_dir_macros_test \ + cmake_minsizerel_build_dir_macros_test \ + cmake_release_build_dir_macros_test \ + cmake_relwithdebinfo_build_dir_macros_test \ -- -maxcpucount -verbosity:minimal -nologo - name: Install shell: bash @@ -40,8 +46,15 @@ jobs: shell: bash run: | cmake --build build --config Release \ - --target cmake_install_dir_targets_test.make_compile \ - cmake_install_dir_macros_test.make_compile \ + --target \ + cmake_debug_install_dir_targets_test \ + cmake_minsizerel_install_dir_targets_test \ + cmake_release_install_dir_targets_test \ + cmake_relwithdebinfo_install_dir_targets_test \ + cmake_debug_install_dir_macros_test \ + cmake_minsizerel_install_dir_macros_test \ + cmake_release_install_dir_macros_test \ + cmake_relwithdebinfo_install_dir_macros_test \ -- -maxcpucount -verbosity:minimal -nologo - name: Test shell: bash diff --git a/CMakeLists.txt b/CMakeLists.txt index f527c22d27be..b4accbb28b68 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1720,23 +1720,6 @@ hpx_option( ADVANCED ) -# ############################################################################## -# Add necessary compiler flags. Flags added here include flags to disable/enable -# certain warnings, enabling C++11 mode and disabling asserts. Setting of -# optimization flags is not handled here and is left to the responsibility of -# the user to avoid conflicts in the resulting binaries - -hpx_add_target_compile_definition(_DEBUG PUBLIC CONFIGURATIONS Debug) -hpx_add_target_compile_definition(DEBUG PUBLIC CONFIGURATIONS Debug) -hpx_add_target_compile_definition( - HPX_DISABLE_ASSERTS PUBLIC CONFIGURATIONS Release RelWithDebInfo - MinSizeRelease -) -hpx_add_target_compile_definition( - BOOST_DISABLE_ASSERTS PUBLIC CONFIGURATIONS Release RelWithDebInfo - MinSizeRelease -) - # ############################################################################## # C++ feature tests # ############################################################################## @@ -1843,7 +1826,7 @@ if(WIN32) # non-referenced functions and data (-Zc:inline) hpx_add_target_compile_option(-Zc:inline PUBLIC) hpx_add_target_compile_option( - -Gw PUBLIC CONFIGURATIONS Release RelWithDebInfo MinSizeRelease + -Gw PUBLIC CONFIGURATIONS Release RelWithDebInfo MinSizeRel ) hpx_add_target_compile_option(-Zo PUBLIC CONFIGURATIONS RelWithDebInfo) if(HPX_WITH_DATAPAR_VC) diff --git a/cmake/HPX_AddModule.cmake b/cmake/HPX_AddModule.cmake index 1845329abb91..67b9012f469b 100644 --- a/cmake/HPX_AddModule.cmake +++ b/cmake/HPX_AddModule.cmake @@ -301,9 +301,7 @@ function(add_hpx_module libname modulename) endif() target_compile_definitions( - hpx_${modulename} - PRIVATE $<$:DEBUG> $<$:_DEBUG> - HPX_${libname_upper}_EXPORTS + hpx_${modulename} PRIVATE HPX_${libname_upper}_EXPORTS ) # This is a temporary solution until all of HPX has been modularized as it diff --git a/cmake/HPX_CompilerFlagsTargets.cmake b/cmake/HPX_CompilerFlagsTargets.cmake index fa7abb568a2e..d790ce88573f 100644 --- a/cmake/HPX_CompilerFlagsTargets.cmake +++ b/cmake/HPX_CompilerFlagsTargets.cmake @@ -21,6 +21,13 @@ target_compile_definitions( hpx_public_flags INTERFACE $<$:HPX_DEBUG> ) +target_compile_definitions( + hpx_private_flags + INTERFACE $<$:NDEBUG> + INTERFACE $<$:NDEBUG> + INTERFACE $<$:NDEBUG> +) + # Remaining flags are set through the macros in cmake/HPX_AddCompileFlag.cmake include(HPX_ExportTargets) diff --git a/cmake/templates/HPXConfig.cmake.in b/cmake/templates/HPXConfig.cmake.in index a1a0ec3efe7d..1f2b9c8c2eb9 100644 --- a/cmake/templates/HPXConfig.cmake.in +++ b/cmake/templates/HPXConfig.cmake.in @@ -98,7 +98,6 @@ if(NOT HPX_CMAKE_LOGLEVEL) set(HPX_CMAKE_LOGLEVEL "WARN") endif() -hpx_check_cmake_build_type() hpx_check_compiler_compatibility() hpx_check_boost_compatibility() hpx_check_allocator_compatibility() diff --git a/cmake/templates/HPXMacros.cmake.in b/cmake/templates/HPXMacros.cmake.in index a881ccc06526..3315902d6e58 100644 --- a/cmake/templates/HPXMacros.cmake.in +++ b/cmake/templates/HPXMacros.cmake.in @@ -95,25 +95,3 @@ function(hpx_check_allocator_compatibility) "informational purposes to dependent projects and should not be changed.") endif() endfunction() - -# Check we are using the same build type as HPX -function(hpx_check_cmake_build_type) - get_property(_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) - if (NOT _GENERATOR_IS_MULTI_CONFIG AND - NOT "${HPX_BUILD_TYPE}" STREQUAL "${CMAKE_BUILD_TYPE}" AND - ("${HPX_BUILD_TYPE}" STREQUAL "Debug" OR "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")) - if(HPX_IGNORE_CMAKE_BUILD_TYPE_COMPATIBILITY) - hpx_warn("CMAKE_BUILD_TYPE does not match ${HPX_BUILD_TYPE}: " - "this project uses '${CMAKE_BUILD_TYPE}', HPX uses '${HPX_BUILD_TYPE}'. " - "HPX is not ABI compatible between release and debug modes and it is " - "recommended that you use the same build type for HPX and your project.") - else() - hpx_error("CMAKE_BUILD_TYPE does not match ${HPX_BUILD_TYPE}: " - "this project uses '${CMAKE_BUILD_TYPE}', HPX uses '${HPX_BUILD_TYPE}'. " - "Please add -DCMAKE_BUILD_TYPE=${HPX_BUILD_TYPE} to your cmake command " - "or add -DHPX_IGNORE_CMAKE_BUILD_TYPE_COMPATIBILITY=ON to ignore this " - "check (not recommended; HPX is not ABI compatible between release and " - "debug modes).") - endif() - endif() -endfunction() diff --git a/examples/hello_world_component/CMakeLists.txt b/examples/hello_world_component/CMakeLists.txt index 54bfd8a50823..b5373c04cb23 100644 --- a/examples/hello_world_component/CMakeLists.txt +++ b/examples/hello_world_component/CMakeLists.txt @@ -15,7 +15,6 @@ if(EXISTS "${HPX_DIR}") add_executable(hello_world_client hello_world_client.cpp) target_include_directories(hello_world_client PRIVATE ${test_SOURCE_DIR}) - target_include_directories(hello_world_client PRIVATE HPX_DEBUG) if("${SETUP_TYPE}" STREQUAL "TARGETS") target_link_libraries( @@ -36,9 +35,6 @@ if(EXISTS "${HPX_DIR}") target_include_directories( hello_world_client_only_hpx_init PRIVATE ${test_SOURCE_DIR} ) - target_include_directories( - hello_world_client_only_hpx_init PRIVATE HPX_DEBUG - ) target_link_libraries( hello_world_client_only_hpx_init PRIVATE hello_world_component diff --git a/hpx/runtime/components/server/component_base.hpp b/hpx/runtime/components/server/component_base.hpp index c995e8f5625c..82e57eb3c060 100644 --- a/hpx/runtime/components/server/component_base.hpp +++ b/hpx/runtime/components/server/component_base.hpp @@ -77,14 +77,6 @@ namespace hpx { namespace components HPX_EXPORT naming::id_type get_unmanaged_id( naming::gid_type const& gid) const; -#if defined(HPX_DISABLE_ASSERTS) || defined(BOOST_DISABLE_ASSERTS) || defined(NDEBUG) - static constexpr void mark_as_migrated() - { - } - static constexpr void on_migrated() - { - } -#else static void mark_as_migrated() { // If this assertion is triggered then this component instance is @@ -100,7 +92,6 @@ namespace hpx { namespace components // migration. HPX_ASSERT(false); } -#endif protected: // Create a new GID (if called for the first time), assign this diff --git a/hpx/runtime/components/server/fixed_component_base.hpp b/hpx/runtime/components/server/fixed_component_base.hpp index 936688c4442a..8cd9ce928cdc 100644 --- a/hpx/runtime/components/server/fixed_component_base.hpp +++ b/hpx/runtime/components/server/fixed_component_base.hpp @@ -156,14 +156,6 @@ class fixed_component_base : public traits::detail::fixed_component_tag } } -#if defined(HPX_DISABLE_ASSERTS) || defined(BOOST_DISABLE_ASSERTS) || defined(NDEBUG) - static constexpr void mark_as_migrated() - { - } - static constexpr void on_migrated() - { - } -#else void mark_as_migrated() { // If this assertion is triggered then this component instance is being @@ -179,7 +171,6 @@ class fixed_component_base : public traits::detail::fixed_component_tag // migration. HPX_ASSERT(false); } -#endif private: mutable naming::gid_type gid_; @@ -192,15 +183,6 @@ namespace detail /////////////////////////////////////////////////////////////////////// struct fixed_heap { -#if defined(HPX_DISABLE_ASSERTS) || defined(BOOST_DISABLE_ASSERTS) || defined(NDEBUG) - static constexpr void* alloc(std::size_t /*count*/) - { - return nullptr; - } - static constexpr void free(void* /*p*/, std::size_t /*count*/) - { - } -#else static void* alloc(std::size_t /*count*/) { HPX_ASSERT(false); // this shouldn't ever be called @@ -210,7 +192,6 @@ namespace detail { HPX_ASSERT(false); // this shouldn't ever be called } -#endif }; } @@ -224,17 +205,6 @@ class fixed_component : public Component typedef component_type derived_type; typedef detail::fixed_heap heap_type; -#if defined(HPX_DISABLE_ASSERTS) || defined(BOOST_DISABLE_ASSERTS) || defined(NDEBUG) - static constexpr Component* create(std::size_t /* count */) - { - return nullptr; - } - - static constexpr void destroy( - Component* /* p */, std::size_t /* count */ = 1) - { - } -#else /// \brief The function \a create is used for allocation and /// initialization of instances of the derived components. static Component* create(std::size_t /* count */) @@ -249,9 +219,6 @@ class fixed_component : public Component { HPX_ASSERT(false); // this shouldn't ever be called } -#endif }; }} - - diff --git a/hpx/runtime/components/server/managed_component_base.hpp b/hpx/runtime/components/server/managed_component_base.hpp index ea90f8584464..7cf34a44e80d 100644 --- a/hpx/runtime/components/server/managed_component_base.hpp +++ b/hpx/runtime/components/server/managed_component_base.hpp @@ -171,14 +171,6 @@ namespace hpx { namespace components /// destructed static constexpr void finalize() {} -#if defined(HPX_DISABLE_ASSERTS) || defined(BOOST_DISABLE_ASSERTS) || defined(NDEBUG) - static constexpr void mark_as_migrated() - { - } - static constexpr void on_migrated() - { - } -#else static void mark_as_migrated() { // If this assertion is triggered then this component instance is @@ -194,7 +186,6 @@ namespace hpx { namespace components // migration. HPX_ASSERT(false); } -#endif }; } diff --git a/libs/core/config/include/hpx/config/debug.hpp b/libs/core/config/include/hpx/config/debug.hpp index 73237faf53e7..61fadc5cf983 100644 --- a/libs/core/config/include/hpx/config/debug.hpp +++ b/libs/core/config/include/hpx/config/debug.hpp @@ -14,20 +14,9 @@ #define HPX_BUILD_TYPE #else -// clang-format off -// Make sure DEBUG macro is defined consistently across platforms -#if defined(_DEBUG) && !defined(DEBUG) -# define DEBUG -#endif - -#if defined(DEBUG) && !defined(HPX_DEBUG) -# define HPX_DEBUG -#endif - #if defined(HPX_DEBUG) -# define HPX_BUILD_TYPE debug +#define HPX_BUILD_TYPE debug #else -# define HPX_BUILD_TYPE release +#define HPX_BUILD_TYPE release #endif #endif -// clang-format on diff --git a/libs/core/functional/include/hpx/functional/one_shot.hpp b/libs/core/functional/include/hpx/functional/one_shot.hpp index 9e450a144a1a..0989da4e68e2 100644 --- a/libs/core/functional/include/hpx/functional/one_shot.hpp +++ b/libs/core/functional/include/hpx/functional/one_shot.hpp @@ -25,10 +25,11 @@ namespace hpx { namespace util { class one_shot_wrapper //-V690 { public: -#if !defined(HPX_DISABLE_ASSERTS) // default constructor is needed for serialization constexpr one_shot_wrapper() +#if defined(HPX_DEBUG) : _called(false) +#endif { } @@ -37,42 +38,30 @@ namespace hpx { namespace util { std::is_constructible::value>::type> constexpr explicit one_shot_wrapper(F_&& f) : _f(std::forward(f)) +#if defined(HPX_DEBUG) , _called(false) +#endif { } constexpr one_shot_wrapper(one_shot_wrapper&& other) : _f(std::move(other._f)) +#if defined(HPX_DEBUG) , _called(other._called) +#endif { +#if defined(HPX_DEBUG) other._called = true; +#endif } void check_call() { +#if defined(HPX_DEBUG) HPX_ASSERT(!_called); - _called = true; - } -#else - // default constructor is needed for serialization - constexpr one_shot_wrapper() {} - - template ::value>::type> - constexpr explicit one_shot_wrapper(F_&& f) - : _f(std::forward(f)) - { - } - - constexpr one_shot_wrapper(one_shot_wrapper&& other) - : _f(std::move(other._f)) - { - } - - void check_call() {} #endif + } template constexpr HPX_HOST_DEVICE @@ -118,7 +107,7 @@ namespace hpx { namespace util { public: // exposition-only F _f; -#if !defined(HPX_DISABLE_ASSERTS) +#if defined(HPX_DEBUG) bool _called; #endif }; diff --git a/libs/core/preprocessor/include/hpx/preprocessor/config.hpp b/libs/core/preprocessor/include/hpx/preprocessor/config.hpp index e12ddb8711c1..03ec1df77cd8 100644 --- a/libs/core/preprocessor/include/hpx/preprocessor/config.hpp +++ b/libs/core/preprocessor/include/hpx/preprocessor/config.hpp @@ -70,10 +70,10 @@ #/* HPX_PP_CONFIG_ERRORS */ # #if !defined(HPX_PP_CONFIG_ERRORS) -#ifdef NDEBUG -#define HPX_PP_CONFIG_ERRORS 0 -#else +#ifdef HPX_DEBUG #define HPX_PP_CONFIG_ERRORS 1 +#else +#define HPX_PP_CONFIG_ERRORS 0 #endif #endif # diff --git a/libs/core/schedulers/include/hpx/schedulers/shared_priority_queue_scheduler.hpp b/libs/core/schedulers/include/hpx/schedulers/shared_priority_queue_scheduler.hpp index bd5ca1c6c530..863c2dfafa3d 100644 --- a/libs/core/schedulers/include/hpx/schedulers/shared_priority_queue_scheduler.hpp +++ b/libs/core/schedulers/include/hpx/schedulers/shared_priority_queue_scheduler.hpp @@ -6,7 +6,7 @@ #pragma once -#if !defined(NDEBUG) +#if defined(HPX_DEBUG) //# define SHARED_PRIORITY_SCHEDULER_DEBUG 1 #endif diff --git a/libs/core/thread_support/include/hpx/thread_support/assert_owns_lock.hpp b/libs/core/thread_support/include/hpx/thread_support/assert_owns_lock.hpp index f65ea163c58d..bca4b6d34854 100644 --- a/libs/core/thread_support/include/hpx/thread_support/assert_owns_lock.hpp +++ b/libs/core/thread_support/include/hpx/thread_support/assert_owns_lock.hpp @@ -9,6 +9,7 @@ #include #include #include +#include #include @@ -26,14 +27,12 @@ namespace hpx { namespace util { namespace detail { { } -#if !defined(HPX_DISABLE_ASSERTS) && !defined(BOOST_DISABLE_ASSERTS) && \ - !defined(NDEBUG) - template typename std::enable_if::value>::type assert_owns_lock( Lock const& l, long) { HPX_ASSERT(l.owns_lock()); + HPX_UNUSED(l); } template @@ -41,9 +40,8 @@ namespace hpx { namespace util { namespace detail { assert_doesnt_own_lock(Lock const& l, long) { HPX_ASSERT(!l.owns_lock()); + HPX_UNUSED(l); } - -#endif }}} // namespace hpx::util::detail #define HPX_ASSERT_OWNS_LOCK(l) ::hpx::util::detail::assert_owns_lock(l, 0L) diff --git a/libs/full/actions/include/hpx/actions/transfer_base_action.hpp b/libs/full/actions/include/hpx/actions/transfer_base_action.hpp index 35211ea601b5..8a7340cad044 100644 --- a/libs/full/actions/include/hpx/actions/transfer_base_action.hpp +++ b/libs/full/actions/include/hpx/actions/transfer_base_action.hpp @@ -84,19 +84,11 @@ namespace hpx { namespace actions { return *data_; } -#if defined(HPX_DISABLE_ASSERTS) || defined(BOOST_DISABLE_ASSERTS) || \ - defined(NDEBUG) - constexpr HPX_HOST_DEVICE HPX_FORCEINLINE Args const& data() const - { - return *data_; - } -#else HPX_HOST_DEVICE HPX_FORCEINLINE Args const& data() const { HPX_ASSERT(!!data_); return *data_; } -#endif private: std::unique_ptr data_; diff --git a/libs/full/runtime_local/src/runtime_local.cpp b/libs/full/runtime_local/src/runtime_local.cpp index 92ad16fbe129..c0f120fa7747 100644 --- a/libs/full/runtime_local/src/runtime_local.cpp +++ b/libs/full/runtime_local/src/runtime_local.cpp @@ -1119,7 +1119,7 @@ namespace hpx { } } // namespace hpx -#if defined(_WIN64) && defined(_DEBUG) && \ +#if defined(_WIN64) && defined(HPX_DEBUG) && \ !defined(HPX_HAVE_FIBER_BASED_COROUTINES) #include #endif @@ -1296,7 +1296,7 @@ namespace hpx { util::function_nonser const& func, bool blocking) { -#if defined(_WIN64) && defined(_DEBUG) && \ +#if defined(_WIN64) && defined(HPX_DEBUG) && \ !defined(HPX_HAVE_FIBER_BASED_COROUTINES) // needs to be called to avoid problems at system startup // see: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=100319 diff --git a/src/runtime_distributed.cpp b/src/runtime_distributed.cpp index cfd2414cb115..86ff9eba54be 100644 --- a/src/runtime_distributed.cpp +++ b/src/runtime_distributed.cpp @@ -81,7 +81,7 @@ #include #include -#if defined(_WIN64) && defined(_DEBUG) && \ +#if defined(_WIN64) && defined(HPX_DEBUG) && \ !defined(HPX_HAVE_FIBER_BASED_COROUTINES) #include #endif @@ -543,7 +543,7 @@ namespace hpx { util::function_nonser const& func, bool blocking) { -#if defined(_WIN64) && defined(_DEBUG) && \ +#if defined(_WIN64) && defined(HPX_DEBUG) && \ !defined(HPX_HAVE_FIBER_BASED_COROUTINES) // needs to be called to avoid problems at system startup // see: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=100319 diff --git a/tests/unit/build/CMakeLists.txt b/tests/unit/build/CMakeLists.txt index 3798549da0a8..5588b1df7c53 100644 --- a/tests/unit/build/CMakeLists.txt +++ b/tests/unit/build/CMakeLists.txt @@ -15,7 +15,15 @@ if(NOT HPX_WITH_DISTRIBUTED_RUNTIME) endif() # Try building an external cmake based project ... -function(create_cmake_test name using_install_dir hpx_dir setup_type test_dir) +function( + create_cmake_test + name + using_install_dir + hpx_dir + setup_type + build_type + test_dir +) set(build_dir "${CMAKE_CURRENT_BINARY_DIR}/${name}") add_custom_target( ${name}.make_build_dir @@ -56,7 +64,7 @@ function(create_cmake_test name using_install_dir hpx_dir setup_type test_dir) "${CMAKE_COMMAND}" -E chdir "${build_dir}" "${CMAKE_COMMAND}" ${test_dir} -DHPX_DIR=${hpx_dir} -DBOOST_ROOT=${BOOST_ROOT} ${ADDITIONAL_CMAKE_OPTIONS} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS_SAFE} - -DCMAKE_BUILD_TYPE=$ + -DCMAKE_BUILD_TYPE=${build_type} VERBATIM ) add_dependencies( @@ -65,7 +73,7 @@ function(create_cmake_test name using_install_dir hpx_dir setup_type test_dir) ) add_custom_target( ${name}.make_compile - COMMAND "${CMAKE_COMMAND}" --build "${build_dir}" --config $ + COMMAND "${CMAKE_COMMAND}" --build "${build_dir}" --config ${build_type} VERBATIM ) add_dependencies(${name}.make_compile ${name}.make_configure) @@ -113,44 +121,60 @@ function(create_pkgconfig_test name hpx_dir) endfunction() -create_cmake_test( - cmake_build_dir_targets_test FALSE - "${PROJECT_BINARY_DIR}/lib/cmake/${HPX_PACKAGE_NAME}" TARGETS - "examples/hello_world_component" -) - -create_cmake_test( - cmake_build_dir_macros_test FALSE - "${PROJECT_BINARY_DIR}/lib/cmake/${HPX_PACKAGE_NAME}" MACROS - "examples/hello_world_component" -) +if(MSVC) + set(build_types ${CMAKE_BUILD_TYPE}) +else() + set(build_types Debug Release RelWithDebInfo) + # lld (which HIP uses) does not support the -Os flags in older versions. We do + # not attempt to detect the linker in the general case, but disable the + # MinSizeRel test here since we know that HIP only uses lld. + if(NOT HPX_WITH_HIP OR (HIP_VERSION VERSION_GREATER_EQUAL "4.0.0")) + list(APPEND build_types MinSizeRel) + endif() +endif() -create_cmake_test( - cmake_install_dir_targets_test TRUE - "${CMAKE_INSTALL_FULL_LIBDIR}/cmake/${HPX_PACKAGE_NAME}" TARGETS - "examples/hello_world_component" -) +foreach(build_type ${build_types}) + string(TOLOWER "${build_type}" build_type_lc) -create_cmake_test( - cmake_install_dir_macros_test TRUE - "${CMAKE_INSTALL_FULL_LIBDIR}/cmake/${HPX_PACKAGE_NAME}" MACROS - "examples/hello_world_component" -) + create_cmake_test( + cmake_${build_type_lc}_build_dir_targets_test FALSE + "${PROJECT_BINARY_DIR}/lib/cmake/${HPX_PACKAGE_NAME}" TARGETS ${build_type} + "examples/hello_world_component" + ) -if(HPX_WITH_DYNAMIC_HPX_MAIN) - # Google test emulation create_cmake_test( - cmake_build_dir_gtest_emulation_test FALSE - "${PROJECT_BINARY_DIR}/lib/cmake/${HPX_PACKAGE_NAME}" TARGETS - "examples/gtest_emulation" + cmake_${build_type_lc}_build_dir_macros_test FALSE + "${PROJECT_BINARY_DIR}/lib/cmake/${HPX_PACKAGE_NAME}" MACROS ${build_type} + "examples/hello_world_component" ) create_cmake_test( - cmake_install_dir_gtest_emulation_test TRUE + cmake_${build_type_lc}_install_dir_targets_test TRUE "${CMAKE_INSTALL_FULL_LIBDIR}/cmake/${HPX_PACKAGE_NAME}" TARGETS - "examples/gtest_emulation" + ${build_type} "examples/hello_world_component" ) -endif() + + create_cmake_test( + cmake_${build_type_lc}_install_dir_macros_test TRUE + "${CMAKE_INSTALL_FULL_LIBDIR}/cmake/${HPX_PACKAGE_NAME}" MACROS + ${build_type} "examples/hello_world_component" + ) + + if(HPX_WITH_DYNAMIC_HPX_MAIN) + # Google test emulation + create_cmake_test( + cmake_${build_type_lc}_build_dir_gtest_emulation_test FALSE + "${PROJECT_BINARY_DIR}/lib/cmake/${HPX_PACKAGE_NAME}" TARGETS + ${build_type} "examples/gtest_emulation" + ) + + create_cmake_test( + cmake_${build_type_lc}_install_dir_gtest_emulation_test TRUE + "${CMAKE_INSTALL_FULL_LIBDIR}/cmake/${HPX_PACKAGE_NAME}" TARGETS + ${build_type} "examples/gtest_emulation" + ) + endif() +endforeach() # PkgConfig if(NOT MSVC @@ -189,17 +213,37 @@ if(NOT CMAKE_TOOLCHAIN_FILE set(pkgconfig_tests build_dir install_dir) endif() -foreach(system ${build_systems}) - add_hpx_pseudo_target(tests.unit.build.${system}) +set(system cmake) +add_hpx_pseudo_target(tests.unit.build.${system}) +foreach(build_type ${build_types}) + string(TOLOWER "${build_type}" build_type_lc) + add_hpx_pseudo_target(tests.unit.build.${system}.${build_type_lc}) foreach(test ${${system}_tests}) - add_hpx_pseudo_target(tests.unit.build.${system}.${test}) + add_hpx_pseudo_target(tests.unit.build.${system}.${build_type_lc}.${test}) add_hpx_pseudo_dependencies( - tests.unit.build.${system}.${test} ${system}_${test}_test + tests.unit.build.${system}.${build_type_lc}.${test} + ${system}_${build_type_lc}_${test}_test ) add_hpx_pseudo_dependencies( - tests.unit.build.${system} tests.unit.build.${system}.${test} + tests.unit.build.${system}.${build_type_lc} + tests.unit.build.${system}.${build_type_lc}.${test} ) endforeach() - - add_hpx_pseudo_dependencies(tests.unit.build tests.unit.build.${system}) + add_hpx_pseudo_dependencies( + tests.unit.build.${system} tests.unit.build.${system}.${build_type_lc} + ) +endforeach() +add_hpx_pseudo_dependencies(tests.unit.build tests.unit.build.${system}) + +set(system pkgconfig) +add_hpx_pseudo_target(tests.unit.build.${system}) +foreach(test ${${system}_tests}) + add_hpx_pseudo_target(tests.unit.build.${system}.${test}) + add_hpx_pseudo_dependencies( + tests.unit.build.${system}.${test} ${system}_${test}_test + ) + add_hpx_pseudo_dependencies( + tests.unit.build.${system} tests.unit.build.${system}.${test} + ) endforeach() +add_hpx_pseudo_dependencies(tests.unit.build tests.unit.build.${system})