-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
109 lines (87 loc) · 3.23 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
#
# Copyright (C) 2023 harshfeudal
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see https://www.gnu.org/licenses/.
#
cmake_minimum_required(VERSION 3.15)
set(PROJECT_NAME "Harshie")
set(HARSHIE_VERSION_MAJOR 1)
set(HARSHIE_VERSION_MINOR 1)
set(HARSHIE_VERSION_PATCH 0)
set(HARSHIE_VERSION_BUILD 0)
set(HARSHIE_VERSION ${HARSHIE_VERSION_MAJOR}.${HARSHIE_VERSION_MINOR}.${HARSHIE_VERSION_PATCH}.${HARSHIE_VERSION_BUILD})
project(
${PROJECT_NAME}
VERSION ${HARSHIE_VERSION}
LANGUAGES CXX
DESCRIPTION "A simple Discord moderation bot written in C++"
)
aux_source_directory(src MAINSRC)
aux_source_directory(src/database DATABASE)
aux_source_directory(src/templates TEMPLATE)
aux_source_directory(src/cores CORES)
aux_source_directory(src/cores/select_menus SELECT_MENUS)
aux_source_directory(src/cores/select_menus/values VALUES)
aux_source_directory(src/commands COMMANDS)
aux_source_directory(src/commands/slash/cmd_common COMMON_CMDS)
aux_source_directory(src/commands/slash/cmd_moderation MODERATION_CMDS)
aux_source_directory(src/commands/slash/cmd_configure CONFIG_CMDS)
add_executable(${PROJECT_NAME}
${MAINSRC}
${COMMANDS}
${COMMON_CMDS}
${MODERATION_CMDS}
${CONFIG_CMDS}
${CORES}
${SELECT_MENUS}
${VALUES}
${DATABASE}
${TEMPLATE}
)
set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
)
set(INCLUDE_FOLDER "include")
set(DPP_FOLDER "include/dpp")
set(LIBRARY_FOLDER "lib")
target_include_directories(${PROJECT_NAME} PRIVATE
${INCLUDE_FOLDER}
${DPP_FOLDER}
)
if(WIN32)
target_include_directories(${PROJECT_NAME} PRIVATE ${LIBRARY_FOLDER})
target_link_libraries(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/lib/dpp.lib)
target_link_libraries(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/lib/libpq.lib)
target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_BINARY_DIR}/harshie.rc")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/bin $<TARGET_FILE_DIR:${PROJECT_NAME}>
)
configure_file(
${CMAKE_SOURCE_DIR}/resources/harshie.rc.in
${CMAKE_BINARY_DIR}/harshie.rc
@ONLY
)
else()
find_package(PostgreSQL REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE "/lib/libdpp.so")
target_link_libraries(${PROJECT_NAME} PRIVATE PostgreSQL::PostgreSQL)
endif()
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/.env $<TARGET_FILE_DIR:${PROJECT_NAME}>
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/languages.json $<TARGET_FILE_DIR:${PROJECT_NAME}>
)