Skip to content

Commit 6ebaec3

Browse files
committed
Improve updater a bit, prevent demos from polluting coverage results.
1 parent 855369c commit 6ebaec3

5 files changed

Lines changed: 22 additions & 22 deletions

File tree

cmake/idi/functions/framework/idi_init.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ macro(idi_init)
8080
set("IDICMAKE_CI_GIT_BRANCH_NAME" "${${IDICMAKE_PREFIX}_CI_GIT_BRANCH_NAME}")
8181
set("IDICMAKE_FORCE_PIC" "${${IDICMAKE_PREFIX}_FORCE_PIC}")
8282

83-
if (IDICMAKE_APP_NAMESPACE)
83+
if(IDICMAKE_APP_NAMESPACE)
8484
set(__idi_namespace "${IDICMAKE_VENDOR_NAMESPACE}::${IDICMAKE_APP_NAMESPACE}")
8585
set(__idi_app_namespace ${IDICMAKE_APP_NAMESPACE})
8686
set(__idi_c_namespace "${IDICMAKE_VENDOR_NAMESPACE}_${IDICMAKE_APP_NAMESPACE}")
@@ -122,7 +122,7 @@ macro(idi_init)
122122

123123
# Make sure we don't pollute a top level project that doesn't use our folder scheme for dependencies
124124
if(NOT IDICMAKE_IS_SUBDIRECTORY)
125-
set(IDICMAKE_TOP_LEVEL_CMAKE_DEPENDENCY_SUPPORT 1 CACHE BOOL "")
125+
set(IDICMAKE_TOP_LEVEL_CMAKE_DEPENDENCY_SUPPORT 1 CACHE BOOL "")
126126
set(IDICMAKE_EXTERNAL_LIB_DIR "${CMAKE_CURRENT_LIST_DIR}/lib/first-party")
127127
set(IDICMAKE_EXTERNAL_THIRD_PARTY_LIB_DIR "${CMAKE_CURRENT_LIST_DIR}/lib/third-party")
128128
else()
@@ -131,8 +131,8 @@ macro(idi_init)
131131
set(IDICMAKE_EXTERNAL_LIB_DIR "${CMAKE_CURRENT_LIST_DIR}/lib/first-party")
132132
set(IDICMAKE_EXTERNAL_THIRD_PARTY_LIB_DIR "${CMAKE_CURRENT_LIST_DIR}/lib/third-party")
133133
else()
134-
set(IDICMAKE_EXTERNAL_LIB_DIR "${CMAKE_SOURCE_DIR}/lib/first-party")
135-
set(IDICMAKE_EXTERNAL_THIRD_PARTY_LIB_DIR "${CMAKE_SOURCE_DIR}/lib/third-party")
134+
set(IDICMAKE_EXTERNAL_LIB_DIR "${CMAKE_SOURCE_DIR}/lib/first-party")
135+
set(IDICMAKE_EXTERNAL_THIRD_PARTY_LIB_DIR "${CMAKE_SOURCE_DIR}/lib/third-party")
136136
endif()
137137
endif()
138138

@@ -143,7 +143,7 @@ macro(idi_init)
143143
add_subdirectory("src")
144144
idi_cmake_hook(post-source)
145145

146-
if(IDICMAKE_BUILD_DEMOS)
146+
if(IDICMAKE_BUILD_DEMOS AND NOT CODE_COVERAGE)
147147
add_subdirectory("demo")
148148
endif()
149149

cmake/idi/functions/idi_demo.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ function(__idi_demo demo_name demo_file)
4747
endif()
4848
endforeach()
4949

50-
if (ADD_CORE)
50+
if(ADD_CORE)
5151
target_link_libraries("${CURRENT_DEMO}" PUBLIC "${IDICMAKE_CORE}")
5252
list(APPEND __LIBRARY_LIST ${CURRENT_DEMO})
5353
list(APPEND __LIBRARY_LIST ${IDICMAKE_CORE})
5454
endif()
5555

56-
if (IDICMAKE_IS_SHARED)
56+
if(IDICMAKE_IS_SHARED)
5757
# setting target BUILD_WITH_INSTALL_RPATH to OFF for a shared library
5858
# will make sure that demos link against the build tree RPATH and not
5959
# the system install dir, this lets tests for the .so on linux.

cmake/idi/updater/updater.cmake

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,21 @@ if(DO_FRAMEWORK_UPDATE)
3636
message(STATUS "Framework update mode: ${__framework_update_mode}")
3737

3838
if(__framework_update_mode STREQUAL "folder")
39-
if (NOT __framework_update_folder_loc)
39+
if(NOT __framework_update_folder_loc)
4040
do_error("FRAMEWORK_UPDATE_MODE is 'folder', but FRAMEWORK_UPDATE_FOLDER_LOC is not defined!")
4141
endif()
4242

4343
file(COPY "${__framework_update_folder_loc}/" DESTINATION ${FRAMEWORK_UPDATE_DIR}
4444
PATTERN ".idi-framework-update" EXCLUDE
4545
PATTERN "build" EXCLUDE
4646
PATTERN ".git" EXCLUDE
47-
)
47+
)
4848

4949
if(NOT (EXISTS "${FRAMEWORK_UPDATE_DIR}/cmake/idi/updater/updater_version.cmake"))
5050
do_error("The folder provided via FRAMEWORK_UPDATE_FOLDER_LOC does not appear to be a valid template update!")
5151
endif()
5252
elseif(__framework_update_mode STREQUAL "file")
53-
if (NOT __framework_update_file_loc)
53+
if(NOT __framework_update_file_loc)
5454
do_error("FRAMEWORK_UPDATE_MODE is 'file', but FRAMEWORK_UPDATE_FILE_LOC is not defined!")
5555
endif()
5656

@@ -82,17 +82,17 @@ if(DO_FRAMEWORK_UPDATE)
8282
set(OLD_IDICMAKE_BASE_REQ_CML_V ${IDICMAKE_BASE_REQ_CML_V})
8383

8484
include("${FRAMEWORK_UPDATE_DIR}/cmake/idi/updater/updater_version.cmake")
85+
if(EXISTS "${FRAMEWORK_UPDATE_DIR}/cmake/idi/version.cmake")
86+
include("${FRAMEWORK_UPDATE_DIR}/cmake/idi/version.cmake")
87+
endif()
8588

86-
if ((OLD_IDICMAKE_CPP_UPDATER_VERSION EQUAL IDICMAKE_CPP_UPDATER_VERSION) AND
87-
(OLD_IDICMAKE_CPP_FRAMEWORK_VERSION_MAJOR EQUAL IDICMAKE_CPP_FRAMEWORK_VERSION_MAJOR) AND
88-
(OLD_IDICMAKE_CPP_FRAMEWORK_VERSION_MINOR EQUAL IDICMAKE_CPP_FRAMEWORK_VERSION_MINOR) AND
89-
(OLD_IDICMAKE_CPP_FRAMEWORK_VERSION_HOTFIX EQUAL IDICMAKE_CPP_FRAMEWORK_VERSION_HOTFIX) AND
90-
(OLD_IDICMAKE_ROOT_REQ_CML_V EQUAL IDICMAKE_ROOT_REQ_CML_V) AND
91-
(OLD_IDICMAKE_SRC_REQ_CML_V EQUAL IDICMAKE_SRC_REQ_CML_V) AND
92-
(OLD_IDICMAKE_BASE_REQ_CML_V EQUAL IDICMAKE_BASE_REQ_CML_V)
93-
)
89+
set(__old_ver "${OLD_IDICMAKE_CPP_FRAMEWORK_VERSION_MAJOR}.${OLD_IDICMAKE_CPP_FRAMEWORK_VERSION_MINOR}.${OLD_IDICMAKE_CPP_FRAMEWORK_VERSION_HOTFIX}")
90+
set(__new_ver "${IDICMAKE_CPP_FRAMEWORK_VERSION_MAJOR}.${IDICMAKE_CPP_FRAMEWORK_VERSION_MINOR}.${IDICMAKE_CPP_FRAMEWORK_VERSION_HOTFIX}")
91+
92+
if((__old_ver VERSION_GREATER_EQUAL __new_ver) AND
93+
(OLD_IDICMAKE_CPP_UPDATER_VERSION GREATER_EQUAL IDICMAKE_CPP_UPDATER_VERSION))
9494
if(NOT __framework_update_force)
95-
do_error("Framework is already up-to-date! Run with FRAMEWORK_UPDATE_FORCE to force an update.")
95+
do_error("Framework is already up-to-date or newer! Local: ${__old_ver} (updater v${OLD_IDICMAKE_CPP_UPDATER_VERSION}), Update: ${__new_ver} (updater v${IDICMAKE_CPP_UPDATER_VERSION}). Run with FRAMEWORK_UPDATE_FORCE to force an update.")
9696
endif()
9797
endif()
9898

cmake/idi/updater/updater_version.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
# This is the _framework_ **updater** version number, and is NOT related to the underlying project.
99

1010
# Any time the updater is changed this version should be incremented!!!
11-
set(IDICMAKE_CPP_UPDATER_VERSION 3)
11+
set(IDICMAKE_CPP_UPDATER_VERSION 4)

cmake/idi/version.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
# Follow https://semver.org/ rules!
1111

1212
# Major version is required to change if there is API breaking changes!
13-
set(IDICMAKE_CPP_FRAMEWORK_VERSION_MAJOR 5)
13+
set(IDICMAKE_CPP_FRAMEWORK_VERSION_MAJOR 6)
1414

1515
# Minor increments on backwards compat updates!
16-
set(IDICMAKE_CPP_FRAMEWORK_VERSION_MINOR 3)
16+
set(IDICMAKE_CPP_FRAMEWORK_VERSION_MINOR 0)
1717

1818
# Hot fixes, which should be rare in this case.
1919
set(IDICMAKE_CPP_FRAMEWORK_VERSION_HOTFIX 0)

0 commit comments

Comments
 (0)