Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project improvements #143

Merged
merged 4 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on: [push, pull_request]

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

steps:
Expand All @@ -27,6 +29,8 @@ jobs:
exit 1

editorconfig:
# Skip building pull requests from the same repository
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
runs-on: ubuntu-latest

steps:
Expand Down
3 changes: 1 addition & 2 deletions CMakeLists.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions cmake.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,8 @@ link-libraries = [
"ghc_filesystem",
"mpark_variant",
"ordered_map",
"nlohmann_json",
]
cmake-after = """
generate_resources(${CMKR_TARGET})
"""
include-after = ["cmake/custom_targets.cmake"]

[[install]]
targets = ["cmkr"]
Expand Down
18 changes: 18 additions & 0 deletions cmake/custom_targets.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
generate_resources(cmkr)

add_custom_target(regenerate-cmake
COMMAND "$<TARGET_FILE:cmkr>" gen
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
)

if(CMAKE_CONFIGURATION_TYPES)
add_custom_target(run-tests
COMMAND "${CMAKE_CTEST_COMMAND}" -C $<CONFIG>
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/tests"
)
else()
add_custom_target(run-tests
COMMAND "${CMAKE_CTEST_COMMAND}"
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/tests"
)
endif()
5 changes: 4 additions & 1 deletion src/cmake_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,10 @@ static std::string vcpkg_escape_identifier(const std::string &name) {
ch = '-';
}

escaped += std::tolower(ch);
if (ch >= 'A' && ch <= 'Z') {
ch += ('a' - 'A');
}
escaped += ch;
}
if (!vcpkg_valid_identifier(escaped)) {
throw std::runtime_error("The escaped project name '" + escaped + "' is not usable with [vcpkg]");
Expand Down
10 changes: 7 additions & 3 deletions src/project_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,8 @@ Project::Project(const Project *parent, const std::string &path, bool build) : p
if (ch == '_') {
normalized += '-';
} else if (ch >= 'A' && ch <= 'Z') {
normalized += std::tolower(ch);
ch += ('a' - 'A');
normalized += ch;
} else if (ch == '-' || (ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z')) {
normalized += ch;
} else {
Expand Down Expand Up @@ -532,8 +533,11 @@ Project::Project(const Project *parent, const std::string &path, bool build) : p
key = "URL";
} else if (hash_algorithms.contains(key)) {
std::string algo;
for (auto c : key) {
algo.push_back(std::toupper(c));
for (auto ch : key) {
if (ch >= 'a' && ch <= 'z') {
ch -= ('a' - 'A');
}
algo.push_back(ch);
}
key = "URL_HASH";
value = algo + "=" + value;
Expand Down
4 changes: 0 additions & 4 deletions third_party/CMakeLists.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 0 additions & 21 deletions third_party/nlohmann-3.9.1/LICENSE

This file was deleted.

Loading
Loading