Skip to content

Commit 2a05d6e

Browse files
authored
Upgrade to build system 3.1.0
1 parent 8525a1f commit 2a05d6e

File tree

2 files changed

+126
-25
lines changed

2 files changed

+126
-25
lines changed

repository.cmake

Lines changed: 124 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,58 @@ function (ntf_target_requires_get)
705705
set(${ARG_OUTPUT} ${result} PARENT_SCOPE)
706706
endfunction()
707707

708+
# Set the "requires_test" variable scoped to a target.
709+
#
710+
# TARGET - The target.
711+
# VALUE - The variable value.
712+
function (ntf_target_requires_test_set)
713+
cmake_parse_arguments(
714+
ARG "" "TARGET" "VALUE" ${ARGN})
715+
716+
ntf_assert_defined(${ARG_TARGET})
717+
718+
if (NOT "${ARG_VALUE}" STREQUAL "")
719+
ntf_target_variable_set(
720+
TARGET ${ARG_TARGET} VARIABLE "requires_test" VALUE ${ARG_VALUE})
721+
else()
722+
ntf_target_variable_set(
723+
TARGET ${ARG_TARGET} VARIABLE "requires_test" VALUE "")
724+
endif()
725+
endfunction()
726+
727+
# Append to the "requires_test" variable scoped to a target.
728+
#
729+
# TARGET - The target.
730+
# VALUE - The variable value.
731+
function (ntf_target_requires_test_append)
732+
cmake_parse_arguments(
733+
ARG "" "TARGET" "VALUE" ${ARGN})
734+
735+
ntf_assert_defined(${ARG_TARGET})
736+
737+
if (NOT "${ARG_VALUE}" STREQUAL "")
738+
ntf_target_variable_append(
739+
TARGET ${ARG_TARGET} VARIABLE "requires_test" VALUE ${ARG_VALUE})
740+
endif()
741+
endfunction()
742+
743+
# Get the "requires_test" variable scoped to a target.
744+
#
745+
# TARGET - The target.
746+
# OUTPUT - The variable name set in the parent scope.
747+
function (ntf_target_requires_test_get)
748+
cmake_parse_arguments(
749+
ARG "" "TARGET;OUTPUT" "" ${ARGN})
750+
751+
ntf_assert_defined(${ARG_TARGET})
752+
ntf_assert_defined(${ARG_OUTPUT})
753+
754+
ntf_target_variable_get(
755+
TARGET ${ARG_TARGET} VARIABLE "requires_test" OUTPUT result)
756+
757+
set(${ARG_OUTPUT} ${result} PARENT_SCOPE)
758+
endfunction()
759+
708760
# Set the "aliases" variable scoped to a target. The contents of this variable
709761
# are imported as aliases of the target in the CMake install metadata.
710762
#
@@ -1721,7 +1773,7 @@ function (ntf_target_options_cov target)
17211773
ntf_target_build_definition(TARGET ${target} VALUE BDE_BUILD_TARGET_COV)
17221774

17231775
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
1724-
ntf_target_build_option(TARGET ${target} COMPILE LINK --coverage)
1776+
ntf_target_build_option(TARGET ${target} COMPILE LINK VALUE --coverage)
17251777
else()
17261778
ntf_die("The UFID flag 'cov' is not supported by compiler: ${CMAKE_CXX_COMPILER_ID}")
17271779
endif()
@@ -2107,7 +2159,7 @@ endfunction()
21072159
# suite for the repository.
21082160
function (ntf_executable)
21092161
cmake_parse_arguments(
2110-
NTF_EXECUTABLE "PRIVATE;TEST;EXAMPLE;UNITY" "NAME;PATH;MAIN;OUTPUT" "REQUIRES" ${ARGN})
2162+
NTF_EXECUTABLE "PRIVATE;THIRDPARTY;TEST;EXAMPLE;UNITY" "NAME;PATH;MAIN;OUTPUT" "REQUIRES" ${ARGN})
21112163

21122164
if ("${NTF_EXECUTABLE_NAME}" STREQUAL "")
21132165
message(FATAL_ERROR "Invalid parameter: NAME")
@@ -2137,6 +2189,11 @@ function (ntf_executable)
21372189
set(target_private FALSE)
21382190
endif()
21392191

2192+
set(target_thirdparty ${NTF_EXECUTABLE_THIRDPARTY})
2193+
if ("${target_thirdparty}" STREQUAL "")
2194+
set(target_thirdparty FALSE)
2195+
endif()
2196+
21402197
set(target_unity ${NTF_EXECUTABLE_UNITY})
21412198
if ("${target_unity}" STREQUAL "")
21422199
set(target_unity FALSE)
@@ -2230,7 +2287,7 @@ function (ntf_executable)
22302287
TARGET ${target} VALUE ${target_private})
22312288

22322289
ntf_target_thirdparty_set(
2233-
TARGET ${target} VALUE FALSE)
2290+
TARGET ${target} VALUE ${target_thirdparty})
22342291

22352292
ntf_target_pseudo_set(
22362293
TARGET ${target} VALUE FALSE)
@@ -3151,7 +3208,7 @@ endfunction()
31513208
# it exists, otherwise the dependency must be must found
31523209
function (ntf_group_requires)
31533210
cmake_parse_arguments(
3154-
ARG "OPTIONAL" "NAME" "DEPENDENCY" ${ARGN})
3211+
ARG "OPTIONAL;TEST" "NAME" "DEPENDENCY" ${ARGN})
31553212

31563213
ntf_assert_defined(${ARG_NAME})
31573214
ntf_assert_defined(${ARG_DEPENDENCY})
@@ -3160,14 +3217,25 @@ function (ntf_group_requires)
31603217

31613218
ntf_assert_target_defined(${target})
31623219

3163-
foreach (dependency ${ARG_DEPENDENCY})
3164-
ntf_target_link_dependency(
3165-
TARGET ${target} DEPENDENCY ${dependency} OUTPUT result OPTIONAL)
3220+
set(for_testing ${ARG_TEST})
3221+
if ("${for_testing}" STREQUAL "")
3222+
set(for_testing FALSE)
3223+
endif()
31663224

3167-
if (NOT ${result} AND NOT ${ARG_OPTIONAL})
3168-
ntf_die("The target '${target}' requires dependency '${dependency}' but it cannot be found")
3169-
endif()
3170-
endforeach()
3225+
if (NOT ${for_testing})
3226+
foreach (dependency ${ARG_DEPENDENCY})
3227+
ntf_target_link_dependency(
3228+
TARGET ${target} DEPENDENCY ${dependency} OUTPUT result OPTIONAL)
3229+
3230+
if (NOT ${result} AND NOT ${ARG_OPTIONAL})
3231+
ntf_die("The target '${target}' requires dependency '${dependency}' but it cannot be found")
3232+
endif()
3233+
endforeach()
3234+
else()
3235+
foreach (dependency ${ARG_DEPENDENCY})
3236+
ntf_target_requires_test_append(TARGET ${target} VALUE ${dependency})
3237+
endforeach()
3238+
endif()
31713239
endfunction()
31723240

31733241
# Unify the build of all the components in a group.
@@ -4232,6 +4300,20 @@ function (ntf_component)
42324300
target_link_libraries(${component_test_build_target} PUBLIC ${dependency})
42334301
endforeach()
42344302

4303+
ntf_target_requires_test_get(
4304+
TARGET ${component_install_component} OUTPUT target_requires_test)
4305+
4306+
foreach(entry ${target_requires_test})
4307+
set(test_dependency ${entry})
4308+
4309+
if (VERBOSE)
4310+
message(STATUS "NTF Build: linking component test driver '${component_test_build_target}' to test target '${test_dependency}'")
4311+
message(STATUS " * target_link_libraries(${component_test_build_target} ${test_dependency})")
4312+
endif()
4313+
4314+
target_link_libraries(${component_test_build_target} PUBLIC ${test_dependency})
4315+
endforeach()
4316+
42354317
ntf_target_options_common_epilog(${target})
42364318

42374319
cmake_path(
@@ -6355,7 +6437,7 @@ function (ntf_repository_end)
63556437
set(coverage_command
63566438
${GCOVR_PATH} --root ${PROJECT_SOURCE_DIR} --object-directory=${PROJECT_BINARY_DIR} --exclude=${PROJECT_SOURCE_DIR}/\(.+/\)?\(.+\)\\.t\\.cpp\$ --exclude=${PROJECT_SOURCE_DIR}/\(.+/\)?\(.+\)\\.m\\.cpp\$ --html coverage/index.html --html-details --html-title ${html_title} --xml coverage/index.xml --xml-pretty)
63576439

6358-
if (VERBOSE)
6440+
if (VERBOSE OR TRUE)
63596441
message(STATUS "Enabled code coverage")
63606442
message(STATUS " GCOV_PATH: ${GCOV_PATH}")
63616443
message(STATUS " LCOV_PATH: ${LCOV_PATH}")
@@ -6385,12 +6467,13 @@ function (ntf_repository_end)
63856467
COMMENT "Generating code coverage"
63866468
)
63876469

6388-
add_custom_command(
6389-
TARGET coverage
6390-
POST_BUILD
6391-
COMMAND ;
6392-
COMMENT "Generated '${PROJECT_BINARY_DIR}/coverage/index.html'"
6393-
)
6470+
# MRM:
6471+
#add_custom_command(
6472+
# TARGET coverage
6473+
# POST_BUILD
6474+
# COMMAND ;
6475+
# COMMENT "Generated '${PROJECT_BINARY_DIR}/coverage/index.html'"
6476+
#)
63946477
endif()
63956478

63966479
endfunction()
@@ -8433,8 +8516,6 @@ Libs.private:${target_libs_string}\n\
84338516

84348517
endfunction()
84358518

8436-
8437-
84388519
# Install the artifacts produced when building the target library, including
84398520
# its build system meta-data.
84408521
#
@@ -8541,10 +8622,30 @@ function (ntf_target_install_rule)
85418622

85428623
# Determine which CMake meta data case style to use.
85438624

8544-
if (EXISTS "${install_refroot}/${install_prefix}/${library_relative_path}/cmake/${target}/${target}Config.cmake")
8625+
if (NOT DEFINED NTF_BUILD_WITH_CMAKE_METADATA_PASCAL_CASE)
8626+
if (DEFINED NTF_CONFIGURE_WITH_CMAKE_METADATA_PASCAL_CASE)
8627+
set(NTF_BUILD_WITH_CMAKE_METADATA_PASCAL_CASE
8628+
${NTF_CONFIGURE_WITH_CMAKE_METADATA_PASCAL_CASE} CACHE INTERNAL "")
8629+
elseif (DEFINED ENV{NTF_CONFIGURE_WITH_CMAKE_METADATA_PASCAL_CASE})
8630+
set(NTF_BUILD_WITH_CMAKE_METADATA_PASCAL_CASE
8631+
$ENV{NTF_CONFIGURE_WITH_CMAKE_METADATA_PASCAL_CASE} CACHE INTERNAL "")
8632+
else()
8633+
set(NTF_BUILD_WITH_CMAKE_METADATA_PASCAL_CASE FALSE CACHE INTERNAL "")
8634+
endif()
8635+
endif()
8636+
8637+
set(install_cmake_metadata_style 0)
8638+
8639+
if (${NTF_BUILD_WITH_CMAKE_METADATA_PASCAL_CASE})
85458640
set(install_cmake_metadata_style 1)
8546-
else()
8547-
set(install_cmake_metadata_style 2)
8641+
endif()
8642+
8643+
if (${install_cmake_metadata_style} EQUAL 0)
8644+
if (EXISTS "${install_refroot}/${install_prefix}/${library_relative_path}/cmake/${target}/${target}Config.cmake")
8645+
set(install_cmake_metadata_style 1)
8646+
else()
8647+
set(install_cmake_metadata_style 2)
8648+
endif()
85488649
endif()
85498650

85508651
string(TOLOWER "${CMAKE_BUILD_TYPE}" buildTypeLowercase)

toolchain.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
include_guard(GLOBAL)
1717

1818
set(NTF_TOOLCHAIN_VERSION_MAJOR 3)
19-
set(NTF_TOOLCHAIN_VERSION_MINOR 0)
20-
set(NTF_TOOLCHAIN_VERSION_PATCH 1)
19+
set(NTF_TOOLCHAIN_VERSION_MINOR 1)
20+
set(NTF_TOOLCHAIN_VERSION_PATCH 0)
2121

2222
message(STATUS "NTF Build Toolchain ${NTF_TOOLCHAIN_VERSION_MAJOR}.${NTF_TOOLCHAIN_VERSION_MINOR}.${NTF_TOOLCHAIN_VERSION_PATCH}")
2323

0 commit comments

Comments
 (0)