2007-08-21 10:39:11 -06:00
|
|
|
# Required cmake version
|
2015-08-24 00:02:11 -06:00
|
|
|
cmake_minimum_required(VERSION 3.1.0)
|
2008-08-10 14:32:45 -06:00
|
|
|
|
2007-08-21 10:39:11 -06:00
|
|
|
# Put the include dirs which are in the source or build tree
|
|
|
|
# before all other include dirs, so the headers in the sources
|
|
|
|
# are prefered over the already installed ones
|
|
|
|
# since cmake 2.4.1
|
|
|
|
set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
|
|
|
|
|
2015-08-24 00:02:11 -06:00
|
|
|
project(pvpgn CXX)
|
2018-07-27 03:52:41 -06:00
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
2007-08-19 05:51:53 -06:00
|
|
|
|
|
|
|
option(WITH_BNETD "compile the bnetd target" ON)
|
|
|
|
option(WITH_D2CS "compile the d2cs target" ON)
|
|
|
|
option(WITH_D2DBS "compile the d2dbs target" ON)
|
2015-08-24 00:02:11 -06:00
|
|
|
option(WITH_LUA "enable Lua support" OFF)
|
2007-08-26 03:28:42 -06:00
|
|
|
if(WIN32)
|
2015-08-24 00:02:11 -06:00
|
|
|
option(WITH_WIN32_GUI "enable GUI building (default on)" ON)
|
2007-08-26 03:28:42 -06:00
|
|
|
endif(WIN32)
|
2007-08-19 05:51:53 -06:00
|
|
|
|
|
|
|
#storage backends flags
|
|
|
|
option(WITH_MYSQL "include MySQL user accounts support" OFF)
|
|
|
|
option(WITH_SQLITE3 "include SQLite3 user accounts support" OFF)
|
2007-08-27 14:02:18 -06:00
|
|
|
option(WITH_PGSQL "include PostgreSQL user accounts support" OFF)
|
2012-04-29 02:13:10 -06:00
|
|
|
option(WITH_ODBC "include ODBC user accounts support" OFF)
|
2018-07-27 07:53:26 -06:00
|
|
|
|
|
|
|
|
2007-08-19 05:51:53 -06:00
|
|
|
include(ConfigureChecks.cmake)
|
|
|
|
|
2014-07-06 10:37:11 -06:00
|
|
|
|
2017-12-14 20:41:22 -07:00
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
|
|
# using Clang
|
|
|
|
|
2020-10-17 20:17:16 -06:00
|
|
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-implicit-fallthrough -Wno-parentheses -Wno-unused-parameter -pedantic")
|
2017-12-14 20:41:22 -07:00
|
|
|
|
|
|
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
|
|
# using G++
|
|
|
|
|
2020-10-17 20:17:16 -06:00
|
|
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-implicit-fallthrough -Wno-parentheses -Wno-unused-parameter -pedantic" )
|
2017-12-14 20:41:22 -07:00
|
|
|
|
|
|
|
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
|
|
# using Visual Studio
|
|
|
|
|
2018-07-27 07:53:26 -06:00
|
|
|
add_definitions(
|
|
|
|
-D_CRT_SECURE_NO_DEPRECATE
|
|
|
|
-D_CRT_NONSTDC_NO_DEPRECATE
|
|
|
|
-DUNICODE
|
|
|
|
-D_UNICODE
|
2020-05-20 01:00:48 -06:00
|
|
|
-DNOMINMAX
|
2018-07-27 07:53:26 -06:00
|
|
|
)
|
2018-05-08 16:01:46 -06:00
|
|
|
|
|
|
|
# DEBUG compiler flags:
|
|
|
|
# /Zi create debugging information PDB file
|
|
|
|
# /Od disable optimizations
|
|
|
|
# /Oy- do not suppress frame pointers (recommended for debugging)
|
|
|
|
# /MTd use statically linked, thread-safe, debug CRT libs (Magic Builder set this flag when build)
|
|
|
|
#
|
|
|
|
# RELEASE compiler flags:
|
|
|
|
# /MT use statically linked, thread-safe CRT libs (Magic Builder set this flag when build)
|
|
|
|
# /GS- no Buffer Security Check
|
|
|
|
#
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Zi /Od /Oy-")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
|
|
|
|
|
|
|
|
# Explaining of linker flags and why enable pdb with debug info for Release build is on:
|
|
|
|
# https://www.wintellect.com/correctly-creating-native-c-release-build-pdbs
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
|
2015-10-10 14:54:31 -06:00
|
|
|
endif()
|
|
|
|
|
2018-07-27 04:19:17 -06:00
|
|
|
add_subdirectory(conf)
|
|
|
|
add_subdirectory(files)
|
|
|
|
add_subdirectory(man)
|
|
|
|
add_subdirectory(src)
|
2014-05-26 06:17:51 -06:00
|
|
|
if(WITH_LUA)
|
|
|
|
add_subdirectory(lua)
|
|
|
|
endif(WITH_LUA)
|
|
|
|
|
2018-07-27 07:53:26 -06:00
|
|
|
enable_testing()
|
2014-08-12 08:36:11 -06:00
|
|
|
|
|
|
|
# uninstall target
|
|
|
|
configure_file(
|
|
|
|
"${CMAKE_MODULE_PATH}/cmake_uninstall.cmake.in"
|
|
|
|
"${CMAKE_MODULE_PATH}/cmake_uninstall.cmake"
|
|
|
|
IMMEDIATE @ONLY)
|
|
|
|
|
|
|
|
add_custom_target(uninstall
|
|
|
|
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_MODULE_PATH}/cmake_uninstall.cmake)
|
|
|
|
|
|
|
|
# purge target
|
|
|
|
configure_file(
|
|
|
|
"${CMAKE_MODULE_PATH}/cmake_purge.cmake.in"
|
|
|
|
"${CMAKE_MODULE_PATH}/cmake_purge.cmake"
|
|
|
|
IMMEDIATE @ONLY)
|
|
|
|
|
|
|
|
add_custom_target(purge
|
|
|
|
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_MODULE_PATH}/cmake_purge.cmake)
|
2020-09-19 02:51:58 -06:00
|
|
|
|