Skip to content

Commit e11f7f8

Browse files
committed
Rebase with my develop
1 parent 0508115 commit e11f7f8

File tree

7 files changed

+64
-68
lines changed

7 files changed

+64
-68
lines changed

CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ myproject_local_options()
3838
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
3939

4040
set(GIT_SHA
41-
"Unknown"
41+
"0508115-dirty"
4242
CACHE STRING "SHA this build was generated from")
4343
string(
4444
SUBSTRING "${GIT_SHA}"
@@ -92,7 +92,10 @@ if(MSVC)
9292
endif()
9393

9494
# set the startup project for the "play" button in MSVC
95-
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT intro)
95+
if(TARGET intro)
96+
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT intro)
97+
set(VS_STARTUP_PROJECT intro)
98+
endif()
9699

97100
if(ENABLE_DOXYGEN)
98101
include(cmake/Doxygen.cmake)
@@ -109,7 +112,7 @@ include(cmake/PackageProject.cmake)
109112
# we know we want to ship
110113
myproject_package_project(
111114
TARGETS
112-
intro
115+
${VS_STARTUP_PROJECT}
113116
myproject_options
114117
myproject_warnings
115118
# FIXME: this does not work! CK

CMakePresets.json

Lines changed: 23 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@
211211
}
212212
}
213213
],
214-
"buildPresets":[
214+
"buildPresets": [
215215
{
216216
"name": "build-common",
217217
"description": "Build CMake settings that apply to all configurations",
@@ -239,24 +239,34 @@
239239
"configurePreset": "windows-clang-release"
240240
},
241241
{
242-
"name": "build-unixlike-gcc-debug",
243-
"inherits": "build-common",
244-
"configurePreset": "unixlike-gcc-debug"
242+
"name": "clang-release",
243+
"configurePreset": "clang-release"
245244
},
246245
{
247-
"name": "build-unixlike-gcc-release",
248-
"inherits": "build-common",
249-
"configurePreset": "unixlike-gcc-release"
246+
"name": "clang-install",
247+
"configurePreset": "clang-release",
248+
"targets": [
249+
"install"
250+
]
250251
},
251252
{
252-
"name": "build-unixlike-clang-debug",
253-
"inherits": "build-common",
254-
"configurePreset": "unixlike-clang-debug"
253+
"name": "clang-debug",
254+
"configurePreset": "clang-debug"
255255
},
256256
{
257-
"name": "build-unixlike-clang-release",
258-
"inherits": "build-common",
259-
"configurePreset": "unixlike-clang-release"
257+
"name": "gcc-release",
258+
"configurePreset": "gcc-release"
259+
},
260+
{
261+
"name": "gcc-install",
262+
"configurePreset": "gcc-release",
263+
"targets": [
264+
"install"
265+
]
266+
},
267+
{
268+
"name": "gcc-debug",
269+
"configurePreset": "gcc-debug"
260270
}
261271
],
262272
"testPresets": [
@@ -330,38 +340,6 @@
330340
"configurePreset": "clang-release"
331341
}
332342
],
333-
"buildPresets": [
334-
{
335-
"name": "clang-release",
336-
"configurePreset": "clang-release"
337-
},
338-
{
339-
"name": "clang-install",
340-
"configurePreset": "clang-release",
341-
"targets": [
342-
"install"
343-
]
344-
},
345-
{
346-
"name": "clang-debug",
347-
"configurePreset": "clang-debug"
348-
},
349-
{
350-
"name": "gcc-release",
351-
"configurePreset": "gcc-release"
352-
},
353-
{
354-
"name": "gcc-install",
355-
"configurePreset": "gcc-release",
356-
"targets": [
357-
"install"
358-
]
359-
},
360-
{
361-
"name": "gcc-debug",
362-
"configurePreset": "gcc-debug"
363-
}
364-
],
365343
"packagePresets": [
366344
{
367345
"name": "clang-release",

CMakeUserPresets.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,27 @@
1212
"generator": "Ninja",
1313
"cacheVariables": {
1414
"CMAKE_HOST_SYSTEM_PROCESSOR": "$penv{PROCESSOR_ARCHITECTURE}"
15+
},
16+
"environment": {
17+
"CPM_USE_LOCAL_PACKAGES": "1"
1518
}
1619
},
1720
{
1821
"name": "common-config",
1922
"description": "Settings for all toolchains",
2023
"hidden": true,
21-
"inherits": "default-config",
24+
"inherits": ["conf-unixlike-common", "default-config"],
2225
"binaryDir": "${sourceDir}/out/build/${presetName}",
2326
"installDir": "${sourceDir}/out/install/${presetName}",
2427
"cacheVariables": {
28+
"myproject_BUILD_FTXUI": false,
2529
"ENABLE_DOXYGEN": false,
2630
"ENABLE_CPPCHECK": false,
2731
"ENABLE_CLANG_TIDY": false
2832
},
33+
"environment": {
34+
"CPM_USE_LOCAL_PACKAGES": "0"
35+
},
2936
"vendor": {
3037
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": {
3138
"sourceDir": "$env{HOME}/.vs/$ms{projectDirName}"
@@ -36,7 +43,7 @@
3643
"name": "debug",
3744
"displayName": "Debug",
3845
"description": "Debug build type",
39-
"inherits": "conf-unixlike-common",
46+
"inherits": "common-config",
4047
"cacheVariables": {
4148
"CMAKE_SKIP_INSTALL_RULES": true,
4249
"CMAKE_BUILD_TYPE": "Debug",
@@ -47,7 +54,7 @@
4754
"name": "release",
4855
"displayName": "Release",
4956
"description": "Release build type",
50-
"inherits": "conf-unixlike-common",
57+
"inherits": "common-config",
5158
"cacheVariables": {
5259
"CMAKE_BUILD_TYPE": "Release",
5360
"ENABLE_DOXYGEN": true

Dependencies.cmake

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ function(myproject_setup_dependencies)
2828
cpmaddpackage("gh:catchorg/[email protected]")
2929
endif()
3030

31-
if(NOT TARGET CLI11::CLI11)
32-
cpmaddpackage("gh:CLIUtils/[email protected]")
33-
endif()
34-
35-
if(NOT TARGET ftxui::screen)
36-
cpmaddpackage("gh:ArthurSonzogni/[email protected]")
31+
if(myproject_BUILD_FTXUI)
32+
if(NOT TARGET CLI11::CLI11)
33+
cpmaddpackage("gh:CLIUtils/[email protected]")
34+
endif()
35+
36+
if(NOT TARGET ftxui::screen)
37+
cpmaddpackage("gh:ArthurSonzogni/[email protected]")
38+
endif()
3739
endif()
3840

3941
if(NOT TARGET tools::tools)

ProjectOptions.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ macro(myproject_setup_options)
122122
endif()
123123

124124
option(myproject_BUILD_FUZZ_TESTS "Enable fuzz testing executable" ${DEFAULT_FUZZER})
125+
option(myproject_BUILD_FTXUI "Build FTXUI sample too" ON)
125126

126127
endmacro()
127128

@@ -135,7 +136,7 @@ macro(myproject_global_options)
135136

136137
if(myproject_ENABLE_HARDENING AND myproject_ENABLE_GLOBAL_HARDENING)
137138
include(cmake/Hardening.cmake)
138-
if(NOT SUPPORTS_UBSAN
139+
if(NOT SUPPORTS_UBSAN
139140
OR myproject_ENABLE_SANITIZER_UNDEFINED
140141
OR myproject_ENABLE_SANITIZER_ADDRESS
141142
OR myproject_ENABLE_SANITIZER_THREAD
@@ -221,7 +222,7 @@ macro(myproject_local_options)
221222

222223
if(myproject_ENABLE_HARDENING AND NOT myproject_ENABLE_GLOBAL_HARDENING)
223224
include(cmake/Hardening.cmake)
224-
if(NOT SUPPORTS_UBSAN
225+
if(NOT SUPPORTS_UBSAN
225226
OR myproject_ENABLE_SANITIZER_UNDEFINED
226227
OR myproject_ENABLE_SANITIZER_ADDRESS
227228
OR myproject_ENABLE_SANITIZER_THREAD

src/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
add_subdirectory(sample_library)
2-
add_subdirectory(ftxui_sample)
2+
3+
if(myproject_BUILD_FTXUI)
4+
add_subdirectory(ftxui_sample)
5+
endif()

test/CMakeLists.txt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ else()
2424
endif()
2525

2626
# Provide a simple smoke test to make sure that the CLI works and can display a --help message
27-
add_test(NAME cli.has_help COMMAND intro --help)
28-
29-
# Provide a test to verify that the version being reported from the application
30-
# matches the version given to CMake. This will be important once you package
31-
# your program. Real world shows that this is the kind of simple mistake that is easy
32-
# to make, but also easy to test for.
33-
add_test(NAME cli.version_matches COMMAND intro --version)
34-
set_tests_properties(cli.version_matches PROPERTIES PASS_REGULAR_EXPRESSION "${PROJECT_VERSION}")
27+
if(TARGET intro)
28+
add_test(NAME cli.has_help COMMAND intro --help)
29+
30+
# Provide a test to verify that the version being reported from the application
31+
# matches the version given to CMake. This will be important once you package
32+
# your program. Real world shows that this is the kind of simple mistake that is easy
33+
# to make, but also easy to test for.
34+
add_test(NAME cli.version_matches COMMAND intro --version)
35+
set_tests_properties(cli.version_matches PROPERTIES PASS_REGULAR_EXPRESSION "${PROJECT_VERSION}")
36+
endif()
3537

3638
add_executable(tests tests.cpp)
3739
target_link_libraries(

0 commit comments

Comments
 (0)