forked from glynos/url
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Clean up repo, use CPM for dependency management #170
Merged
+363
−47
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,21 +4,25 @@ | |
# http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
|
||
cmake_minimum_required(VERSION 3.16) | ||
cmake_minimum_required(VERSION 3.21) | ||
|
||
get_directory_property(skyr_is_subproject PARENT_DIRECTORY) | ||
|
||
if(NOT skyr_is_subproject) | ||
set(skyr_IS_TOP_LEVEL_PROJECT YES) | ||
else() | ||
set(skyr_IS_TOP_LEVEL_PROJECT NO) | ||
endif() | ||
|
||
project( | ||
skyr-url | ||
VERSION 2.0.0 | ||
VERSION 2.0.1 | ||
HOMEPAGE_URL https://cpp-netlib.github.io/url | ||
DESCRIPTION "A C++ library that implements the WhatWG URL specification" | ||
LANGUAGES CXX | ||
) | ||
|
||
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) | ||
set(skyr_IS_TOP_LEVEL_PROJECT YES) | ||
else() | ||
set(skyr_IS_TOP_LEVEL_PROJECT NO) | ||
endif() | ||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") | ||
|
||
option(skyr_BUILD_TESTS "Build the URL tests." ON) | ||
option(skyr_BUILD_DOCS "Build the URL documentation." OFF) | ||
|
@@ -35,23 +39,41 @@ option(skyr_BUILD_V1 "Build v1" ON) | |
option(skyr_BUILD_V2 "Build v2, which uses C++20 features" OFF) | ||
|
||
if (skyr_IS_TOP_LEVEL_PROJECT) | ||
set(CMAKE_VERBOSE_MAKEFILE true) | ||
set(CMAKE_CXX_STANDARD 17) | ||
if (skyr_BUILD_V2) | ||
if(skyr_BUILD_V2) | ||
set(CMAKE_CXX_STANDARD 20) | ||
else() | ||
set(CMAKE_CXX_STANDARD 17) | ||
endif() | ||
|
||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
endif() | ||
|
||
find_package(tl-expected CONFIG REQUIRED) | ||
find_package(range-v3 CONFIG REQUIRED) | ||
include(skyr-url-options) | ||
include(skyr-url-env) | ||
include(skyr-url-flags) | ||
|
||
include(cmake/CPM.cmake) | ||
CPMAddPackage( | ||
NAME expected | ||
GITHUB_REPOSITORY TartanLlama/expected | ||
GIT_TAG v1.1.0 | ||
OPTIONS "EXPECTED_BUILD_TESTS OFF" #pulls is super old catch2 | ||
) | ||
CPMAddPackage("gh:ericniebler/range-v3#0.12.0") | ||
CPMAddPackage("gh:fmtlib/fmt#10.1.1") | ||
|
||
|
||
if (skyr_ENABLE_JSON_FUNCTIONS) | ||
find_package(nlohmann_json CONFIG REQUIRED) | ||
CPMAddPackage( | ||
NAME json | ||
GITHUB_REPOSITORY nlohmann/json | ||
GIT_TAG v3.11.3 | ||
OPTIONS "JSON_Install ON" | ||
) | ||
endif() | ||
|
||
if (skyr_USE_STATIC_CRT AND ${CMAKE_CXX_COMPILER_ID} MATCHES MSVC) | ||
if (skyr_USE_STATIC_CRT AND (SKY_CXX_COMPILER_CLANGCL OR SKY_CXX_COMPILER_MSVC)) | ||
include(${PROJECT_SOURCE_DIR}/cmake/skyr-url-functions.cmake) | ||
skyr_replace_dynamic_msvcrt_linker_flags() | ||
endif() | ||
|
@@ -61,30 +83,31 @@ set(warnings_as_errors $<BOOL:${skyr_WARNINGS_AS_ERRORS}>) | |
set(no_exceptions $<BOOL:${skyr_BUILD_WITHOUT_EXCEPTIONS}>) | ||
set(no_rtti $<BOOL:${skyr_BUILD_WITHOUT_RTTI}>) | ||
|
||
set(gnu $<CXX_COMPILER_ID:GNU>) | ||
set(clang $<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>) | ||
set(gnu $<BOOL:${SKY_CXX_COMPILER_GCC}>) | ||
set(clang $<BOOL:${SKY_CXX_COMPILER_CLANG}>) | ||
set(libcxx $<AND:${clang},$<BOOL:${skyr_BUILD_WITH_LLVM_LIBCXX}>>) | ||
set(clang_with_gnu_stdlib $<AND:$<CXX_COMPILER_ID:Clang>,$<NOT:$<BOOL:${WIN32}>>,$<NOT:$<BOOL:${skyr_BUILD_WITH_LLVM_LIBCXX}>>>) | ||
set(msvc $<CXX_COMPILER_ID:MSVC>) | ||
set(clang_with_gnu_stdlib $<AND:${clang},$<NOT:$<BOOL:${skyr_BUILD_WITH_LLVM_LIBCXX}>>>) | ||
set(msvc $<BOOL:${SKY_CXX_COMPILER_MSVC}>) | ||
|
||
add_subdirectory(src) | ||
|
||
# Testing | ||
if (skyr_BUILD_TESTS) | ||
message(STATUS "Configuring tests") | ||
message(STATUS "[skyr-url] Configuring tests") | ||
CPMAddPackage("gh:catchorg/[email protected]") | ||
enable_testing() | ||
add_subdirectory(tests) | ||
endif() | ||
|
||
# Documentation | ||
if (skyr_BUILD_DOCS) | ||
message(STATUS "Configuring documentation") | ||
message(STATUS "[skyr-url] Configuring documentation") | ||
add_subdirectory(docs) | ||
endif() | ||
|
||
# Examples | ||
if (skyr_BUILD_EXAMPLES) | ||
message(STATUS "Configuring examples") | ||
message(STATUS "[skyr-url] Configuring examples") | ||
add_subdirectory(examples) | ||
endif() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# SPDX-License-Identifier: MIT | ||
# | ||
# SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors | ||
|
||
set(CPM_DOWNLOAD_VERSION 0.38.7) | ||
set(CPM_HASH_SUM "83e5eb71b2bbb8b1f2ad38f1950287a057624e385c238f6087f94cdfc44af9c5") | ||
|
||
if(CPM_SOURCE_CACHE) | ||
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
elseif(DEFINED ENV{CPM_SOURCE_CACHE}) | ||
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
else() | ||
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
endif() | ||
|
||
# Expand relative path. This is important if the provided path contains a tilde (~) | ||
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE) | ||
|
||
file(DOWNLOAD | ||
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake | ||
${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM} | ||
) | ||
|
||
include(${CPM_DOWNLOAD_LOCATION}) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should that be "skyr_VERBOSE_BUILD"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the new variables I put in has prefix SKY, but that doesn't seem to be consistent with everything else. Should probably be changed.