-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathCMakeLists.txt
113 lines (97 loc) · 3.09 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
112
113
cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0091 NEW)
project(discord-connector VERSION 0.3.6)
if (NOT DCC_VERSION) # allow version override
set(DCC_VERSION ${PROJECT_VERSION})
endif()
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/libs/cmake")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
if(MSVC)
set(CMAKE_BUILD_TYPE "" CACHE STRING "" FORCE)
endif()
if(UNIX)
set(
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/artifact/"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/artifact/"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/artifact/"
)
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
SET(CMAKE_INSTALL_RPATH "$\{ORIGIN\}")
endif()
# -- CONAN
include(libs/cmake-conan/conan.cmake)
function(add_conan_lib pkg_name conan_pkg)
conan_check(REQUIRED)
conan_cmake_run(
REQUIRES ${conan_pkg}
ARCH x86
BASIC_SETUP CMAKE_TARGETS
BUILD missing
)
set_target_properties(${pkg_name} PROPERTIES IMPORTED_GLOBAL TRUE)
endfunction()
if (MSVC)
# link runtime statically
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
elseif(UNIX)
# hide non-exported symbols
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fno-builtin-getentropy")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -fno-builtin-getentropy")
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF)
# link runtime statically
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
add_link_options(
"-static-libgcc"
"-static-libstdc++"
)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath='$ORIGIN' -static-libstdc++ -static-libgcc")
endif()
if(NOT DEFINED OPENSSL_USE_STATIC_LIBS)
set(OPENSSL_USE_STATIC_LIBS ON)
set(OPENSSL_MSVC_STATIC_RT ON)
endif()
if(USING_BOOST_NO_CONAN)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_DEBUG_LIBS ON)
set(Boost_USE_RELEASE_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.69 QUIET)
if(NOT Boost_FOUND)
set(BOOST_ROOT "${BOOST_ROOT}" CACHE PATH "Set the Boost root folder.")
mark_as_advanced(CLEAR BOOST_ROOT)
message(FATAL_ERROR "Could NOT find Boost; specify additional paths.")
endif()
mark_as_advanced(BOOST_ROOT Boost_DIR)
set(Boost_INCLUDE_DIR "${Boost_INCLUDE_DIR}" PARENT_SCOPE)
else()
conan_check(REQUIRED)
conan_cmake_run(
REQUIRES boost/1.79.0
ARCH x86
BASIC_SETUP CMAKE_TARGETS
BUILD missing
OPTIONS boost:zlib=False
)
set_target_properties(CONAN_PKG::boost PROPERTIES IMPORTED_GLOBAL TRUE)
endif()
set(CONAN_HAS_FMT TRUE CACHE INTERNAL FALSE)
add_conan_lib(CONAN_PKG::fmt fmt/7.1.3)
if(USING_OPENSSL_NO_CONAN)
if(NOT DEFINED OPENSSL_USE_STATIC_LIBS)
set(OPENSSL_USE_STATIC_LIBS ON)
set(OPENSSL_MSVC_STATIC_RT ON)
endif()
find_package(OpenSSL)
if (NOT OPENSSL_FOUND)
set(OPENSSL_ROOT_DIR "${OPENSSL_ROOT_DIR}" CACHE PATH "Set the OpenSSL root folder.")
mark_as_advanced(CLEAR OPENSSL_ROOT_DIR)
message(FATAL_ERROR "Could NOT find OpenSSL; specify additional paths.")
endif()
else()
add_conan_lib(CONAN_PKG::openssl openssl/1.1.1k)
endif()
add_subdirectory(libs/log-core)
add_subdirectory(libs/omp-sdk)
add_subdirectory(src)