-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
111 lines (91 loc) · 3.85 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.19)
# Set the project name and version
PROJECT(bicast VERSION 0.0 DESCRIPTION "Combined multicast/P2P protocol & file-distribution system")
## Include gRPC in the build
#option(USE_SYSTEM_GRPC "Use system installed gRPC" OFF)
#if(USE_SYSTEM_GRPC)
# # Find system-installed gRPC
# find_package(gRPC CONFIG REQUIRED)
#else()
# include(FetchContent)
# FetchContent_Declare(
# gRPC
# GIT_REPOSITORY https://github.com/grpc/grpc
# GIT_TAG v1.35.0)
# set(FETCHCONTENT_QUIET OFF)
# FetchContent_MakeAvailable(gRPC)
#endif()
# Specify the C standard
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED True)
# Specify the C++ standard
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED True)
if(CMAKE_CXX_COMPILER_ID STREQUAL GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
message(FATAL_ERROR "This package depends on the C++ std::reqex library, \
which doesn't work in GNU C++ versions prior to 5")
endif()
# Specify the Eclipse IDE version
set(CMAKE_ECLIPSE_VERSION 4.22)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/.." CACHE PATH "Installation root directory" FORCE)
endif()
# Configure a configuration header file
configure_file(config.h.in config.h)
include_directories(${CMAKE_BINARY_DIR}) # necessary
include_directories(main main/misc main/inet main/mcast main/p2p main/repository main/node
main/disposer main/publish main/RunPar)
include_directories(SYSTEM /usr/local/include)
# Add the main subdirectory
add_subdirectory(main)
# Enable testing if and only if Google Test can be found
find_library(GTEST_LIBRARY gtest)
if (GTEST_LIBRARY)
find_path(GTEST_INCLUDE_DIR "gtest/gtest.h" HINTS /usr/include /usr/local/include)
if (NOT GTEST_INCLUDE_DIR)
message(STATUS "Gtest header-file wasn't found. Unit-testing is disabled.")
else()
# This must be done *before* adding the testing subdirectory
include(CTest)
enable_testing()
add_subdirectory(test)
message(STATUS "Gtest was found. Unit-testing is enabled.")
message(STATUS "Gtest library=${GTEST_LIBRARY}.")
endif()
else()
message(STATUS "Gtest library wasn't found. Unit-testing is disabled.")
endif()
# Specify the documentation
find_package(Doxygen)
set(DOXYGEN_JAVADOC_AUTOBRIEF YES)
set(DOXYGEN_ALIASES
[[exceptionsafety="@par Exception Safety:"]]
[[threadsafety="@par Thread Safety:"]]
[[asyncsignalsafe="@par Async-signal Safe:"]]
[[cancellationpoint="@par Cancellation Point:"]])
set(DOXYGEN_VERBATIM_VARS DOXYGEN_ALIASES)
doxygen_add_docs(doxydocs mainpage.md main ALL)
# Install documentation
SET(CMAKE_INSTALL_DOCDIR share/doc)
install(DIRECTORY "${CMAKE_BINARY_DIR}/html" DESTINATION
${CMAKE_INSTALL_DOCDIR})
install(FILES "${CMAKE_SOURCE_DIR}/CHANGE_LOG" DESTINATION
${CMAKE_INSTALL_DOCDIR})
install(FILES "${CMAKE_SOURCE_DIR}/LICENSE" DESTINATION
${CMAKE_INSTALL_DOCDIR})
include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_CONTACT "Steven Emmerson <[email protected]>")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
#set(CPACK_PACKAGING_INSTALL_PREFIX "/${PROJECT_NAME}-${PROJECT_VERSION}")
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local")
set(CPACK_PACKAGE_VENDOR "University Corporation for Atmospheric Research")
#SET(CPACK_DEBIAN_PACKAGE_DEPENDS "yaml-cpp openssl11")
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${CMAKE_HOST_SYSTEM_PROCESSOR}")
SET(CPACK_RPM_PACKAGE_LICENSE "Apache 2.0")
#SET(CPACK_RPM_PACKAGE_REQUIRES "yaml-cpp openssl11")
SET(CPACK_RPM_PACKAGE_PROVIDES "publish(1), subscribe(1)")
set(CPACK_GENERATOR DEB STGZ RPM) # RPM needs yum(1)-compatible UPC software repository
include(CPack)
# Configure deployment and testing
configure_file(deploy.sh deploy @ONLY)
configure_file(uni15-test.sh uni15-test @ONLY)