-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
CMakeLists.txt
111 lines (101 loc) · 4.21 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
#
# DiscordCoreAPI, A bot library for Discord, written in C++, and featuring explicit multithreading through the usage of custom, asynchronous C++ CoRoutines.
#
# Copyright 2021, 2022, 2023 Chris M. (RealTimeChris)
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA
#
# CMakeLists.txt - The CMake script for building this library.
# May 13, 2021
# https://discordcoreapi.com
set(Opus_DIR "C:/Vcpkg/installed/x64-windows-static/share/opus") # Set this one to the folder location of the file "OpusConfig.cmake".
set(unofficial-sodium_DIR "C:/Vcpkg/installed/x64-windows-static/share/unofficial-sodium") # Set this one to the folder location of the file "unofficial-sodiumConfig.cmake".
set(Jsonifier_DIR "") # Set this one to the folder location of the file "JsonifierConfig.cmake".
set(OPENSSL_ROOT_DIR "C:/Vcpkg/installed/x64-windows-static/") # Set this one to the folder location of the include folder and library folders of OpenSSL.
set(VCPKG_ROOT_DIR "C:/Vcpkg")
set(CMAKE_BUILD_TYPES "Release;Debug")
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
set(DEV TRUE)
if (EXISTS "${VCPKG_ROOT_DIR}")
set(ENV{VCPKG_INSTALLATION_ROOT} "${VCPKG_ROOT_DIR}")
endif()
cmake_minimum_required(VERSION 3.20)
if (WIN32)
if (NOT BUILD_SHARED_LIBS)
set(OS "windows-static")
else()
set(OS "windows")
endif()
elseif(APPLE)
if (NOT BUILD_SHARED_LIBS)
set(OS "osx-static")
else()
set(OS "osx")
endif()
elseif(UNIX)
if (NOT BUILD_SHARED_LIBS)
set(OS "linux-static")
else()
set(OS "linux")
endif()
endif()
if (EXISTS "$ENV{VCPKG_INSTALLATION_ROOT}")
set(VCPKG_INSTALLATION_ROOT_NEW "$ENV{VCPKG_INSTALLATION_ROOT}")
if (NOT EXISTS "${OPENSSL_ROOT_DIR}")
set(OPENSSL_ROOT_DIR "${VCPKG_INSTALLATION_ROOT_NEW}/installed/x64-${OS}/")
endif()
if (NOT EXISTS "${OpenSSL_DIR}")
set(OpenSSL_DIR "${VCPKG_INSTALLATION_ROOT_NEW}/installed/x64-${OS}/share/openssl")
endif()
if (NOT EXISTS "${Jsonifier_DIR}")
set(Jsonifier_DIR "${VCPKG_INSTALLATION_ROOT_NEW}/installed/x64-${OS}/share/jsonifier")
endif()
if (NOT EXISTS "${Opus_DIR}")
set(Opus_DIR "${VCPKG_INSTALLATION_ROOT_NEW}/installed/x64-${OS}/share/opus")
endif()
if (NOT EXISTS "${unofficial-sodium_DIR}")
set(unofficial-sodium_DIR "${VCPKG_INSTALLATION_ROOT_NEW}/installed/x64-${OS}/share/unofficial-sodium")
endif()
include("${VCPKG_INSTALLATION_ROOT_NEW}/scripts/buildsystems/vcpkg.cmake")
else()
message(WARNING "No Vcpkg root folder found, Please make sure that you properly set the library folders.")
endif()
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/CMake;")
include(CollectVersion)
collect_version("discordcoreapi")
set(PROJECT_NAME "DiscordCoreAPI")
set(LIB_NAME "${PROJECT_NAME}")
set(DESCRIPTION "A Discord bot library, written in C++, using custom asynchronous coroutines.")
project(
"${PROJECT_NAME}"
VERSION "${PRODUCT_VERSION}"
LANGUAGES CXX
HOMEPAGE_URL "https://discordcoreapi.com"
DESCRIPTION "${DESCRIPTION}"
)
set(DiscordCoreAPI-POPCNT_EXITCODE 0 CACHE INTERNAL "For cross-compiling.")
set(DiscordCoreAPI-LZCNT_EXITCODE 0 CACHE INTERNAL "For cross-compiling.")
set(DiscordCoreAPI-BMI_EXITCODE 0 CACHE INTERNAL "For cross-compiling.")
set(DiscordCoreAPI-BMI2_EXITCODE 0 CACHE INTERNAL "For cross-compiling.")
set(DiscordCoreAPI-AVX_EXITCODE 0 CACHE INTERNAL "For cross-compiling.")
set(DiscordCoreAPI-AVX2_EXITCODE 0 CACHE INTERNAL "For cross-compiling.")
set(DiscordCoreAPI-AVX512_EXITCODE 0 CACHE INTERNAL "For cross-compiling.")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 20)
add_subdirectory(Library)
if (DISCORDCOREAPI_TEST)
add_subdirectory("./Tests")
endif()