Skip to content

Commit 714a666

Browse files
authored
Merge pull request #143 from build-cpp/project-improvements
Project improvements
2 parents 6bffa7c + d613e43 commit 714a666

File tree

9 files changed

+35
-25482
lines changed

9 files changed

+35
-25482
lines changed

.github/workflows/lint.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on: [push, pull_request]
44

55
jobs:
66
clang-format:
7+
# Skip building pull requests from the same repository
8+
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
79
runs-on: ubuntu-latest
810

911
steps:
@@ -27,6 +29,8 @@ jobs:
2729
exit 1
2830
2931
editorconfig:
32+
# Skip building pull requests from the same repository
33+
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
3034
runs-on: ubuntu-latest
3135

3236
steps:

CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmake.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,8 @@ link-libraries = [
3636
"ghc_filesystem",
3737
"mpark_variant",
3838
"ordered_map",
39-
"nlohmann_json",
4039
]
41-
cmake-after = """
42-
generate_resources(${CMKR_TARGET})
43-
"""
40+
include-after = ["cmake/custom_targets.cmake"]
4441

4542
[[install]]
4643
targets = ["cmkr"]

cmake/custom_targets.cmake

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
generate_resources(cmkr)
2+
3+
add_custom_target(regenerate-cmake
4+
COMMAND "$<TARGET_FILE:cmkr>" gen
5+
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
6+
)
7+
8+
if(CMAKE_CONFIGURATION_TYPES)
9+
add_custom_target(run-tests
10+
COMMAND "${CMAKE_CTEST_COMMAND}" -C $<CONFIG>
11+
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/tests"
12+
)
13+
else()
14+
add_custom_target(run-tests
15+
COMMAND "${CMAKE_CTEST_COMMAND}"
16+
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/tests"
17+
)
18+
endif()

src/cmake_generator.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,10 @@ static std::string vcpkg_escape_identifier(const std::string &name) {
681681
ch = '-';
682682
}
683683

684-
escaped += std::tolower(ch);
684+
if (ch >= 'A' && ch <= 'Z') {
685+
ch += ('a' - 'A');
686+
}
687+
escaped += ch;
685688
}
686689
if (!vcpkg_valid_identifier(escaped)) {
687690
throw std::runtime_error("The escaped project name '" + escaped + "' is not usable with [vcpkg]");

src/project_parser.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ Project::Project(const Project *parent, const std::string &path, bool build) : p
381381
if (ch == '_') {
382382
normalized += '-';
383383
} else if (ch >= 'A' && ch <= 'Z') {
384-
normalized += std::tolower(ch);
384+
ch += ('a' - 'A');
385+
normalized += ch;
385386
} else if (ch == '-' || (ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z')) {
386387
normalized += ch;
387388
} else {
@@ -532,8 +533,11 @@ Project::Project(const Project *parent, const std::string &path, bool build) : p
532533
key = "URL";
533534
} else if (hash_algorithms.contains(key)) {
534535
std::string algo;
535-
for (auto c : key) {
536-
algo.push_back(std::toupper(c));
536+
for (auto ch : key) {
537+
if (ch >= 'a' && ch <= 'z') {
538+
ch -= ('a' - 'A');
539+
}
540+
algo.push_back(ch);
537541
}
538542
key = "URL_HASH";
539543
value = algo + "=" + value;

third_party/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

third_party/nlohmann-3.9.1/LICENSE

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

0 commit comments

Comments
 (0)