Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wordle-de
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lukas Gülenstein
wordle-de
Commits
b0f020ff
Commit
b0f020ff
authored
2 years ago
by
Lukas Güldenstein
Browse files
Options
Downloads
Patches
Plain Diff
Build docs with cmake
parent
72e9a24d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CMakeLists.txt
+48
-9
48 additions, 9 deletions
CMakeLists.txt
with
48 additions
and
9 deletions
CMakeLists.txt
+
48
−
9
View file @
b0f020ff
...
...
@@ -6,20 +6,22 @@ set(CMAKE_C_STANDARD 99)
set
(
CMAKE_CXX_STANDARD 20
)
set
(
CMAKE_EXPORT_COMPILE_COMMANDS ON
)
# Protobuf
find_package
(
Protobuf REQUIRED
)
include_directories
(
${
Protobuf_INCLUDE_DIRS
}
)
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
protobuf_generate_cpp
(
PROTO_SRCS PROTO_HDRS
${
TARGET_NAME
}
.proto
)
# Botan2 via PkgConfig
find_package
(
PkgConfig
)
pkg_check_modules
(
BOTAN2 REQUIRED botan-2
)
# LevelDB
find_path
(
LEVELDB_INCLUDE_DIR
NAMES leveldb/db.h
DOC
"leveldb include dir"
)
find_library
(
LEVELDB_LIBRARY
NAMES leveldb
...
...
@@ -28,24 +30,57 @@ find_library(
set
(
LEVELDB_INCLUDE_DIRS
${
LEVELDB_INCLUDE_DIR
}
)
set
(
LEVELDB_LIBRARIES
${
LEVELDB_LIBRARY
}
)
find_package
(
Doxygen REQUIRED doxygen dot
)
# Threads
find_package
(
Threads REQUIRED
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-pthread"
)
# CXXOPTS
add_subdirectory
(
extern/cxxopts
)
# Common Sources for both executables
set
(
COMMON_SRCS
src/game.cpp
${
PROTO_SRCS
}
${
PROTO_HDRS
}
)
set
(
COMMON_LIBS
${
Protobuf_LIBRARIES
}
${
BOTAN2_LIBRARIES
}
${
BOTAN2_LDFLAGS
}
cxxopts
)
# Docs
option
(
BUILD_DOC
"Build documentation"
ON
)
# check if Doxygen is installed
find_package
(
Doxygen
)
if
(
DOXYGEN_FOUND
)
# set input and output files
set
(
DOXYGEN_FILE
${
CMAKE_CURRENT_SOURCE_DIR
}
/Doxyfile
)
message
(
"Doxygen build started"
)
# note the option ALL which allows to build the docs together with the application
add_custom_target
(
doc_doxygen ALL
COMMAND
${
DOXYGEN_EXECUTABLE
}
${
DOXYGEN_FILE
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
COMMENT
"Generating API documentation with Doxygen"
VERBATIM
)
else
(
DOXYGEN_FOUND
)
message
(
"Doxygen need to be installed to generate the doxygen documentation"
)
endif
(
DOXYGEN_FOUND
)
# Server
set
(
server_sources src/server_main.cpp src/server.cpp
${
COMMON_SRCS
}
)
add_executable
(
${
TARGET_NAME
}
_server
${
server_sources
}
)
target_link_libraries
(
${
TARGET_NAME
}
_server
${
Protobuf_LIBRARIES
}
)
target_link_libraries
(
${
TARGET_NAME
}
_server
${
BOTAN2_LIBRARIES
}
${
BOTAN2_LDFLAGS
}
)
target_link_libraries
(
${
TARGET_NAME
}
_server
${
COMMON_LIBS
}
)
# target_link_libraries(${TARGET_NAME}_server ${Protobuf_LIBRARIES})
# target_link_libraries(${TARGET_NAME}_server ${BOTAN2_LIBRARIES} ${BOTAN2_LDFLAGS})
# target_link_libraries(${TARGET_NAME}_server cxxopts)
target_link_libraries
(
${
TARGET_NAME
}
_server
${
LEVELDB_LIBRARIES
}
)
target_link_libraries
(
${
TARGET_NAME
}
_server cxxopts
)
target_include_directories
(
${
TARGET_NAME
}
_server PRIVATE
${
CMAKE_SOURCE_DIR
}
/src
...
...
@@ -54,11 +89,15 @@ target_include_directories(
${
LEVELDB_INCLUDE_DIRS
}
cxxopts
)
# Client
set
(
client_sources src/client_main.cpp src/client.cpp
${
COMMON_SRCS
}
)
add_executable
(
${
TARGET_NAME
}
_client
${
client_sources
}
)
target_link_libraries
(
${
TARGET_NAME
}
_client
${
Protobuf_LIBRARIES
}
)
target_link_libraries
(
${
TARGET_NAME
}
_client
${
BOTAN2_LIBRARIES
}
${
BOTAN2_LDFLAGS
}
)
target_link_libraries
(
${
TARGET_NAME
}
_client cxxopts
)
target_link_libraries
(
${
TARGET_NAME
}
_client
${
COMMON_LIBS
}
)
# target_link_libraries(${TARGET_NAME}_client ${Protobuf_LIBRARIES})
# target_link_libraries(${TARGET_NAME}_client ${BOTAN2_LIBRARIES} ${BOTAN2_LDFLAGS})
# target_link_libraries(${TARGET_NAME}_client cxxopts)
target_include_directories
(
${
TARGET_NAME
}
_client PRIVATE
${
CMAKE_SOURCE_DIR
}
/src
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment