Skip to content

Commit 51407a4

Browse files
committed
Enhance CMake configuration and remove deprecated files
- Added support for cpp-library version 5.2.0 using CPM. - Introduced a base preset in CMakePresets.json to streamline configuration. - Generated adobe/config.hpp from the project version, ensuring it reflects the current build. - Removed obsolete files: adobe/config.hpp, various Boost patch files, and Sublime project files. - Cleaned up CMakeLists.txt to improve organization and clarity.
1 parent 4f428eb commit 51407a4

12 files changed

Lines changed: 63 additions & 890 deletions

CMakeLists.txt

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
cmake_minimum_required(VERSION 3.29)
2+
include(cmake/CPM.cmake)
3+
4+
# Add cpp-library for set version
5+
# CPMAddPackage(
6+
# NAME cpp-library
7+
# SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../cpp-library"
8+
# )
9+
CPMAddPackage("gh:stlab/cpp-library@5.2.0")
10+
include(${cpp-library_SOURCE_DIR}/cpp-library.cmake)
11+
212
project(adobe-source-libraries CXX)
13+
14+
cpp_library_set_version()
15+
16+
################################################################################
17+
318
include(FindGit)
419
include(CMakeParseArguments)
520

@@ -11,13 +26,6 @@ if(WIN32)
1126
set(CMAKE_OBJECT_PATH_MAX 500)
1227
endif()
1328

14-
################################################################################
15-
16-
# Enable CPM caching to avoid re-downloading dependencies. Must be before CPM.cmake include.
17-
set(CPM_SOURCE_CACHE ${CMAKE_SOURCE_DIR}/.cache/cpm CACHE PATH "Directory to cache CPM packages" FORCE)
18-
19-
include(cmake/CPM.cmake)
20-
2129
################################################################################
2230
# Dependencies
2331

@@ -39,16 +47,6 @@ endif(NOT DEFINED CMAKE_CXX_STANDARD)
3947

4048
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
4149

42-
# Create symlink to compile_commands.json for clangd
43-
if(CMAKE_EXPORT_COMPILE_COMMANDS AND PROJECT_IS_TOP_LEVEL)
44-
add_custom_target(clangd_compile_commands ALL
45-
COMMAND ${CMAKE_COMMAND} -E create_symlink
46-
${CMAKE_BINARY_DIR}/compile_commands.json
47-
${CMAKE_SOURCE_DIR}/compile_commands.json
48-
COMMENT "Creating symlink to compile_commands.json for clangd"
49-
)
50-
endif()
51-
5250
# https://github.com/boostorg/boost/releases
5351
CPMAddPackage(
5452
NAME Boost
@@ -104,7 +102,6 @@ if(BUILD_DOCS)
104102
# Set variables for Doxyfile template
105103
set(PROJECT_NAME "Adobe Source Libraries")
106104
set(PROJECT_BRIEF "A collection of C++ libraries.")
107-
set(PROJECT_VERSION "2.0.2")
108105
set(INPUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
109106
set(OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")
110107
set(AWESOME_CSS_PATH "${AWESOME_CSS_DIR}")

CMakePresets.json

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
{
22
"version": 3,
33
"configurePresets": [
4+
{
5+
"name": "base",
6+
"displayName": "base",
7+
"description": "Base configuration",
8+
"cacheVariables": {
9+
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
10+
"CPM_SOURCE_CACHE": "${sourceDir}/.cache/cpm"
11+
}
12+
},
413
{
514
"name": "debug",
15+
"inherits": "base",
616
"displayName": "debug-windows",
717
"description": "Sets Ninja generator, build and install directory",
818
"generator": "Ninja",
@@ -26,6 +36,7 @@
2636
},
2737
{
2838
"name": "debug-windows-cpp17",
39+
"inherits": "base",
2940
"displayName": "windows-debug-C++17",
3041
"description": "Sets Ninja generator, build and install directory",
3142
"generator": "Ninja",
@@ -49,6 +60,7 @@
4960
},
5061
{
5162
"name": "macos-debug-C++20",
63+
"inherits": "base",
5264
"displayName": "macos-debug-C++20",
5365
"description": "Sets Ninja generator, build and install directory",
5466
"generator": "Ninja",
@@ -68,6 +80,7 @@
6880
},
6981
{
7082
"name": "macos-debug-C++17",
83+
"inherits": "base",
7184
"displayName": "macos-debug-C++17",
7285
"description": "Sets Ninja generator, build and install directory",
7386
"generator": "Ninja",
@@ -79,6 +92,7 @@
7992
},
8093
{
8194
"name": "clang-tidy-base",
95+
"inherits": "base",
8296
"hidden": true,
8397
"generator": "Ninja",
8498
"binaryDir": "${sourceParentDir}/build/asl-${presetName}",
@@ -107,18 +121,19 @@
107121
},
108122
{
109123
"name": "clang-tidy-fix",
124+
"inherits": "base",
110125
"hidden": false,
111126
"generator": "Ninja",
112127
"binaryDir": "${sourceParentDir}/build/asl-${presetName}",
113128
"cacheVariables": {
114129
"CMAKE_CXX_STANDARD": "17",
115130
"CMAKE_BUILD_TYPE": "DEBUG",
116-
"CMAKE_CXX_CLANG_TIDY":
117-
"clang-tidy;--fix;--allow-no-checks;--extra-arg=/EHsc;--extra-arg=/DNOMINMAX"
131+
"CMAKE_CXX_CLANG_TIDY": "clang-tidy;--fix;--allow-no-checks;--extra-arg=/EHsc;--extra-arg=/DNOMINMAX"
118132
}
119133
},
120134
{
121135
"name": "clang-tidy-nofix",
136+
"inherits": "base",
122137
"hidden": false,
123138
"generator": "Ninja",
124139
"binaryDir": "${sourceParentDir}/build/asl-${presetName}",
@@ -135,19 +150,21 @@
135150
}
136151
},
137152
{
138-
"name": "test",
139-
"displayName": "Test Configuration",
140-
"description": "Configuration for building and running tests",
141-
"binaryDir": "${sourceDir}/build/test",
142-
"generator": "Ninja",
143-
"cacheVariables": {
153+
"name": "test",
154+
"inherits": "base",
155+
"displayName": "Test Configuration",
156+
"description": "Configuration for building and running tests",
157+
"binaryDir": "${sourceDir}/build/test",
158+
"generator": "Ninja",
159+
"cacheVariables": {
144160
"CMAKE_BUILD_TYPE": "Debug",
145161
"BUILD_TESTING": "ON",
146162
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
147163
}
148164
},
149165
{
150166
"name": "docs",
167+
"inherits": "base",
151168
"displayName": "Documentation Configuration",
152169
"description": "Configuration for building documentation",
153170
"binaryDir": "${sourceDir}/build/docs",
@@ -165,11 +182,11 @@
165182
"configurePreset": "debug"
166183
},
167184
{
168-
"name": "docs",
169-
"displayName": "Build Documentation",
170-
"description": "Build the documentation",
171-
"configurePreset": "docs",
172-
"targets": "docs"
185+
"name": "docs",
186+
"displayName": "Build Documentation",
187+
"description": "Build the documentation",
188+
"configurePreset": "docs",
189+
"targets": "docs"
173190
}
174191
],
175192
"testPresets": [
@@ -183,4 +200,4 @@
183200
}
184201
}
185202
]
186-
}
203+
}

adobe/config.hpp renamed to adobe/config.hpp.in

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@
2323
ADOBE_VERSION % 100 is the sub-minor version
2424
ADOBE_VERSION / 100 % 1000 is the minor version
2525
ADOBE_VERSION / 100000 is the major version
26+
27+
Version is generated by CMake from the project version (set by cpp_library_set_version).
2628
*/
2729

28-
#define ADOBE_VERSION_MAJOR 1
29-
#define ADOBE_VERSION_MINOR 0
30-
#define ADOBE_VERSION_SUBMINOR 46
30+
#define ADOBE_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
31+
#define ADOBE_VERSION_MINOR @PROJECT_VERSION_MINOR@
32+
#define ADOBE_VERSION_SUBMINOR @PROJECT_VERSION_PATCH@
3133

3234
#define ADOBE_VERSION \
3335
(ADOBE_VERSION_MAJOR * 100000 + ADOBE_VERSION_MINOR * 100 + ADOBE_VERSION_SUBMINOR)

source/CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
1+
# Generate adobe/config.hpp from CMake project version (set by cpp_library_set_version)
2+
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/adobe")
3+
configure_file(
4+
"${PROJECT_SOURCE_DIR}/adobe/config.hpp.in"
5+
"${PROJECT_BINARY_DIR}/adobe/config.hpp"
6+
@ONLY
7+
)
8+
19
aux_source_directory(. SRC_LIST)
210
file(GLOB_RECURSE INC_LIST ../adobe/*.hpp)
311
add_library(asl ${SRC_LIST} ${INC_LIST})
412

5-
target_include_directories(asl PUBLIC ..)
13+
# Binary dir first so generated config.hpp is used; .. is project root for other adobe headers
14+
target_include_directories(asl PUBLIC
15+
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
16+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>)
617
target_compile_definitions(asl PUBLIC ADOBE_STD_SERIALIZATION)
718

819
# otherwise boost concept checking fails on adobe::selection_t because it lacks non const begin/end

tools/asl.sublime-project

Lines changed: 0 additions & 26 deletions
This file was deleted.

tools/boost.sublime-project

Lines changed: 0 additions & 26 deletions
This file was deleted.

tools/boost_1_36_0_patches.txt

Lines changed: 0 additions & 99 deletions
This file was deleted.

0 commit comments

Comments
 (0)