FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cppgraphqlgen/CMakeLists.txt at next · wravery/cppgraphqlgen · GitHub
wravery
/
cppgraphqlgen
Public
forked from
microsoft/cppgraphqlgen
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cppgraphqlgen
/
CMakeLists.txt
Copy path
More file actions
More file actions
Latest commit
History
History
History
142 lines (113 loc) · 5.2 KB
Breadcrumbs
cppgraphqlgen
/
CMakeLists.txt
Copy path
File metadata and controls
142 lines (113 loc) · 5.2 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#
Copyright (c) Microsoft Corporation. All rights reserved.
#
Licensed under the MIT License.
cmake_minimum_required
(
VERSION
3.28
)
if
(
POLICY
CMP0167)
#
Prefer the upstream BoostConfig.cmake file instead of the builtin FindBoost module: https://cmake.org/cmake/help/latest/policy/CMP0167.html
cmake_policy
(
SET
CMP0167
NEW
)
endif
()
#
Export compile commands for other tools, e.g. SonarLint.
set
(
CMAKE_EXPORT_COMPILE_COMMANDS
ON
)
#
Default to the last updated version from version.txt.
file
(
TO_CMAKE_PATH
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/version.txt"
VERSION_FILE
)
file
(
READ
"
${VERSION_FILE}
"
LATEST_VERSION
)
if
(
IS_DIRECTORY
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/.git"
)
#
Get the latest release tag from git if possible.
execute_process
(
COMMAND
git
describe
--tags
--long
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
OUTPUT_VARIABLE
LATEST_VERSION_TAG
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if
(LATEST_VERSION_TAG
MATCHES
"^v([0-9]+
\\
.[0-9]+
\\
.[0-9]+)-[0-9]+-[0-9a-z]+$"
AND
CMAKE_MATCH_1
VERSION_GREATER
LATEST_VERSION)
#
The latest tag matched the pattern we expected and it's newer, so use that as the latest version.
set
(LATEST_VERSION
"
${CMAKE_MATCH_1}
"
)
#
Update version.txt so source archives without the release tags still get the same version.
file
(
WRITE
"
${VERSION_FILE}
"
"
${LATEST_VERSION}
"
)
endif
()
endif
()
option
(
GRAPHQL_BUILD_MODULES
"Build the C++20 module interface libraries."
ON
)
option
(
GRAPHQL_BUILD_SCHEMAGEN
"Build the schemagen tool."
ON
)
option
(
GRAPHQL_BUILD_CLIENTGEN
"Build the clientgen tool."
ON
)
option
(
GRAPHQL_BUILD_TESTS
"Build the tests and sample schema library."
ON
)
option
(
GRAPHQL_USE_TAOCPP_JSON
"Use taocpp-json for JSON serialization."
ON
)
if
(GRAPHQL_BUILD_SCHEMAGEN)
list
(
APPEND
VCPKG_MANIFEST_FEATURES
"schemagen"
)
endif
()
if
(GRAPHQL_BUILD_CLIENTGEN)
list
(
APPEND
VCPKG_MANIFEST_FEATURES
"clientgen"
)
endif
()
if
(GRAPHQL_BUILD_TESTS)
list
(
APPEND
VCPKG_MANIFEST_FEATURES
"tests"
)
endif
()
if
(GRAPHQL_USE_TAOCPP_JSON)
list
(
APPEND
VCPKG_MANIFEST_FEATURES
"taocpp-json"
)
else
()
option
(
GRAPHQL_USE_RAPIDJSON
"Use RapidJSON for JSON serialization."
ON
)
if
(GRAPHQL_USE_RAPIDJSON)
list
(
APPEND
VCPKG_MANIFEST_FEATURES
"rapidjson"
)
endif
()
endif
()
if
(GRAPHQL_BUILD_SCHEMAGEN
AND
GRAPHQL_BUILD_CLIENTGEN)
option
(
GRAPHQL_UPDATE_SAMPLES
"Regenerate the sample schema sources whether or not we're building the tests."
ON
)
if
(GRAPHQL_UPDATE_SAMPLES)
list
(
APPEND
VCPKG_MANIFEST_FEATURES
"update-samples"
)
option
(
GRAPHQL_BUILD_HTTP_SAMPLE
"Build the HTTP client sample using C++20 coroutines with Boost.Beast/Boost.Asio."
ON
)
if
(GRAPHQL_BUILD_HTTP_SAMPLE)
list
(
APPEND
VCPKG_MANIFEST_FEATURES
"http-sample"
)
endif
()
endif
()
else
()
set
(GRAPHQL_UPDATE_SAMPLES
OFF
CACHE
BOOL
"Disable regenerating samples."
FORCE
)
set
(GRAPHQL_BUILD_HTTP_SAMPLE
OFF
CACHE
BOOL
"Disable regenerating samples."
FORCE
)
endif
()
project
(cppgraphqlgen
VERSION
${LATEST_VERSION}
)
set
(GRAPHQL_INSTALL_INCLUDE_DIR include
CACHE
PATH
"Header file install directory"
)
set
(GRAPHQL_INSTALL_TOOLS_DIR bin
CACHE
PATH
"schemagen install directory"
)
set
(GRAPHQL_INSTALL_CMAKE_DIR lib/cmake
CACHE
PATH
"CMake config files install directory"
)
set
(GRAPHQL_INSTALL_CONFIGURATIONS
${
CMAKE_CONFIGURATION_TYPES
}
CACHE
STRING
"Configurations which perform a full install"
)
option
(
BUILD_SHARED_LIBS
"Build shared libraries instead of static libs"
OFF
)
if
(VCPKG_TARGET_TRIPLET)
message
(
STATUS
"Using
${VCPKG_TARGET_TRIPLET}
triplet with vcpkg"
)
if
(
MSVC
)
#
Match the MSVC runtime if we're using VCPKG with static libraries.
if
(VCPKG_TARGET_TRIPLET
MATCHES
[[
^.+-static$
]]
)
set
(
CMAKE_MSVC_RUNTIME_LIBRARY
"MultiThreaded$<$<
CONFIG
:
Debug
>:
Debug
>"
)
message
(
STATUS
"Using MSVC runtime static library"
)
else
()
set
(
CMAKE_MSVC_RUNTIME_LIBRARY
"MultiThreaded$<$<
CONFIG
:
Debug
>:
Debug
>DLL"
)
message
(
STATUS
"Using MSVC runtime DLL"
)
endif
()
endif
()
endif
()
#
Enable more warnings, and treat warnings as errors.
if
(
MSVC
)
add_compile_options
(
/W4
/WX
/permissive-
)
else
()
add_compile_options
(
-Wall
-Wextra
-pedantic
-Werror
)
endif
()
function
(
add_bigobj_flag
target
)
if
(
MSVC
)
#
MSVC requires the /bigobj flag if the number of sections gets too big.
target_compile_options
(
${target}
PRIVATE
/bigobj
)
endif
()
endfunction
()
find_package
(
Threads
MODULE
REQUIRED
)
find_package
(
pegtl
3.2.7
QUIET
CONFIG
)
if
(
NOT
pegtl_FOUND)
#
If a compatible version of PEGTL is not already installed, build and install it from the submodule directory.
set
(PEGTL_BUILD_TESTS
OFF
CACHE
BOOL
"Disable PEGTL tests"
)
set
(PEGTL_BUILD_EXAMPLES
OFF
CACHE
BOOL
"Disable PEGTL examples"
)
set
(PEGTL_INSTALL_INCLUDE_DIR
${GRAPHQL_INSTALL_INCLUDE_DIR}
CACHE
STRING
"Override PEGTL include install directory"
)
set
(PEGTL_INSTALL_CMAKE_DIR
${GRAPHQL_INSTALL_CMAKE_DIR}
/pegtl
CACHE
STRING
"Override PEGTL cmake install directory"
)
add_subdirectory
(
PEGTL
)
endif
()
option
(
GRAPHQL_UPDATE_VERSION
"Regenerate graphqlservice/internal/Version.h and all of the version info rc files for Windows."
ON
)
add_subdirectory
(
cmake
)
add_subdirectory
(
src
)
if
(GRAPHQL_BUILD_TESTS
OR
GRAPHQL_UPDATE_SAMPLES)
add_subdirectory
(
samples
)
if
(GRAPHQL_BUILD_TESTS)
include
(
CTest
)
add_subdirectory
(
test
)
endif
()
endif
()
Back
|
FazBrowse Home
|
New Git URL