Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Commit ab88fb7

Browse files
committed
cmake-format
1 parent 8af1567 commit ab88fb7

File tree

7 files changed

+185
-175
lines changed

7 files changed

+185
-175
lines changed

CMakeLists.txt

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
cmake_minimum_required(VERSION 3.7)
22

3-
43
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
54
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
65

7-
ENABLE_LANGUAGE(CXX)
6+
enable_language(CXX)
87
set(CMAKE_CXX_STANDARD_REQUIRED ON)
98
set(CMAKE_CXX_STANDARD 14)
109
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
@@ -16,30 +15,27 @@ include(ThreadSanitizer)
1615
include(UndefinedSanitizer)
1716
include(RemoveFlags)
1817

19-
HunterGate(
20-
URL "https://github.com/ruslo/hunter/archive/v0.23.54.tar.gz"
21-
SHA1 "64ae727ebaec586c84da5d69e5c37b5962baccd6"
22-
FILEPATH "${CMAKE_CURRENT_LIST_DIR}/cmake/config.cmake"
23-
)
18+
huntergate(URL
19+
"https://github.com/ruslo/hunter/archive/v0.23.54.tar.gz"
20+
SHA1
21+
"64ae727ebaec586c84da5d69e5c37b5962baccd6"
22+
FILEPATH
23+
"${CMAKE_CURRENT_LIST_DIR}/cmake/config.cmake")
2424

2525
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
2626

2727
# extract project version from git tag
28-
execute_process(
29-
COMMAND git describe --tags
30-
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
31-
OUTPUT_VARIABLE GIT_FULL_VERSION
32-
OUTPUT_STRIP_TRAILING_WHITESPACE
33-
)
34-
# cmake project version must be major.minor.patch with all
35-
# integers. GIT_FULL_VERSION is accurate even for branch not tagged
36-
# the format of GIT_FULL_VERSION is v1.2.3-gsha1 or v1.2.3
37-
execute_process(
38-
COMMAND echo ${GIT_FULL_VERSION}
39-
COMMAND grep -o "[0-9][0-9]*\\.[0-9][0-9]*\\.[0-9][0-9]*"
40-
OUTPUT_VARIABLE GIT_LAST_VERSION
41-
OUTPUT_STRIP_TRAILING_WHITESPACE
42-
)
28+
execute_process(COMMAND git describe --tags
29+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
30+
OUTPUT_VARIABLE GIT_FULL_VERSION
31+
OUTPUT_STRIP_TRAILING_WHITESPACE)
32+
# cmake project version must be major.minor.patch with all integers.
33+
# GIT_FULL_VERSION is accurate even for branch not tagged the format of
34+
# GIT_FULL_VERSION is v1.2.3-gsha1 or v1.2.3
35+
execute_process(COMMAND echo ${GIT_FULL_VERSION}
36+
COMMAND grep -o "[0-9][0-9]*\\.[0-9][0-9]*\\.[0-9][0-9]*"
37+
OUTPUT_VARIABLE GIT_LAST_VERSION
38+
OUTPUT_STRIP_TRAILING_WHITESPACE)
4339

4440
project(task-maker VERSION ${GIT_LAST_VERSION})
4541

@@ -50,7 +46,7 @@ include(GoogleTest)
5046
find_package(PythonInterp 3.5 REQUIRED)
5147

5248
# Enable colors in ninja
53-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always")
49+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always")
5450
# Other flags
5551
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter -g")
5652
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
@@ -63,7 +59,8 @@ hunter_add_package(pybind11)
6359
# these finders are bundled with cmake
6460
find_package(GTest REQUIRED)
6561

66-
# these finders are provided by hunter, when hunter is disabled the ones in cmake are used
62+
# these finders are provided by hunter, when hunter is disabled the ones in
63+
# cmake are used
6764
find_package(CapnProto CONFIG REQUIRED)
6865
find_package(GMock CONFIG REQUIRED)
6966
find_package(pybind11 CONFIG REQUIRED)

capnp/CMakeLists.txt

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
capnp_generate_cpp(CAPNP_SOURCES CAPNP_HEADERS
2-
sha256.capnp
3-
file.capnp
4-
evaluation.capnp
5-
server.capnp
6-
cache.capnp
7-
)
1+
capnp_generate_cpp(CAPNP_SOURCES
2+
CAPNP_HEADERS
3+
sha256.capnp
4+
file.capnp
5+
evaluation.capnp
6+
server.capnp
7+
cache.capnp)
88

9-
add_library(
10-
capnp_cpp
11-
${CAPNP_SOURCES}
12-
)
9+
add_library(capnp_cpp ${CAPNP_SOURCES})
1310

1411
target_link_libraries(capnp_cpp PUBLIC CapnProto::capnp-rpc)
1512
target_include_directories(capnp_cpp PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/..)

cpp/CMakeLists.txt

Lines changed: 48 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,24 @@ add_subdirectory(sandbox/test)
33
add_subdirectory(frontend)
44

55
add_library(cpp_util
6-
util/file.cpp
7-
util/sha256.cpp
8-
util/which.cpp
9-
util/flags.cpp
10-
util/union_promise.cpp
11-
util/misc.cpp
12-
util/log_manager.cpp
13-
util/daemon.cpp
14-
)
6+
util/file.cpp
7+
util/sha256.cpp
8+
util/which.cpp
9+
util/flags.cpp
10+
util/union_promise.cpp
11+
util/misc.cpp
12+
util/log_manager.cpp
13+
util/daemon.cpp)
1514
target_include_directories(cpp_util PUBLIC .)
1615
target_link_libraries(cpp_util
17-
backward
18-
capnp_cpp
19-
CapnProto::kj
20-
CapnProto::kj-async
21-
CapnProto::capnp
22-
CapnProto::capnp-rpc
23-
)
16+
backward
17+
capnp_cpp
18+
CapnProto::kj
19+
CapnProto::kj-async
20+
CapnProto::capnp
21+
CapnProto::capnp-rpc)
2422
# this flag is needed on travis
25-
if (TRAVIS)
23+
if(TRAVIS)
2624
target_compile_definitions(cpp_util PRIVATE REMOVE_ALSO_MOUNT_POINTS=1)
2725
endif()
2826
add_executable(union_promise_test util/union_promise_test.cpp)
@@ -32,87 +30,60 @@ target_link_libraries(file_test cpp_util GTest::Main GMock::gmock)
3230
add_executable(misc_test util/misc_test.cpp)
3331
target_link_libraries(misc_test cpp_util GTest::Main GMock::gmock)
3432

35-
add_library(cpp_sandbox
36-
sandbox/sandbox.cpp
37-
sandbox/main.cpp
38-
)
33+
add_library(cpp_sandbox sandbox/sandbox.cpp sandbox/main.cpp)
3934

40-
target_link_libraries(cpp_sandbox
41-
cpp_util
42-
)
35+
target_link_libraries(cpp_sandbox cpp_util)
4336

44-
add_library(cpp_sandbox_echo
45-
sandbox/echo.cpp
46-
)
47-
target_link_libraries(cpp_sandbox_echo
48-
cpp_sandbox
49-
)
37+
add_library(cpp_sandbox_echo sandbox/echo.cpp)
38+
target_link_libraries(cpp_sandbox_echo cpp_sandbox)
5039

51-
if (APPLE)
40+
if(APPLE)
5241
set(CPP_SANDBOXES -Wl,-force_load cpp_sandbox_echo ${CPP_SANDBOXES})
5342
else()
5443
set(CPP_SANDBOXES
55-
-Wl,--whole-archive cpp_sandbox_echo -Wl,--no-whole-archive ${CPP_SANDBOXES})
44+
-Wl,--whole-archive
45+
cpp_sandbox_echo
46+
-Wl,--no-whole-archive
47+
${CPP_SANDBOXES})
5648
endif()
5749

58-
if (UNIX)
59-
add_library(cpp_sandbox_unix
60-
sandbox/unix.cpp
61-
)
62-
target_link_libraries(cpp_sandbox_unix
63-
cpp_sandbox
64-
)
50+
if(UNIX)
51+
add_library(cpp_sandbox_unix sandbox/unix.cpp)
52+
target_link_libraries(cpp_sandbox_unix cpp_sandbox)
6553

66-
add_executable(sandbox_unix_test
67-
sandbox/unix_test.cpp
68-
sandbox/unix.cpp
69-
)
70-
target_link_libraries(sandbox_unix_test
71-
cpp_sandbox
72-
GTest::Main
73-
GMock::gmock
74-
)
54+
add_executable(sandbox_unix_test sandbox/unix_test.cpp sandbox/unix.cpp)
55+
target_link_libraries(sandbox_unix_test cpp_sandbox GTest::Main GMock::gmock)
7556

76-
if (APPLE)
57+
if(APPLE)
7758
set(CPP_SANDBOXES -Wl,-force_load cpp_sandbox_unix ${CPP_SANDBOXES})
7859
else()
7960
set(CPP_SANDBOXES
80-
-Wl,--whole-archive cpp_sandbox_unix -Wl,--no-whole-archive ${CPP_SANDBOXES})
61+
-Wl,--whole-archive
62+
cpp_sandbox_unix
63+
-Wl,--no-whole-archive
64+
${CPP_SANDBOXES})
8165
endif()
8266
endif()
8367

8468
add_library(cpp_worker
85-
worker/cache.cpp
86-
worker/executor.cpp
87-
worker/manager.cpp
88-
worker/main.cpp
89-
)
69+
worker/cache.cpp
70+
worker/executor.cpp
71+
worker/manager.cpp
72+
worker/main.cpp)
9073

91-
target_link_libraries(cpp_worker
92-
cpp_sandbox
93-
cpp_util
94-
whereami
95-
)
74+
target_link_libraries(cpp_worker cpp_sandbox cpp_util whereami)
9675

9776
add_library(cpp_server
98-
server/dispatcher.cpp
99-
server/server.cpp
100-
server/main.cpp
101-
server/cache.cpp
102-
)
103-
target_link_libraries(cpp_server
104-
cpp_util
105-
)
77+
server/dispatcher.cpp
78+
server/server.cpp
79+
server/main.cpp
80+
server/cache.cpp)
81+
target_link_libraries(cpp_server cpp_util)
10682

107-
add_executable(task-maker
108-
main.cpp
109-
)
110-
target_link_libraries(task-maker
111-
${CPP_SANDBOXES}
112-
cpp_worker
113-
cpp_server
114-
)
115-
target_compile_definitions(task-maker PRIVATE TASK_MAKER_VERSION="${GIT_FULL_VERSION}")
83+
add_executable(task-maker main.cpp)
84+
target_link_libraries(task-maker ${CPP_SANDBOXES} cpp_worker cpp_server)
85+
target_compile_definitions(task-maker PRIVATE
86+
TASK_MAKER_VERSION="${GIT_FULL_VERSION}")
11687

11788
gtest_discover_tests(sandbox_unix_test)
11889
gtest_discover_tests(union_promise_test)

cpp/sandbox/test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
project(task-maker-cpp-sandbox-test)
22

3-
SET(TESTS busywait_arg1 copy_int malloc_arg1 return_arg1 signal_arg1 wait_arg1)
3+
set(TESTS busywait_arg1 copy_int malloc_arg1 return_arg1 signal_arg1 wait_arg1)
44

55
foreach(test ${TESTS})
66
add_executable(${test} ${test}.cpp)

0 commit comments

Comments
 (0)