-
Notifications
You must be signed in to change notification settings - Fork 564
Feature/module target #466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
ClausKlein
wants to merge
3
commits into
Neargye:module_target
from
ClausKlein:feature/module_target
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -116,7 +116,7 @@ function(magic_enum_make_module_test src target module_target) | |
| CXX_SCAN_FOR_MODULES ON | ||
| ) | ||
| if(MAGIC_ENUM_MODULE_IMPORT_STD) | ||
| target_compile_definitions(${target} PRIVATE MAGIC_ENUM_TEST_IMPORT_STD) | ||
| # XXX target_compile_definitions(${target} PRIVATE MAGIC_ENUM_TEST_IMPORT_STD) | ||
| set_property(TARGET ${target} PROPERTY CXX_MODULE_STD ON) | ||
| endif() | ||
| add_test(NAME ${target} COMMAND ${target}) | ||
|
|
@@ -259,3 +259,42 @@ if(MAGIC_ENUM_USE_MODULES AND MAGIC_ENUM_OPT_INSTALL AND | |
| ) | ||
| set_tests_properties(installed-module-consumer PROPERTIES FIXTURES_REQUIRED magic_enum_installed_module) | ||
| endif() | ||
|
|
||
| if(NOT CMAKE_BUILD_TYPE STREQUAL "Release") | ||
| return() | ||
| endif() | ||
|
|
||
| #====================================================================== | ||
| # NOTE: Only for Release build with enabled install rules useful! CK | ||
| #====================================================================== | ||
| if(MAGIC_ENUM_MODULE_IMPORT_STD AND MAGIC_ENUM_OPT_INSTALL AND NOT CMAKE_SKIP_INSTALL_RULES) | ||
| # test if the targets are usable from the install directory | ||
| add_test( | ||
| NAME install-to-stagedir | ||
| COMMAND | ||
| ${CMAKE_COMMAND} --install ${CMAKE_BINARY_DIR} --prefix | ||
| ${CMAKE_CURRENT_BINARY_DIR}/stagedir --config $<CONFIG> | ||
| ) | ||
| add_test( | ||
| NAME find-package-test | ||
| COMMAND | ||
| ${CMAKE_CTEST_COMMAND} # --verbose | ||
| --output-on-failure -C $<CONFIG> # | ||
| --build-and-test "${CMAKE_SOURCE_DIR}/test/installed_module" | ||
| "${CMAKE_CURRENT_BINARY_DIR}/find-package-test" # | ||
| --build-generator ${CMAKE_GENERATOR} # | ||
| --build-makeprogram ${CMAKE_MAKE_PROGRAM} # | ||
| --build-options # | ||
| "-D MAGIC_ENUM_EXPECT_FMT=${MAGIC_ENUM_MODULE_WITH_FMT}" | ||
| "-D MAGIC_ENUM_EXPECT_FMT_MODULE=${MAGIC_ENUM_MODULE_USES_FMT_MODULE}" | ||
| "-D MAGIC_ENUM_EXPECT_IMPORT_STD=${MAGIC_ENUM_MODULE_IMPORT_STD}" | ||
| "-D CMAKE_BUILD_TYPE=$<CONFIG>" | ||
| "-D CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}" | ||
| "-D CMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}" | ||
| "-D CMAKE_CXX_MODULE_STD=${CMAKE_CXX_MODULE_STD}" | ||
| "-D CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}" | ||
| "-D CMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED}" | ||
| "-D CMAKE_PREFIX_PATH=${CMAKE_CURRENT_BINARY_DIR}/stagedir" | ||
| "-D CMAKE_EXPERIMENTAL_CXX_IMPORT_STD=${CMAKE_EXPERIMENTAL_CXX_IMPORT_STD}" | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Without this |
||
| ) | ||
| endif() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| repo_root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" | ||
| build_root="${repo_root}/build" | ||
| source_build_dir="${build_root}/source" | ||
| configured_install_dir="${build_root}/configured-install" | ||
| install_dir="${build_root}/install" | ||
| consumer_prefix="${build_root}/relocated-install" | ||
| cmake_consumer_build_dir="${build_root}/cmake-consumer" | ||
| pkgconfig_consumer_build_dir="${build_root}/pkgconfig-consumer" | ||
| cxx_modules_consumer_build_dir="${build_root}/cxx_modules-consumer" | ||
|
|
||
| test_installed_consumer() { | ||
| local build_dir="$1" | ||
| shift | ||
|
|
||
| CMAKE_PREFIX_PATH="${consumer_prefix}" cmake -S "${repo_root}" -B "${build_dir}" \ | ||
| -G Ninja \ | ||
| -D CMAKE_BUILD_TYPE=Debug \ | ||
| "$@" | ||
| cmake --build "${build_dir}" --parallel | ||
| ctest --test-dir "${build_dir}" --output-on-failure --no-tests=error | ||
| } | ||
|
|
||
| cmake --version | ||
| cmake -E remove_directory "${build_root}" | ||
|
|
||
| cmake -S "${repo_root}" -B "${source_build_dir}" -G Ninja \ | ||
| -D CMAKE_BUILD_TYPE=Release \ | ||
| -D CMAKE_CXX_STANDARD=23 \ | ||
| -D CMAKE_EXPERIMENTAL_CXX_IMPORT_STD=f35a9ac6-8463-4d38-8eec-5d6008153e7d \ | ||
| -D CMAKE_INSTALL_PREFIX="${configured_install_dir}" \ | ||
| -D MAGIC_ENUM_MODULE_IMPORT_STD=YES \ | ||
| -D MAGIC_ENUM_MODULE_WITH_FMT=NO \ | ||
| -D MAGIC_ENUM_OPT_BUILD_EXAMPLES=OFF \ | ||
| -D MAGIC_ENUM_OPT_BUILD_TESTS=YES \ | ||
| -D MAGIC_ENUM_OPT_INSTALL=ON \ | ||
| -D MAGIC_ENUM_OPT_VERIFY_INTERFACE_HEADER_SETS=ON \ | ||
| -D MAGIC_ENUM_USE_MODULES=YES -Wdev --log-level=VERBOSE # XXX --fresh | ||
| cmake --build "${source_build_dir}" \ | ||
| --target magic_enum_verify_interface_header_sets \ | ||
| --parallel | ||
| cmake --build "${source_build_dir}" \ | ||
| --target all \ | ||
| --parallel | ||
| ctest --test-dir "${source_build_dir}" --output-on-failure --no-tests=error | ||
|
|
||
| # cmake --install "${source_build_dir}" --prefix "${install_dir}" | ||
| # cmake -E copy_directory "${install_dir}" "${consumer_prefix}" | ||
|
|
||
| # test_installed_consumer "${cxx_modules_consumer_build_dir}" \ | ||
| # -D CMAKE_CXX_STANDARD=23 \ | ||
| # -D CMAKE_EXPERIMENTAL_CXX_IMPORT_STD=f35a9ac6-8463-4d38-8eec-5d6008153e7d \ | ||
| # -D MAGIC_ENUM_MODULE_IMPORT_STD=YES \ | ||
| # -D MAGIC_ENUM_MODULE_WITH_FMT=NO \ | ||
| # -D MAGIC_ENUM_OPT_TEST_INSTALLED_VERSION=ON \ | ||
| # -D MAGIC_ENUM_USE_MODULES=YES \ | ||
| # -D PKG_CONFIG_USE_CMAKE_PREFIX_PATH=YES --fresh | ||
|
|
||
| # test_installed_consumer "${cmake_consumer_build_dir}" \ | ||
| # -D MAGIC_ENUM_OPT_TEST_INSTALLED_VERSION=ON | ||
|
|
||
| # test_installed_consumer "${pkgconfig_consumer_build_dir}" \ | ||
| # -D MAGIC_ENUM_OPT_TEST_INSTALLED_VERSION_PKGCONFIG=ON \ | ||
| # -D PKG_CONFIG_USE_CMAKE_PREFIX_PATH=ON | ||
|
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note this too: normally not needed if not top level project!