2023-08-05 20:31:33 +02:00
|
|
|
cmake_minimum_required(VERSION 3.21)
|
2020-03-21 20:39:01 +01:00
|
|
|
project(SqMod)
|
|
|
|
|
2021-09-10 19:06:25 +02:00
|
|
|
# This plug-in only works on 64-bit
|
|
|
|
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
2023-03-05 14:37:30 +01:00
|
|
|
message(FATAL_ERROR "SqMod does not support 32-bit platforms anymore.")
|
2021-09-10 19:06:25 +02:00
|
|
|
endif()
|
|
|
|
|
2020-03-22 19:53:52 +01:00
|
|
|
# Tell CMake where to find our scripts
|
2023-08-05 20:31:33 +02:00
|
|
|
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${PROJECT_SOURCE_DIR}/vendor/POCO/cmake)
|
2020-03-22 19:53:52 +01:00
|
|
|
|
2020-03-21 20:39:01 +01:00
|
|
|
# Several plugin options
|
2020-05-01 19:41:00 +02:00
|
|
|
option(ENABLE_API21 "Build for 2.1 API." OFF)
|
2021-03-26 23:18:51 +01:00
|
|
|
option(ENABLE_OFFICIAL "Enable compatibility with official legacy plug-in" ON)
|
2021-09-21 19:59:01 +02:00
|
|
|
# As a fall-back for certain situations (mainly some docker ubuntu containers)
|
2021-09-21 20:05:08 +02:00
|
|
|
option(ENABLE_BUILTIN_MYSQL_C "Enable built-in MySQL connector library" OFF)
|
2021-09-10 19:06:25 +02:00
|
|
|
#option(FORCE_32BIT_BIN "Create a 32-bit executable binary if the compiler defaults to 64-bit." OFF)
|
2021-01-31 22:04:36 +01:00
|
|
|
# This option should only be available in certain conditions
|
|
|
|
if(WIN32 AND MINGW)
|
2023-03-05 14:37:30 +01:00
|
|
|
option(COPY_DEPENDENCIES "Copy dependent DLLs into the deps folder." OFF)
|
2021-01-31 22:04:36 +01:00
|
|
|
endif()
|
2023-08-05 20:31:33 +02:00
|
|
|
# Discord suppport
|
|
|
|
option(ENABLE_DISCORD "Enable built-in Discord support." ON)
|
2020-03-21 20:39:01 +01:00
|
|
|
|
2023-08-05 20:31:33 +02:00
|
|
|
# C++17 is mandatory (globally)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
2020-03-21 20:39:01 +01:00
|
|
|
|
2021-09-06 18:14:09 +02:00
|
|
|
# Strip binary
|
|
|
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s -g")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s -g")
|
2020-03-21 20:39:01 +01:00
|
|
|
|
|
|
|
# Enable position independent code
|
2021-01-31 17:48:31 +01:00
|
|
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
2021-02-01 00:49:03 +01:00
|
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
2020-03-21 20:39:01 +01:00
|
|
|
endif()
|
2020-05-28 20:27:44 +02:00
|
|
|
|
2021-01-30 07:51:39 +01:00
|
|
|
# Include vendor libraries
|
|
|
|
add_subdirectory(vendor)
|
2020-05-28 19:59:29 +02:00
|
|
|
# Include Module library
|
2021-01-30 07:51:39 +01:00
|
|
|
add_subdirectory(module)
|