Skip to content

Commit e227969

Browse files
committed
Merge branch 'main' into feat/install_runtimes_for_conan
2 parents 18c9e2a + bd2be71 commit e227969

File tree

18 files changed

+85
-80
lines changed

18 files changed

+85
-80
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ jobs:
6666
vcpkg: true
6767
conan: 2.6.0
6868
cppcheck: true
69-
clangtidy: true
69+
cmakelang: true
70+
clang-tidy: true
7071
task: true
7172
doxygen: true
7273
python: true
@@ -80,5 +81,4 @@ jobs:
8081

8182
- name: Lint
8283
run: |
83-
pipx install cmakelang[YAML]
8484
task lint

.github/workflows/docs.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: docs
22
on:
33
push:
4-
branches:
5-
- main
4+
tags:
5+
- "*"
6+
workflow_dispatch:
67

78
jobs:
89
Test:
@@ -36,12 +37,11 @@ jobs:
3637
git checkout main
3738
task docs
3839
39-
# TODO Automatic deploys fail
40-
# - name: Deploy Documentation
41-
# uses: Cecilapp/GitHub-Pages-deploy@v3
42-
# with:
43-
# build_dir: docs/build/html/
44-
# branch: gh-pages
45-
46-
# env:
47-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
- name: Deploy Documentation
41+
uses: Cecilapp/GitHub-Pages-deploy@v3
42+
with:
43+
build_dir: docs/build/
44+
branch: gh-pages
45+
email: ${{ github.actor }}@users.noreply.github.com
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ endif()
6767
6868
# Add project_options from https://github.com/aminya/project_options
6969
# Change the version in the following URL to update the package (watch the releases of the repository for future updates)
70-
set(PROJECT_OPTIONS_VERSION "v0.36.4")
70+
set(PROJECT_OPTIONS_VERSION "v0.36.5")
7171
FetchContent_Declare(
7272
_project_options
7373
URL https://github.com/aminya/project_options/archive/refs/tags/${PROJECT_OPTIONS_VERSION}.zip)
@@ -77,7 +77,7 @@ include(${_project_options_SOURCE_DIR}/Index.cmake)
7777
# install vcpkg dependencies: - should be called before defining project()
7878
run_vcpkg(
7979
VCPKG_URL "https://github.com/microsoft/vcpkg.git"
80-
VCPKG_REV "10e052511428d6b0c7fcc63a139e8024bb146032"
80+
VCPKG_REV "86a181505ac6460f98496a79abdee6a0f49905ec"
8181
)
8282
# Install conan dependencies: - should be called before defining project()
8383
run_conan()
@@ -101,7 +101,7 @@ if(FEATURE_TESTS)
101101
set(ENABLE_COVERAGE "ENABLE_COVERAGE")
102102
103103
set(ENABLE_SANITIZER_ADDRESS "ENABLE_SANITIZER_ADDRESS")
104-
set(ENABLE_SANITIZER_UNDEFINED_BEHAVIOR "ENABLE_SANITIZER_UNDEFINED_BEHAVIOR")
104+
set(ENABLE_SANITIZER_UNDEFINED "ENABLE_SANITIZER_UNDEFINED")
105105
endif()
106106
107107
# Enable doxgen for the docs
@@ -123,7 +123,7 @@ project_options(
123123
${ENABLE_DOXYGEN}
124124
${ENABLE_COVERAGE}
125125
${ENABLE_SANITIZER_ADDRESS}
126-
${ENABLE_SANITIZER_UNDEFINED_BEHAVIOR}
126+
${ENABLE_SANITIZER_UNDEFINED}
127127
# ${ENABLE_SANITIZER_THREAD}
128128
# ${ENABLE_SANITIZER_MEMORY}
129129
# ENABLE_SANITIZER_POINTER_COMPARE

docs/Taskfile.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ tasks:
1515
- cmake -S ./ -B ./build -G "Ninja Multi-Config" -DCMAKE_BUILD_TYPE=Release
1616
- cmake --build ./build --config Release
1717
- touch ./build/.nojekyll
18+
- rm -rf ./build/*.ninja ./build/*log ./build/*.py ./build/CMakeFiles ./build/CMakeCache.txt ./build/*.cmake
1819

1920
docs.preview:
2021
deps:

docs/src/project_options_example.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ endif()
2020
2121
# Add project_options from https://github.com/aminya/project_options
2222
# Change the version in the following URL to update the package (watch the releases of the repository for future updates)
23-
set(PROJECT_OPTIONS_VERSION "v0.36.4")
23+
set(PROJECT_OPTIONS_VERSION "v0.36.5")
2424
FetchContent_Declare(
2525
_project_options
2626
URL https://github.com/aminya/project_options/archive/refs/tags/${PROJECT_OPTIONS_VERSION}.zip)
@@ -30,8 +30,7 @@ include(${_project_options_SOURCE_DIR}/Index.cmake)
3030
# install vcpkg dependencies: - should be called before defining project()
3131
run_vcpkg(
3232
VCPKG_URL "https://github.com/microsoft/vcpkg.git"
33-
VCPKG_REV "10e052511428d6b0c7fcc63a139e8024bb146032"
34-
ENABLE_VCPKG_UPDATE
33+
VCPKG_REV "86a181505ac6460f98496a79abdee6a0f49905ec"
3534
)
3635
# Install conan dependencies: - should be called before defining project()
3736
run_conan()
@@ -55,7 +54,7 @@ if(FEATURE_TESTS)
5554
set(ENABLE_COVERAGE "ENABLE_COVERAGE")
5655
5756
set(ENABLE_SANITIZER_ADDRESS "ENABLE_SANITIZER_ADDRESS")
58-
set(ENABLE_SANITIZER_UNDEFINED_BEHAVIOR "ENABLE_SANITIZER_UNDEFINED_BEHAVIOR")
57+
set(ENABLE_SANITIZER_UNDEFINED "ENABLE_SANITIZER_UNDEFINED")
5958
endif()
6059
6160
# Enable doxgen for the docs
@@ -77,7 +76,7 @@ project_options(
7776
${ENABLE_DOXYGEN}
7877
${ENABLE_COVERAGE}
7978
${ENABLE_SANITIZER_ADDRESS}
80-
${ENABLE_SANITIZER_UNDEFINED_BEHAVIOR}
79+
${ENABLE_SANITIZER_UNDEFINED}
8180
# ${ENABLE_SANITIZER_THREAD}
8281
# ${ENABLE_SANITIZER_MEMORY}
8382
# ENABLE_SANITIZER_POINTER_COMPARE

src/DynamicProjectOptions.cmake

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Here is an example of how to use ``dynamic_project_options``:
5757
5858
# Add project_options from https://github.com/aminya/project_options
5959
# Change the version in the following URL to update the package (watch the releases of the repository for future updates)
60-
set(PROJECT_OPTIONS_VERSION "v0.36.4")
60+
set(PROJECT_OPTIONS_VERSION "v0.36.5")
6161
FetchContent_Declare(
6262
_project_options
6363
URL https://github.com/aminya/project_options/archive/refs/tags/${PROJECT_OPTIONS_VERSION}.zip)
@@ -103,27 +103,18 @@ macro(dynamic_project_options)
103103
)
104104
endif()
105105

106-
check_sanitizers_support(
107-
ENABLE_SANITIZER_ADDRESS
108-
ENABLE_SANITIZER_UNDEFINED_BEHAVIOR
109-
ENABLE_SANITIZER_LEAK
110-
ENABLE_SANITIZER_THREAD
111-
ENABLE_SANITIZER_MEMORY
112-
ENABLE_SANITIZER_POINTER_COMPARE
113-
ENABLE_SANITIZER_POINTER_SUBTRACT
114-
)
115-
116-
if(ENABLE_SANITIZER_ADDRESS)
117-
set(SUPPORTS_ASAN ON)
118-
else()
119-
set(SUPPORTS_ASAN OFF)
120-
endif()
106+
# Fallback for ENABLE_SANITIZER_UNDEFINED_BEHAVIOR option
107+
foreach(default_type IN ITEMS DEFAULT DEVELOPER_DEFAULT USER_DEFAULT)
108+
if(DEFINED ENABLE_SANITIZER_UNDEFINED_BEHAVIOR_${default_type})
109+
if(DEFINED ENABLE_SANITIZER_UNDEFINED_${default_type})
110+
message(WARNING "Don't set both ENABLE_SANITIZER_UNDEFINED_BEHAVIOR_${default_type} and ENABLE_SANITIZER_UNDEFINED_${default_type}. Use ENABLE_SANITIZER_UNDEFINED_${default_type} only.")
111+
else()
112+
message(DEPRECATION "ENABLE_SANITIZER_UNDEFINED_BEHAVIOR_${default_type} is deprecated. Use ENABLE_SANITIZER_UNDEFINED_${default_type} instead.")
113+
endif()
121114

122-
if(ENABLE_SANITIZER_UNDEFINED_BEHAVIOR)
123-
set(SUPPORTS_UBSAN ON)
124-
else()
125-
set(SUPPORTS_UBSAN OFF)
126-
endif()
115+
set(ENABLE_SANITIZER_UNDEFINED_${default_type} ${ENABLE_SANITIZER_UNDEFINED_BEHAVIOR_${default_type}})
116+
endif()
117+
endforeach()
127118

128119
# ccache, clang-tidy, cppcheck are only supported with Ninja and Makefile based generators
129120
# note that it is possible to use Ninja with cl, so this still allows clang-tidy on Windows
@@ -163,9 +154,9 @@ macro(dynamic_project_options)
163154
"0\;DISABLE_RTTI\;OFF\;OFF\;Disable RTTI (no-rtti flag)"
164155
"0\;ENABLE_BUILD_WITH_TIME_TRACE\;OFF\;OFF\;Generates report of where compile-time is spent"
165156
"0\;ENABLE_UNITY\;OFF\;OFF\;Merge C++ files into larger C++ files, can speed up compilation sometimes"
166-
"0\;ENABLE_SANITIZER_ADDRESS\;OFF\;${SUPPORTS_ASAN}\;Make memory errors into hard runtime errors (windows/linux/macos)"
157+
"0\;ENABLE_SANITIZER_ADDRESS\;OFF\;ON\;Make memory errors into hard runtime errors (windows/linux/macos)"
167158
"0\;ENABLE_SANITIZER_LEAK\;OFF\;OFF\;Make memory leaks into hard runtime errors"
168-
"0\;ENABLE_SANITIZER_UNDEFINED_BEHAVIOR\;OFF\;${SUPPORTS_UBSAN}\;Make certain types (numeric mostly) of undefined behavior into runtime errors"
159+
"0\;ENABLE_SANITIZER_UNDEFINED\;OFF\;ON\;Make certain types (numeric mostly) of undefined behavior into runtime errors"
169160
"0\;ENABLE_SANITIZER_THREAD\;OFF\;OFF\;Make thread race conditions into hard runtime errors"
170161
"0\;ENABLE_SANITIZER_MEMORY\;OFF\;OFF\;Make other memory errors into runtime errors"
171162
"0\;ENABLE_CONTROL_FLOW_PROTECTION\;OFF\;OFF\;Enable control flow protection instrumentation"
@@ -277,7 +268,7 @@ macro(dynamic_project_options)
277268
${ENABLE_UNITY_VALUE}
278269
${ENABLE_SANITIZER_ADDRESS_VALUE}
279270
${ENABLE_SANITIZER_LEAK_VALUE}
280-
${ENABLE_SANITIZER_UNDEFINED_BEHAVIOR_VALUE}
271+
${ENABLE_SANITIZER_UNDEFINED_VALUE}
281272
${ENABLE_SANITIZER_THREAD_VALUE}
282273
${ENABLE_SANITIZER_MEMORY_VALUE}
283274
${ENABLE_CONTROL_FLOW_PROTECTION_VALUE}

src/Git.cmake

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -319,13 +319,16 @@ function(git_add_remote)
319319

320320
find_program(GIT_EXECUTABLE "git" REQUIRED)
321321

322-
# ensure that the given repository's remote is the current remote
322+
# Get the list of the remotes
323323
execute_process(
324324
COMMAND "${GIT_EXECUTABLE}" "remote" "-v" WORKING_DIRECTORY "${_fun_REPOSITORY_PATH}"
325325
COMMAND_ERROR_IS_FATAL LAST
326326
OUTPUT_VARIABLE _remote_output
327327
)
328-
string(FIND "${_remote_output}" "${_fun_REMOTE_URL}" _find_index)
328+
# Remove .git from the URL
329+
string(REGEX REPLACE "^(.*)\.git$" "\\1" _fun_REMOTE_URL_no_git "${_fun_REMOTE_URL}")
330+
# Check if the given remote already exists in the remote list
331+
string(FIND "${_remote_output}" "${_fun_REMOTE_URL_no_git}" _find_index)
329332

330333
# Add the given remote if it doesn't exist
331334
if(${_find_index} EQUAL -1)
@@ -343,12 +346,8 @@ function(git_add_remote)
343346
endif()
344347

345348
execute_process(
346-
COMMAND "${GIT_EXECUTABLE}" "remote" "add" "${_fun_REMOTE_NAME}" "${_fun_REMOTE_URL}"
347-
WORKING_DIRECTORY "${_fun_REPOSITORY_PATH}" COMMAND_ERROR_IS_FATAL LAST
348-
)
349-
execute_process(
350-
COMMAND "${GIT_EXECUTABLE}" "fetch" "${_fun_REMOTE_NAME}" WORKING_DIRECTORY "${_fun_REPOSITORY_PATH}"
351-
COMMAND_ERROR_IS_FATAL LAST
349+
COMMAND "${GIT_EXECUTABLE}" "remote" "add" "--fetch" "${_fun_REMOTE_NAME}" "${_fun_REMOTE_URL}"
350+
WORKING_DIRECTORY "${_fun_REPOSITORY_PATH}"
352351
)
353352
endif()
354353
endfunction()

src/Index.cmake

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ include("${ProjectOptions_SRC_DIR}/Vcpkg.cmake")
8282
those.
8383
- ``ENABLE_SANITIZER_ADDRESS``: Enable address sanitizer
8484
- ``ENABLE_SANITIZER_LEAK``: Enable leak sanitizer
85-
- ``ENABLE_SANITIZER_UNDEFINED_BEHAVIOR``: Enable undefined behavior
85+
- ``ENABLE_SANITIZER_UNDEFINED``: Enable undefined behavior
8686
sanitizer
8787
- ``ENABLE_SANITIZER_THREAD``: Enable thread sanitizer
8888
- ``ENABLE_SANITIZER_MEMORY``: Enable memory sanitizer
@@ -148,7 +148,8 @@ macro(project_options)
148148
ENABLE_UNITY
149149
ENABLE_SANITIZER_ADDRESS
150150
ENABLE_SANITIZER_LEAK
151-
ENABLE_SANITIZER_UNDEFINED_BEHAVIOR
151+
ENABLE_SANITIZER_UNDEFINED
152+
ENABLE_SANITIZER_UNDEFINED_BEHAVIOR # deprecated, ENABLE_SANITIZER_UNDEFINED
152153
ENABLE_SANITIZER_THREAD
153154
ENABLE_SANITIZER_MEMORY
154155
ENABLE_SANITIZER_POINTER_COMPARE
@@ -260,12 +261,23 @@ macro(project_options)
260261
enable_coverage(${_options_target})
261262
endif()
262263

264+
# Fallback for deprecated ENABLE_SANITIZER_UNDEFINED_BEHAVIOR
265+
if(ProjectOptions_ENABLE_SANITIZER_UNDEFINED_BEHAVIOR)
266+
if(ProjectOptions_ENABLE_SANITIZER_UNDEFINED)
267+
message(WARNING "Don't switch on both ENABLE_SANITIZER_UNDEFINED_BEHAVIOR and ENABLE_SANITIZER_UNDEFINED. Use ENABLE_SANITIZER_UNDEFINED only.")
268+
else()
269+
message(DEPRECATION "ENABLE_SANITIZER_UNDEFINED_BEHAVIOR is deprecated. Use ENABLE_SANITIZER_UNDEFINED instead.")
270+
endif()
271+
272+
set(ProjectOptions_ENABLE_SANITIZER_UNDEFINED ${ProjectOptions_ENABLE_SANITIZER_UNDEFINED_BEHAVIOR})
273+
endif()
274+
263275
# sanitizer options if supported by compiler
264276
enable_sanitizers(
265277
${_options_target}
266278
${ProjectOptions_ENABLE_SANITIZER_ADDRESS}
267279
${ProjectOptions_ENABLE_SANITIZER_LEAK}
268-
${ProjectOptions_ENABLE_SANITIZER_UNDEFINED_BEHAVIOR}
280+
${ProjectOptions_ENABLE_SANITIZER_UNDEFINED}
269281
${ProjectOptions_ENABLE_SANITIZER_THREAD}
270282
${ProjectOptions_ENABLE_SANITIZER_MEMORY}
271283
${ProjectOptions_ENABLE_SANITIZER_POINTER_COMPARE}

src/Sanitizers.cmake

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function(
88
_project_name
99
ENABLE_SANITIZER_ADDRESS
1010
ENABLE_SANITIZER_LEAK
11-
ENABLE_SANITIZER_UNDEFINED_BEHAVIOR
11+
ENABLE_SANITIZER_UNDEFINED
1212
ENABLE_SANITIZER_THREAD
1313
ENABLE_SANITIZER_MEMORY
1414
ENABLE_SANITIZER_POINTER_COMPARE
@@ -18,7 +18,7 @@ function(
1818
# check if the sanitizers are supported
1919
check_sanitizers_support(
2020
SUPPORTS_SANITIZER_ADDRESS
21-
SUPPORTS_SANITIZER_UNDEFINED_BEHAVIOR
21+
SUPPORTS_SANITIZER_UNDEFINED
2222
SUPPORTS_SANITIZER_LEAK
2323
SUPPORTS_SANITIZER_THREAD
2424
SUPPORTS_SANITIZER_MEMORY
@@ -38,8 +38,11 @@ function(
3838
"pointer-compare"
3939
"pointer-subtract"
4040
)
41-
if(${ENABLE_SANITIZER_${SANITIZER}})
42-
if(${SUPPORTS_SANITIZER_${SANITIZER}})
41+
set(SANITIZER_UPPERCASE "${SANITIZER}")
42+
string(TOUPPER ${SANITIZER} SANITIZER_UPPERCASE)
43+
44+
if(${ENABLE_SANITIZER_${SANITIZER_UPPERCASE}})
45+
if(${SUPPORTS_SANITIZER_${SANITIZER_UPPERCASE}})
4346
list(APPEND SANITIZERS ${SANITIZER})
4447
else()
4548
# do not enable the sanitizer if it is not supported
@@ -134,7 +137,7 @@ Note that some sanitizers cannot be enabled together, and this function doesn't
134137
Output variables:
135138
136139
- ``ENABLE_SANITIZER_ADDRESS``: Address sanitizer is supported
137-
- ``ENABLE_SANITIZER_UNDEFINED_BEHAVIOR``: Undefined behavior sanitizer is supported
140+
- ``ENABLE_SANITIZER_UNDEFINED``: Undefined behavior sanitizer is supported
138141
- ``ENABLE_SANITIZER_LEAK``: Leak sanitizer is supported
139142
- ``ENABLE_SANITIZER_THREAD``: Thread sanitizer is supported
140143
- ``ENABLE_SANITIZER_MEMORY``: Memory sanitizer is supported
@@ -145,7 +148,7 @@ Output variables:
145148
.. code:: cmake
146149
147150
check_sanitizers_support(ENABLE_SANITIZER_ADDRESS
148-
ENABLE_SANITIZER_UNDEFINED_BEHAVIOR
151+
ENABLE_SANITIZER_UNDEFINED
149152
ENABLE_SANITIZER_LEAK
150153
ENABLE_SANITIZER_THREAD
151154
ENABLE_SANITIZER_MEMORY
@@ -158,7 +161,7 @@ Output variables:
158161
function(
159162
check_sanitizers_support
160163
ENABLE_SANITIZER_ADDRESS
161-
ENABLE_SANITIZER_UNDEFINED_BEHAVIOR
164+
ENABLE_SANITIZER_UNDEFINED
162165
ENABLE_SANITIZER_LEAK
163166
ENABLE_SANITIZER_THREAD
164167
ENABLE_SANITIZER_MEMORY

src/Vcpkg.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ Or by specifying the options
170170
171171
run_vcpkg(
172172
VCPKG_URL "https://github.com/microsoft/vcpkg.git"
173-
VCPKG_REV "10e052511428d6b0c7fcc63a139e8024bb146032"
173+
VCPKG_REV "86a181505ac6460f98496a79abdee6a0f49905ec"
174174
ENABLE_VCPKG_UPDATE
175175
)
176176

0 commit comments

Comments
 (0)