latest sources commit
This commit is contained in:
72
src/cmake/ac_macros.cmake
Normal file
72
src/cmake/ac_macros.cmake
Normal file
@@ -0,0 +1,72 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
#
|
||||
# AC_ADD_SCRIPT
|
||||
#
|
||||
MACRO(AC_ADD_SCRIPT path)
|
||||
CU_ADD_GLOBAL("AC_SCRIPTS_SOURCES" "${path}")
|
||||
ENDMACRO()
|
||||
|
||||
#
|
||||
# AC_ADD_SCRIPTS
|
||||
#
|
||||
# This macro can be used to automatically load scripts for the ScriptMgr
|
||||
# from a specified folder, instead of manually list them within the cmake
|
||||
# NOTE: you must still manually specify the script loader header
|
||||
#
|
||||
MACRO(AC_ADD_SCRIPTS path)
|
||||
CU_SUBDIRLIST(sub_DIRS ${path} TRUE TRUE)
|
||||
FOREACH(subdir ${sub_DIRS})
|
||||
file(GLOB sources "${subdir}/*.cpp" "${subdir}/*.h")
|
||||
CU_LIST_ADD_CACHE(scripts_STAT_SRCS "${sources}")
|
||||
ENDFOREACH()
|
||||
ENDMACRO()
|
||||
|
||||
#
|
||||
# AC_ADD_SCRIPT_LOADER
|
||||
#
|
||||
MACRO(AC_ADD_SCRIPT_LOADER script_dec include)
|
||||
set (lower_prio_scripts ${ARGN})
|
||||
list(LENGTH lower_prio_scripts num_lower_prio_scripts)
|
||||
if (${num_lower_prio_scripts} GREATER 0)
|
||||
CU_GET_GLOBAL("AC_ADD_SCRIPTS_LIST")
|
||||
foreach(lower_prio_script ${lower_prio_scripts})
|
||||
if ("${AC_ADD_SCRIPTS_LIST}" MATCHES "Add${lower_prio_script}Scripts()")
|
||||
message("-- ${script_dec} demands lower priority: ${lower_prio_script} --")
|
||||
list(REMOVE_ITEM AC_ADD_SCRIPTS_LIST "Add${lower_prio_script}Scripts()")
|
||||
CU_SET_GLOBAL("AC_ADD_SCRIPTS_LIST" "${AC_ADD_SCRIPTS_LIST}")
|
||||
list(APPEND removed_lower_prio_scripts ${lower_prio_script})
|
||||
endif()
|
||||
endforeach()
|
||||
CU_ADD_GLOBAL("AC_ADD_SCRIPTS_LIST" "Add${script_dec}Scripts()\;")
|
||||
foreach(lower_prio_script ${removed_lower_prio_scripts})
|
||||
CU_ADD_GLOBAL("AC_ADD_SCRIPTS_LIST" "Add${lower_prio_script}Scripts()\;")
|
||||
endforeach()
|
||||
else()
|
||||
CU_ADD_GLOBAL("AC_ADD_SCRIPTS_LIST" "Add${script_dec}Scripts()\;")
|
||||
endif()
|
||||
|
||||
if (NOT ${include} STREQUAL "")
|
||||
CU_GET_GLOBAL("AC_ADD_SCRIPTS_INCLUDE")
|
||||
if (NOT ";${AC_ADD_SCRIPTS_INCLUDE};" MATCHES ";${include};")
|
||||
CU_ADD_GLOBAL("AC_ADD_SCRIPTS_INCLUDE" "${include}\;")
|
||||
endif()
|
||||
endif()
|
||||
ENDMACRO()
|
||||
|
||||
#
|
||||
# AC_ADD_CONFIG_FILE
|
||||
#
|
||||
MACRO(AC_ADD_CONFIG_FILE configFilePath)
|
||||
message("> Warning: module using deprecated add config file api")
|
||||
ENDMACRO()
|
||||
138
src/cmake/compiler/clang/settings.cmake
Normal file
138
src/cmake/compiler/clang/settings.cmake
Normal file
@@ -0,0 +1,138 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
if ((USE_COREPCH OR USE_SCRIPTPCH) AND (CMAKE_C_COMPILER_LAUNCHER STREQUAL "ccache" OR CMAKE_CXX_COMPILER_LAUNCHER STREQUAL "ccache"))
|
||||
message(STATUS "Clang: disable pch timestamp when ccache and pch enabled")
|
||||
# TODO: for ccache https://github.com/ccache/ccache/issues/539
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xclang -fno-pch-timestamp")
|
||||
endif()
|
||||
|
||||
# Set build-directive (used in core to tell which buildtype we used)
|
||||
target_compile_definitions(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-D_BUILD_DIRECTIVE="${CMAKE_BUILD_TYPE}")
|
||||
|
||||
set(CLANG_EXPECTED_VERSION 10.0.0)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS CLANG_EXPECTED_VERSION)
|
||||
message(FATAL_ERROR "Clang: AzerothCore requires version ${CLANG_EXPECTED_VERSION} to build but found ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
else()
|
||||
message(STATUS "Clang: Minimum version required is ${CLANG_EXPECTED_VERSION}, found ${CMAKE_CXX_COMPILER_VERSION} - ok!")
|
||||
endif()
|
||||
|
||||
# This tests for a bug in clang-7 that causes linkage to fail for 64-bit from_chars (in some configurations)
|
||||
# If the clang requirement is bumped to >= clang-8, you can remove this check, as well as
|
||||
# the associated ifdef block in src/common/Utilities/StringConvert.h
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
check_cxx_source_compiles("
|
||||
#include <charconv>
|
||||
#include <cstdint>
|
||||
int main()
|
||||
{
|
||||
uint64_t n;
|
||||
char const c[] = \"0\";
|
||||
std::from_chars(c, c+1, n);
|
||||
return static_cast<int>(n);
|
||||
}
|
||||
" CLANG_HAVE_PROPER_CHARCONV)
|
||||
|
||||
if(WITH_WARNINGS)
|
||||
target_compile_options(acore-warning-interface
|
||||
INTERFACE
|
||||
-W
|
||||
-Wall
|
||||
-Wextra
|
||||
-Winit-self
|
||||
-Wfatal-errors
|
||||
-Wno-mismatched-tags
|
||||
-Woverloaded-virtual)
|
||||
message(STATUS "Clang: All warnings enabled")
|
||||
endif()
|
||||
|
||||
if(WITH_COREDEBUG)
|
||||
target_compile_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-g3)
|
||||
message(STATUS "Clang: Debug-flags set (-g3)")
|
||||
endif()
|
||||
|
||||
if(MSAN)
|
||||
target_compile_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-fno-omit-frame-pointer
|
||||
-fsanitize=memory
|
||||
-fsanitize-memory-track-origins
|
||||
-mllvm
|
||||
-msan-keep-going=1)
|
||||
|
||||
target_link_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-fno-omit-frame-pointer
|
||||
-fsanitize=memory
|
||||
-fsanitize-memory-track-origins)
|
||||
|
||||
message(STATUS "Clang: Enabled Memory Sanitizer MSan")
|
||||
endif()
|
||||
|
||||
if(UBSAN)
|
||||
target_compile_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-fno-omit-frame-pointer
|
||||
-fsanitize=undefined)
|
||||
|
||||
target_link_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-fno-omit-frame-pointer
|
||||
-fsanitize=undefined)
|
||||
|
||||
message(STATUS "Clang: Enabled Undefined Behavior Sanitizer UBSan")
|
||||
endif()
|
||||
|
||||
if(TSAN)
|
||||
target_compile_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-fno-omit-frame-pointer
|
||||
-fsanitize=thread)
|
||||
|
||||
target_link_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-fno-omit-frame-pointer
|
||||
-fsanitize=thread)
|
||||
|
||||
message(STATUS "Clang: Enabled Thread Sanitizer TSan")
|
||||
endif()
|
||||
|
||||
# -Wno-narrowing needed to suppress a warning in g3d
|
||||
# -Wno-deprecated-register is needed to suppress gsoap warnings on Unix systems.
|
||||
target_compile_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-Wno-narrowing
|
||||
-Wno-deprecated-register)
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
# -fPIC is needed to allow static linking in shared libs.
|
||||
# -fvisibility=hidden sets the default visibility to hidden to prevent exporting of all symbols.
|
||||
target_compile_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-fPIC)
|
||||
|
||||
target_compile_options(acore-hidden-symbols-interface
|
||||
INTERFACE
|
||||
-fvisibility=hidden)
|
||||
|
||||
# --no-undefined to throw errors when there are undefined symbols
|
||||
# (caused through missing ACORE_*_API macros).
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --no-undefined")
|
||||
|
||||
message(STATUS "Clang: Disallow undefined symbols")
|
||||
endif()
|
||||
76
src/cmake/compiler/gcc/settings.cmake
Normal file
76
src/cmake/compiler/gcc/settings.cmake
Normal file
@@ -0,0 +1,76 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
# Set build-directive (used in core to tell which buildtype we used)
|
||||
target_compile_definitions(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-D_BUILD_DIRECTIVE="${CMAKE_BUILD_TYPE}")
|
||||
|
||||
set(GCC_EXPECTED_VERSION 8.0.0)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS GCC_EXPECTED_VERSION)
|
||||
message(FATAL_ERROR "GCC: This project requires version ${GCC_EXPECTED_VERSION} to build but found ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
else()
|
||||
message(STATUS "GCC: Minimum version required is ${GCC_EXPECTED_VERSION}, found ${CMAKE_CXX_COMPILER_VERSION} - ok!")
|
||||
endif()
|
||||
|
||||
if(PLATFORM EQUAL 32)
|
||||
# Required on 32-bit systems to enable SSE2 (standard on x64)
|
||||
target_compile_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-msse2
|
||||
-mfpmath=sse)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-DHAVE_SSE2
|
||||
-D__SSE2__)
|
||||
message(STATUS "GCC: SFMT enabled, SSE2 flags forced")
|
||||
|
||||
if( WITH_WARNINGS )
|
||||
target_compile_options(acore-warning-interface
|
||||
INTERFACE
|
||||
-W
|
||||
-Wall
|
||||
-Wextra
|
||||
-Winit-self
|
||||
-Winvalid-pch
|
||||
-Wfatal-errors
|
||||
-Woverloaded-virtual)
|
||||
message(STATUS "GCC: All warnings enabled")
|
||||
endif()
|
||||
|
||||
if( WITH_COREDEBUG )
|
||||
target_compile_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-g3)
|
||||
message(STATUS "GCC: Debug-flags set (-g3)")
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
target_compile_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-fPIC
|
||||
-Wno-attributes)
|
||||
|
||||
target_compile_options(acore-hidden-symbols-interface
|
||||
INTERFACE
|
||||
-fvisibility=hidden)
|
||||
|
||||
# Should break the build when there are ACORE_*_API macros missing
|
||||
# but it complains about missing references in precompiled headers.
|
||||
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--no-undefined")
|
||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-undefined")
|
||||
|
||||
message(STATUS "GCC: Enabled shared linking")
|
||||
endif()
|
||||
40
src/cmake/compiler/icc/settings.cmake
Normal file
40
src/cmake/compiler/icc/settings.cmake
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
# Set build-directive (used in core to tell which buildtype we used)
|
||||
target_compile_definitions(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-D_BUILD_DIRECTIVE="${CMAKE_BUILD_TYPE}")
|
||||
|
||||
if(PLATFORM EQUAL 32)
|
||||
target_compile_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-axSSE2)
|
||||
else()
|
||||
target_compile_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-xSSE2)
|
||||
endif()
|
||||
|
||||
if(WITH_WARNINGS)
|
||||
target_compile_options(acore-warning-interface
|
||||
INTERFACE
|
||||
-w1)
|
||||
message(STATUS "ICC: All warnings enabled")
|
||||
endif()
|
||||
|
||||
if(WITH_COREDEBUG)
|
||||
target_compile_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-g)
|
||||
message(STATUS "ICC: Debug-flag set (-g)")
|
||||
endif()
|
||||
53
src/cmake/compiler/mingw/settings.cmake
Normal file
53
src/cmake/compiler/mingw/settings.cmake
Normal file
@@ -0,0 +1,53 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
# set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
||||
# Set build-directive (used in core to tell which buildtype we used)
|
||||
target_compile_definitions(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-D_BUILD_DIRECTIVE="${CMAKE_BUILD_TYPE}")
|
||||
|
||||
if(PLATFORM EQUAL 32)
|
||||
# Required on 32-bit systems to enable SSE2 (standard on x64)
|
||||
target_compile_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-msse2
|
||||
-mfpmath=sse)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-DHAVE_SSE2
|
||||
-D__SSE2__)
|
||||
message(STATUS "GCC: SFMT enabled, SSE2 flags forced")
|
||||
|
||||
if(WITH_WARNINGS)
|
||||
target_compile_options(acore-warning-interface
|
||||
INTERFACE
|
||||
-W
|
||||
-Wall
|
||||
-Wextra
|
||||
-Winit-self
|
||||
-Winvalid-pch
|
||||
-Wfatal-errors
|
||||
-Woverloaded-virtual)
|
||||
message(STATUS "GCC: All warnings enabled")
|
||||
endif()
|
||||
|
||||
if(WITH_COREDEBUG)
|
||||
target_compile_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-g3)
|
||||
message(STATUS "GCC: Debug-flags set (-g3)")
|
||||
endif()
|
||||
162
src/cmake/compiler/msvc/settings.cmake
Normal file
162
src/cmake/compiler/msvc/settings.cmake
Normal file
@@ -0,0 +1,162 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
# set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
||||
set(MSVC_EXPECTED_VERSION 19.24)
|
||||
set(MSVC_EXPECTED_VERSION_STRING "Microsoft Visual Studio 2019 16.4")
|
||||
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS MSVC_EXPECTED_VERSION)
|
||||
message(FATAL_ERROR "MSVC: AzerothCore requires version ${MSVC_EXPECTED_VERSION} (${MSVC_EXPECTED_VERSION_STRING}) to build but found ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
else()
|
||||
message(STATUS "MSVC: Minimum version required is ${MSVC_EXPECTED_VERSION}, found ${CMAKE_CXX_COMPILER_VERSION} - ok!")
|
||||
endif()
|
||||
|
||||
# CMake sets warning flags by default, however we manage it manually
|
||||
# for different core and dependency targets
|
||||
string(REGEX REPLACE "/W[0-4] " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
# Search twice, once for space after /W argument,
|
||||
# once for end of line as CMake regex has no \b
|
||||
string(REGEX REPLACE "/W[0-4]$" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
string(REGEX REPLACE "/W[0-4] " "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
string(REGEX REPLACE "/W[0-4]$" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
|
||||
# https://tinyurl.com/jxnc4s83
|
||||
target_compile_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
/utf-8)
|
||||
|
||||
if(PLATFORM EQUAL 64)
|
||||
# This definition is necessary to work around a bug with Intellisense described
|
||||
# here: http://tinyurl.com/2cb428. Syntax highlighting is important for proper
|
||||
# debugger functionality.
|
||||
target_compile_definitions(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-D_WIN64)
|
||||
message(STATUS "MSVC: 64-bit platform, enforced -D_WIN64 parameter")
|
||||
|
||||
# Enable extended object support for debug compiles on X64 (not required on X86)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj")
|
||||
message(STATUS "MSVC: Enabled extended object-support for debug-compiles")
|
||||
else()
|
||||
# mark 32 bit executables large address aware so they can use > 2GB address space
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
|
||||
message(STATUS "MSVC: Enabled large address awareness")
|
||||
|
||||
target_compile_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
/arch:SSE2)
|
||||
message(STATUS "MSVC: Enabled SSE2 support")
|
||||
endif()
|
||||
|
||||
# Set build-directive (used in core to tell which buildtype we used)
|
||||
# msbuild/devenv don't set CMAKE_MAKE_PROGRAM, you can choose build type from a dropdown after generating projects
|
||||
if("${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild")
|
||||
target_compile_definitions(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-D_BUILD_DIRECTIVE="$(ConfigurationName)")
|
||||
else()
|
||||
# while all make-like generators do (nmake, ninja)
|
||||
target_compile_definitions(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-D_BUILD_DIRECTIVE="${CMAKE_BUILD_TYPE}")
|
||||
endif()
|
||||
|
||||
# multithreaded compiling on VS
|
||||
target_compile_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
/MP)
|
||||
|
||||
# Define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES - eliminates the warning by changing the strcpy call to strcpy_s, which prevents buffer overruns
|
||||
target_compile_definitions(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES)
|
||||
message(STATUS "MSVC: Overloaded standard names")
|
||||
|
||||
# Ignore warnings about older, less secure functions
|
||||
target_compile_definitions(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-D_CRT_SECURE_NO_WARNINGS)
|
||||
message(STATUS "MSVC: Disabled NON-SECURE warnings")
|
||||
|
||||
# Ignore warnings about POSIX deprecation
|
||||
target_compile_definitions(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-D_CRT_NONSTDC_NO_WARNINGS)
|
||||
message(STATUS "MSVC: Disabled POSIX warnings")
|
||||
|
||||
# Ignore warnings about INTMAX_MAX
|
||||
target_compile_definitions(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-D__STDC_LIMIT_MACROS)
|
||||
message(STATUS "MSVC: Disabled INTMAX_MAX warnings")
|
||||
|
||||
# Ignore specific warnings
|
||||
target_compile_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
/wd4351 # C4351: new behavior: elements of array 'x' will be default initialized
|
||||
/wd4091) # C4091: 'typedef ': ignored on left of '' when no variable is declared
|
||||
|
||||
# Define NOMINMAX
|
||||
target_compile_definitions(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-DNOMINMAX)
|
||||
message(STATUS "MSVC: Enable NOMINMAX")
|
||||
|
||||
if(NOT WITH_WARNINGS)
|
||||
target_compile_options(acore-warning-interface
|
||||
INTERFACE
|
||||
/wd4996 # C4996 deprecation
|
||||
/wd4985 # C4985 'symbol-name': attributes not present on previous declaration.
|
||||
/wd4244 # C4244 'argument' : conversion from 'type1' to 'type2', possible loss of data
|
||||
/wd4267 # C4267 'var' : conversion from 'size_t' to 'type', possible loss of data
|
||||
/wd4619 # C4619 #pragma warning : there is no warning number 'number'
|
||||
/wd4512) # C4512 'class' : assignment operator could not be generated
|
||||
|
||||
message(STATUS "MSVC: Disabled generic compiletime warnings")
|
||||
endif()
|
||||
|
||||
# Move some warnings that are enabled for other compilers from level 4 to level 3
|
||||
target_compile_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
/w34100 # C4100 'identifier' : unreferenced formal parameter
|
||||
/w34101 # C4101: 'identifier' : unreferenced local variable
|
||||
/w34189 # C4189: 'identifier' : local variable is initialized but not referenced
|
||||
/w34389) # C4189: 'equality-operator' : signed/unsigned mismatch
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
target_compile_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
/wd4251 # C4251: needs to have dll-interface to be used by clients of class '...'
|
||||
/wd4275) # C4275: non dll-interface class ...' used as base for dll-interface class '...'
|
||||
|
||||
message(STATUS "MSVC: Enabled shared linking")
|
||||
endif()
|
||||
|
||||
# Enable and treat as errors the following warnings to easily detect virtual function signature failures:
|
||||
target_compile_options(acore-warning-interface
|
||||
INTERFACE
|
||||
/we4263 # 'function' : member function does not override any base class virtual member function
|
||||
/we4264) # 'virtual_function' : no override available for virtual member function from base 'class'; function is hidden
|
||||
|
||||
# Disable incremental linking in debug builds.
|
||||
# To prevent linking getting stuck (which might be fixed in a later VS version).
|
||||
macro(DisableIncrementalLinking variable)
|
||||
string(REGEX REPLACE "/INCREMENTAL *" "" ${variable} "${${variable}}")
|
||||
set(${variable} "${${variable}} /INCREMENTAL:NO")
|
||||
endmacro()
|
||||
|
||||
DisableIncrementalLinking(CMAKE_EXE_LINKER_FLAGS_DEBUG)
|
||||
DisableIncrementalLinking(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO)
|
||||
DisableIncrementalLinking(CMAKE_SHARED_LINKER_FLAGS_DEBUG)
|
||||
DisableIncrementalLinking(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO)
|
||||
97
src/cmake/genrev.cmake
Normal file
97
src/cmake/genrev.cmake
Normal file
@@ -0,0 +1,97 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
# User has manually chosen to ignore the git-tests, so throw them a warning.
|
||||
# This is done EACH compile so they can be alerted about the consequences.
|
||||
|
||||
if(NOT BUILDDIR)
|
||||
# Workaround for funny MSVC behaviour - this segment is only used when using cmake gui
|
||||
set(BUILDDIR ${CMAKE_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
if(WITHOUT_GIT)
|
||||
set(rev_date "1970-01-01 00:00:00 +0000")
|
||||
set(rev_hash "unknown")
|
||||
set(rev_branch "Archived")
|
||||
# No valid git commit date, use today
|
||||
string(TIMESTAMP rev_date_fallback "%Y-%m-%d %H:%M:%S" UTC)
|
||||
else()
|
||||
# Workaround for not correctly detecting git
|
||||
if (NOT GIT_EXECUTABLE)
|
||||
set(GIT_EXECUTABLE "git")
|
||||
endif()
|
||||
|
||||
if(GIT_EXECUTABLE)
|
||||
# Create a revision-string that we can use
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" describe --long --match 0.1 --dirty=+ --abbrev=12 --always
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE rev_info
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
|
||||
)
|
||||
|
||||
# And grab the commits timestamp
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" show -s --format=%ci
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE rev_date
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
|
||||
# Also retrieve branch name
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" rev-parse --abbrev-ref HEAD
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE rev_branch
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
endif()
|
||||
|
||||
# Last minute check - ensure that we have a proper revision
|
||||
# If everything above fails (means the user has erased the git revision control directory or removed the origin/HEAD tag)
|
||||
if(NOT rev_info)
|
||||
# No valid ways available to find/set the revision/hash, so let's force some defaults
|
||||
message(STATUS "
|
||||
Could not find a proper repository signature (hash) - you may need to pull tags with git fetch -t
|
||||
Continuing anyway - note that the versionstring will be set to \"unknown 1970-01-01 00:00:00 (Archived)\"")
|
||||
set(rev_date "1970-01-01 00:00:00 +0000")
|
||||
set(rev_hash "unknown")
|
||||
set(rev_branch "Archived")
|
||||
# No valid git commit date, use today
|
||||
string(TIMESTAMP rev_date_fallback "%Y-%m-%d %H:%M:%S" UTC)
|
||||
else()
|
||||
# We have valid date from git commit, use that
|
||||
set(rev_date_fallback ${rev_date})
|
||||
# Extract information required to build a proper versionstring
|
||||
string(REGEX REPLACE 0.1-|[0-9]+-g "" rev_hash ${rev_info})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# For package/copyright information we always need a proper date - keep "Archived/1970" for displaying git info but a valid year elsewhere
|
||||
string(REGEX MATCH "([0-9]+)-([0-9]+)-([0-9]+)" rev_date_fallback_match ${rev_date_fallback})
|
||||
set(rev_year ${CMAKE_MATCH_1})
|
||||
set(rev_month ${CMAKE_MATCH_2})
|
||||
set(rev_day ${CMAKE_MATCH_3})
|
||||
|
||||
# Create the actual revision.h file from the above params
|
||||
if(NOT "${rev_hash_cached}" STREQUAL "${rev_hash}" OR NOT "${rev_branch_cached}" STREQUAL "${rev_branch}" OR NOT EXISTS "${BUILDDIR}/revision.h")
|
||||
configure_file(
|
||||
"${CMAKE_SOURCE_DIR}/src/cmake/revision.h.in.cmake"
|
||||
"${BUILDDIR}/revision.h"
|
||||
@ONLY
|
||||
)
|
||||
set(rev_hash_cached "${rev_hash}" CACHE INTERNAL "Cached commit-hash")
|
||||
set(rev_branch_cached "${rev_branch}" CACHE INTERNAL "Cached branch name")
|
||||
endif()
|
||||
32
src/cmake/googletest-download.cmake
Normal file
32
src/cmake/googletest-download.cmake
Normal file
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
# code copied from https://crascit.com/2015/07/25/cmake-gtest/
|
||||
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
|
||||
|
||||
project(googletest-download NONE)
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
ExternalProject_Add(
|
||||
googletest
|
||||
SOURCE_DIR "@GOOGLETEST_DOWNLOAD_ROOT@/googletest-src"
|
||||
BINARY_DIR "@GOOGLETEST_DOWNLOAD_ROOT@/googletest-build"
|
||||
GIT_REPOSITORY
|
||||
https://github.com/google/googletest.git
|
||||
GIT_TAG
|
||||
release-1.12.1
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
32
src/cmake/googletest.cmake
Normal file
32
src/cmake/googletest.cmake
Normal file
@@ -0,0 +1,32 @@
|
||||
# the following code to fetch googletest
|
||||
# is inspired by and adapted after https://crascit.com/2015/07/25/cmake-gtest/
|
||||
# download and unpack googletest at configure time
|
||||
|
||||
macro(fetch_googletest _download_module_path _download_root)
|
||||
set(GOOGLETEST_DOWNLOAD_ROOT ${_download_root})
|
||||
configure_file(
|
||||
${_download_module_path}/googletest-download.cmake
|
||||
${_download_root}/CMakeLists.txt
|
||||
@ONLY
|
||||
)
|
||||
unset(GOOGLETEST_DOWNLOAD_ROOT)
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
|
||||
WORKING_DIRECTORY
|
||||
${_download_root}
|
||||
)
|
||||
execute_process(
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}" --build .
|
||||
WORKING_DIRECTORY
|
||||
${_download_root}
|
||||
)
|
||||
|
||||
# adds the targers: gtest, gtest_main, gmock, gmock_main
|
||||
add_subdirectory(
|
||||
${_download_root}/googletest-src
|
||||
${_download_root}/googletest-build
|
||||
)
|
||||
endmacro()
|
||||
73
src/cmake/macros/AutoCollect.cmake
Normal file
73
src/cmake/macros/AutoCollect.cmake
Normal file
@@ -0,0 +1,73 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
# Collects all source files into the given variable,
|
||||
# which is useful to include all sources in subdirectories.
|
||||
# Ignores full qualified directories listed in the variadic arguments.
|
||||
#
|
||||
# Use it like:
|
||||
# CollectSourceFiles(
|
||||
# ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
# COMMON_PRIVATE_SOURCES
|
||||
# # Exclude
|
||||
# ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders
|
||||
# ${CMAKE_CURRENT_SOURCE_DIR}/Platform)
|
||||
#
|
||||
function(CollectSourceFiles current_dir variable)
|
||||
list(FIND ARGN "${current_dir}" IS_EXCLUDED)
|
||||
if(IS_EXCLUDED EQUAL -1)
|
||||
file(GLOB COLLECTED_SOURCES
|
||||
${current_dir}/*.c
|
||||
${current_dir}/*.cc
|
||||
${current_dir}/*.cpp
|
||||
${current_dir}/*.inl
|
||||
${current_dir}/*.def
|
||||
${current_dir}/*.h
|
||||
${current_dir}/*.hh
|
||||
${current_dir}/*.hpp)
|
||||
list(APPEND ${variable} ${COLLECTED_SOURCES})
|
||||
|
||||
file(GLOB SUB_DIRECTORIES ${current_dir}/*)
|
||||
foreach(SUB_DIRECTORY ${SUB_DIRECTORIES})
|
||||
if (IS_DIRECTORY ${SUB_DIRECTORY})
|
||||
CollectSourceFiles("${SUB_DIRECTORY}" "${variable}" "${ARGN}")
|
||||
endif()
|
||||
endforeach()
|
||||
set(${variable} ${${variable}} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Collects all subdirectoroies into the given variable,
|
||||
# which is useful to include all subdirectories.
|
||||
# Ignores full qualified directories listed in the variadic arguments.
|
||||
#
|
||||
# Use it like:
|
||||
# CollectIncludeDirectories(
|
||||
# ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
# COMMON_PUBLIC_INCLUDES
|
||||
# # Exclude
|
||||
# ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders
|
||||
# ${CMAKE_CURRENT_SOURCE_DIR}/Platform)
|
||||
#
|
||||
function(CollectIncludeDirectories current_dir variable)
|
||||
list(FIND ARGN "${current_dir}" IS_EXCLUDED)
|
||||
if(IS_EXCLUDED EQUAL -1)
|
||||
list(APPEND ${variable} ${current_dir})
|
||||
file(GLOB SUB_DIRECTORIES ${current_dir}/*)
|
||||
foreach(SUB_DIRECTORY ${SUB_DIRECTORIES})
|
||||
if (IS_DIRECTORY ${SUB_DIRECTORY})
|
||||
CollectIncludeDirectories("${SUB_DIRECTORY}" "${variable}" "${ARGN}")
|
||||
endif()
|
||||
endforeach()
|
||||
set(${variable} ${${variable}} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
25
src/cmake/macros/CheckBuildDir.cmake
Normal file
25
src/cmake/macros/CheckBuildDir.cmake
Normal file
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
#
|
||||
# Force out-of-source build
|
||||
#
|
||||
|
||||
string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" BUILDING_IN_SOURCE)
|
||||
|
||||
if( BUILDING_IN_SOURCE )
|
||||
message(FATAL_ERROR "
|
||||
This project requires an out of source build. Remove the file 'CMakeCache.txt'
|
||||
found in this directory before continuing, create a separate build directory
|
||||
and run 'cmake path_to_project [options]' from there.
|
||||
")
|
||||
endif()
|
||||
30
src/cmake/macros/CheckPlatform.cmake
Normal file
30
src/cmake/macros/CheckPlatform.cmake
Normal file
@@ -0,0 +1,30 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
# check what platform we're on (64-bit or 32-bit), and create a simpler test than CMAKE_SIZEOF_VOID_P
|
||||
if(CMAKE_SIZEOF_VOID_P MATCHES 8)
|
||||
set(PLATFORM 64)
|
||||
MESSAGE(STATUS "Detected 64-bit platform")
|
||||
else()
|
||||
set(PLATFORM 32)
|
||||
MESSAGE(STATUS "Detected 32-bit platform")
|
||||
endif()
|
||||
|
||||
include("${CMAKE_SOURCE_DIR}/src/cmake/platform/settings.cmake")
|
||||
|
||||
if(WIN32)
|
||||
include("${CMAKE_SOURCE_DIR}/src/cmake/platform/win/settings.cmake")
|
||||
elseif(UNIX)
|
||||
include("${CMAKE_SOURCE_DIR}/src/cmake/platform/unix/settings.cmake")
|
||||
endif()
|
||||
|
||||
include("${CMAKE_SOURCE_DIR}/src/cmake/platform/after_platform.cmake")
|
||||
106
src/cmake/macros/ConfigInstall.cmake
Normal file
106
src/cmake/macros/ConfigInstall.cmake
Normal file
@@ -0,0 +1,106 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
#
|
||||
# Use it like:
|
||||
# CopyApplicationConfig(${APP_PROJECT_NAME} ${APPLICATION_NAME})
|
||||
#
|
||||
|
||||
function(CopyApplicationConfig projectName appName)
|
||||
GetPathToApplication(${appName} SOURCE_APP_PATH)
|
||||
|
||||
if(WIN32)
|
||||
if("${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild")
|
||||
add_custom_command(TARGET ${projectName}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/configs")
|
||||
add_custom_command(TARGET ${projectName}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_APP_PATH}/${appName}.conf.dist" "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/configs")
|
||||
elseif(MINGW)
|
||||
add_custom_command(TARGET ${servertype}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/configs")
|
||||
add_custom_command(TARGET ${servertype}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_APP_PATH}/${appName}.conf.dist ${CMAKE_BINARY_DIR}/bin/configs")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
install(FILES "${SOURCE_APP_PATH}/${appName}.conf.dist" DESTINATION "${CONF_DIR}")
|
||||
elseif(WIN32)
|
||||
install(FILES "${SOURCE_APP_PATH}/${appName}.conf.dist" DESTINATION "${CMAKE_INSTALL_PREFIX}/configs")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(CopyToolConfig projectName appName)
|
||||
GetPathToTool(${appName} SOURCE_APP_PATH)
|
||||
|
||||
if(WIN32)
|
||||
if("${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild")
|
||||
add_custom_command(TARGET ${projectName}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/configs")
|
||||
add_custom_command(TARGET ${projectName}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_APP_PATH}/${appName}.conf.dist" "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/configs")
|
||||
elseif(MINGW)
|
||||
add_custom_command(TARGET ${servertype}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/configs")
|
||||
add_custom_command(TARGET ${servertype}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_APP_PATH}/${appName}.conf.dist ${CMAKE_BINARY_DIR}/bin/configs")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
install(FILES "${SOURCE_APP_PATH}/${appName}.conf.dist" DESTINATION "${CONF_DIR}")
|
||||
elseif(WIN32)
|
||||
install(FILES "${SOURCE_APP_PATH}/${appName}.conf.dist" DESTINATION "${CMAKE_INSTALL_PREFIX}/configs")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# Use it like:
|
||||
# CopyModuleConfig("acore.conf.dist")
|
||||
#
|
||||
|
||||
function(CopyModuleConfig configDir)
|
||||
set(postPath "configs/modules")
|
||||
|
||||
if(WIN32)
|
||||
if("${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild")
|
||||
add_custom_command(TARGET modules
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/${postPath}")
|
||||
add_custom_command(TARGET modules
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${configDir}" "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/${postPath}")
|
||||
elseif(MINGW)
|
||||
add_custom_command(TARGET modules
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/${postPath}")
|
||||
add_custom_command(TARGET modules
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${configDir} ${CMAKE_BINARY_DIR}/bin/${postPath}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
install(FILES "${configDir}" DESTINATION "${CONF_DIR}/modules")
|
||||
elseif(WIN32)
|
||||
install(FILES "${configDir}" DESTINATION "${CMAKE_INSTALL_PREFIX}/${postPath}")
|
||||
endif()
|
||||
unset(postPath)
|
||||
endfunction()
|
||||
108
src/cmake/macros/ConfigureApplications.cmake
Normal file
108
src/cmake/macros/ConfigureApplications.cmake
Normal file
@@ -0,0 +1,108 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
set(BUILD_APPLICATION_AUTHSERVER 0)
|
||||
set(BUILD_APPLICATION_WORLDSERVER 0)
|
||||
|
||||
# Returns the base path to the apps directory in the source directory
|
||||
function(GetApplicationsBasePath variable)
|
||||
set(${variable} "${CMAKE_SOURCE_DIR}/src/server/apps" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Stores the absolut path of the given app in the variable
|
||||
function(GetPathToApplication app variable)
|
||||
GetApplicationsBasePath(APPS_BASE_PATH)
|
||||
set(${variable} "${APPS_BASE_PATH}/${app}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Stores the project name of the given app in the variable
|
||||
function(GetProjectNameOfApplicationName app variable)
|
||||
string(TOLOWER "${app}" GENERATED_NAME)
|
||||
set(${variable} "${GENERATED_NAME}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Creates a list of all applications and stores it in the given variable.
|
||||
function(GetApplicationsList variable)
|
||||
GetApplicationsBasePath(BASE_PATH)
|
||||
file(GLOB LOCALE_SOURCE_APP_LIST RELATIVE
|
||||
${BASE_PATH}
|
||||
${BASE_PATH}/*)
|
||||
|
||||
set(${variable})
|
||||
|
||||
foreach(SOURCE_APP ${LOCALE_SOURCE_APP_LIST})
|
||||
GetPathToApplication(${SOURCE_APP} SOURCE_APP_PATH)
|
||||
if(IS_DIRECTORY ${SOURCE_APP_PATH})
|
||||
list(APPEND ${variable} ${SOURCE_APP})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(${variable} ${${variable}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Converts the given application name into it's
|
||||
# variable name which holds the build type.
|
||||
function(ApplicationNameToVariable application variable)
|
||||
string(TOUPPER ${application} ${variable})
|
||||
set(${variable} "APP_${${variable}}")
|
||||
set(${variable} ${${variable}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(CheckApplicationsBuildList)
|
||||
GetApplicationsList(APPLICATIONS_BUILD_LIST)
|
||||
|
||||
if (APPS_BUILD STREQUAL "none")
|
||||
set(APPS_DEFAULT_BUILD "disabled")
|
||||
else()
|
||||
set(APPS_DEFAULT_BUILD "enabled")
|
||||
endif()
|
||||
|
||||
# Sets BUILD_APPS_USE_WHITELIST
|
||||
# Sets BUILD_APPS_WHITELIST
|
||||
if (APPS_BUILD MATCHES "-only")
|
||||
set(BUILD_APPS_USE_WHITELIST ON)
|
||||
|
||||
if (APPS_BUILD STREQUAL "auth-only")
|
||||
list(APPEND BUILD_APPS_WHITELIST authserver)
|
||||
endif()
|
||||
|
||||
if (APPS_BUILD STREQUAL "world-only")
|
||||
list(APPEND BUILD_APPS_WHITELIST worldserver)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
foreach(APPLICATION_BUILD_NAME ${APPLICATIONS_BUILD_LIST})
|
||||
ApplicationNameToVariable(${APPLICATION_BUILD_NAME} APPLICATION_BUILD_VARIABLE)
|
||||
|
||||
if(${APPLICATION_BUILD_VARIABLE} STREQUAL "default")
|
||||
if(BUILD_APPS_USE_WHITELIST)
|
||||
list(FIND BUILD_APPS_WHITELIST "${APPLICATION_BUILD_NAME}" INDEX)
|
||||
if(${INDEX} GREATER -1)
|
||||
set(${APPLICATION_BUILD_VARIABLE} ${APPS_DEFAULT_BUILD})
|
||||
else()
|
||||
set(${APPLICATION_BUILD_VARIABLE} "disabled")
|
||||
endif()
|
||||
else()
|
||||
set(${APPLICATION_BUILD_VARIABLE} ${APPS_DEFAULT_BUILD})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Build the Graph values
|
||||
if(${APPLICATION_BUILD_VARIABLE} MATCHES "enabled")
|
||||
if (${APPLICATION_BUILD_NAME} MATCHES "authserver")
|
||||
set (BUILD_APPLICATION_AUTHSERVER 1 PARENT_SCOPE)
|
||||
elseif(${APPLICATION_BUILD_NAME} MATCHES "worldserver")
|
||||
set (BUILD_APPLICATION_WORLDSERVER 1 PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
66
src/cmake/macros/ConfigureBaseTargets.cmake
Normal file
66
src/cmake/macros/ConfigureBaseTargets.cmake
Normal file
@@ -0,0 +1,66 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
# An interface library to make the target com available to other targets
|
||||
add_library(acore-compile-option-interface INTERFACE)
|
||||
|
||||
# Use -std=c++11 instead of -std=gnu++11
|
||||
set(CXX_EXTENSIONS OFF)
|
||||
|
||||
# Enable C++20 support
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
message(STATUS "Enabled С++20 standard")
|
||||
|
||||
# An interface library to make the warnings level available to other targets
|
||||
# This interface taget is set-up through the platform specific script
|
||||
add_library(acore-warning-interface INTERFACE)
|
||||
|
||||
# An interface used for all other interfaces
|
||||
add_library(acore-default-interface INTERFACE)
|
||||
|
||||
target_link_libraries(acore-default-interface
|
||||
INTERFACE
|
||||
acore-compile-option-interface)
|
||||
|
||||
# An interface used for silencing all warnings
|
||||
add_library(acore-no-warning-interface INTERFACE)
|
||||
|
||||
if (MSVC)
|
||||
target_compile_options(acore-no-warning-interface
|
||||
INTERFACE
|
||||
/W0)
|
||||
else()
|
||||
target_compile_options(acore-no-warning-interface
|
||||
INTERFACE
|
||||
-w)
|
||||
endif()
|
||||
|
||||
# An interface library to change the default behaviour
|
||||
# to hide symbols automatically.
|
||||
add_library(acore-hidden-symbols-interface INTERFACE)
|
||||
|
||||
# An interface amalgamation which provides the flags and definitions
|
||||
# used by the dependency targets.
|
||||
add_library(acore-dependency-interface INTERFACE)
|
||||
target_link_libraries(acore-dependency-interface
|
||||
INTERFACE
|
||||
acore-default-interface
|
||||
acore-no-warning-interface
|
||||
acore-hidden-symbols-interface)
|
||||
|
||||
# An interface amalgamation which provides the flags and definitions
|
||||
# used by the core targets.
|
||||
add_library(acore-core-interface INTERFACE)
|
||||
target_link_libraries(acore-core-interface
|
||||
INTERFACE
|
||||
acore-default-interface
|
||||
acore-warning-interface)
|
||||
73
src/cmake/macros/ConfigureModules.cmake
Normal file
73
src/cmake/macros/ConfigureModules.cmake
Normal file
@@ -0,0 +1,73 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
# Returns the base path to the script directory in the source directory
|
||||
function(GetModulesBasePath variable)
|
||||
set(${variable} "${CMAKE_SOURCE_DIR}/modules" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Stores the absolut path of the given module in the variable
|
||||
function(GetPathToModuleSource module variable)
|
||||
GetModulesBasePath(MODULE_BASE_PATH)
|
||||
set(${variable} "${MODULE_BASE_PATH}/${module}/src" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Stores the project name of the given module in the variable
|
||||
function(GetProjectNameOfModuleName module variable)
|
||||
string(TOLOWER "mod_${SOURCE_MODULE}" GENERATED_NAME)
|
||||
set(${variable} "${GENERATED_NAME}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Creates a list of all script modules
|
||||
# and stores it in the given variable.
|
||||
function(GetModuleSourceList variable)
|
||||
GetModulesBasePath(BASE_PATH)
|
||||
file(GLOB LOCALE_MODULE_LIST RELATIVE
|
||||
${BASE_PATH}
|
||||
${BASE_PATH}/*)
|
||||
|
||||
set(${variable})
|
||||
foreach(SOURCE_MODULE ${LOCALE_MODULE_LIST})
|
||||
GetPathToModuleSource(${SOURCE_MODULE} MODULE_SOURCE_PATH)
|
||||
if(IS_DIRECTORY ${MODULE_SOURCE_PATH})
|
||||
list(APPEND ${variable} ${SOURCE_MODULE})
|
||||
endif()
|
||||
endforeach()
|
||||
set(${variable} ${${variable}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Converts the given script module name into it's
|
||||
# variable name which holds the linkage type.
|
||||
function(ModuleNameToVariable module variable)
|
||||
string(TOUPPER ${module} ${variable})
|
||||
set(${variable} "MODULE_${${variable}}")
|
||||
set(${variable} ${${variable}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Stores in the given variable whether dynamic linking is required
|
||||
function(IsDynamicLinkingModulesRequired variable)
|
||||
if(MODULES MATCHES "dynamic")
|
||||
set(IS_DEFAULT_VALUE_DYNAMIC_MODULE ON)
|
||||
endif()
|
||||
|
||||
GetModuleSourceList(MODULES_MODULE_LIST)
|
||||
set(IS_REQUIRED OFF)
|
||||
foreach(SOURCE_MODULE ${MODULES_MODULE_LIST})
|
||||
ModuleNameToVariable(${SOURCE_MODULE} MODULE_MODULE_VARIABLE)
|
||||
if((${MODULE_MODULE_VARIABLE} STREQUAL "dynamic") OR
|
||||
(${MODULE_MODULE_VARIABLE} STREQUAL "default" AND IS_DEFAULT_VALUE_DYNAMIC_MODULE))
|
||||
set(IS_REQUIRED ON)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
set(${variable} ${IS_REQUIRED} PARENT_SCOPE)
|
||||
endfunction()
|
||||
108
src/cmake/macros/ConfigureScripts.cmake
Normal file
108
src/cmake/macros/ConfigureScripts.cmake
Normal file
@@ -0,0 +1,108 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
# Returns the base path to the script directory in the source directory
|
||||
function(WarnAboutSpacesInBuildPath)
|
||||
# Only check win32 since unix doesn't allow spaces in paths
|
||||
if(WIN32)
|
||||
string(FIND "${CMAKE_BINARY_DIR}" " " SPACE_INDEX_POS)
|
||||
|
||||
if(SPACE_INDEX_POS GREATER -1)
|
||||
message("")
|
||||
message(WARNING " *** WARNING!\n"
|
||||
" *** Your selected build directory contains spaces!\n"
|
||||
" *** Please note that this will cause issues!")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Returns the base path to the script directory in the source directory
|
||||
function(GetScriptsBasePath variable)
|
||||
set(${variable} "${CMAKE_SOURCE_DIR}/src/server/scripts" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Stores the absolut path of the given module in the variable
|
||||
function(GetPathToScriptModule module variable)
|
||||
GetScriptsBasePath(SCRIPTS_BASE_PATH)
|
||||
set(${variable} "${SCRIPTS_BASE_PATH}/${module}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Stores the project name of the given module in the variable
|
||||
function(GetProjectNameOfScriptModule module variable)
|
||||
string(TOLOWER "scripts_${SCRIPT_MODULE}" GENERATED_NAME)
|
||||
set(${variable} "${GENERATED_NAME}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Creates a list of all script modules
|
||||
# and stores it in the given variable.
|
||||
function(GetScriptModuleList variable)
|
||||
GetScriptsBasePath(BASE_PATH)
|
||||
file(GLOB LOCALE_SCRIPT_MODULE_LIST RELATIVE
|
||||
${BASE_PATH}
|
||||
${BASE_PATH}/*)
|
||||
|
||||
set(${variable})
|
||||
foreach(SCRIPT_MODULE ${LOCALE_SCRIPT_MODULE_LIST})
|
||||
GetPathToScriptModule(${SCRIPT_MODULE} SCRIPT_MODULE_PATH)
|
||||
if(IS_DIRECTORY ${SCRIPT_MODULE_PATH})
|
||||
list(APPEND ${variable} ${SCRIPT_MODULE})
|
||||
endif()
|
||||
endforeach()
|
||||
set(${variable} ${${variable}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Converts the given script module name into it's
|
||||
# variable name which holds the linkage type.
|
||||
function(ScriptModuleNameToVariable module variable)
|
||||
string(TOUPPER ${module} ${variable})
|
||||
set(${variable} "SCRIPTS_${${variable}}")
|
||||
set(${variable} ${${variable}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Stores in the given variable whether dynamic linking is required
|
||||
function(IsDynamicLinkingRequired variable)
|
||||
if(SCRIPTS MATCHES "dynamic")
|
||||
set(IS_DEFAULT_VALUE_DYNAMIC ON)
|
||||
endif()
|
||||
|
||||
GetScriptModuleList(SCRIPT_MODULE_LIST)
|
||||
set(IS_REQUIRED OFF)
|
||||
foreach(SCRIPT_MODULE ${SCRIPT_MODULE_LIST})
|
||||
ScriptModuleNameToVariable(${SCRIPT_MODULE} SCRIPT_MODULE_VARIABLE)
|
||||
if((${SCRIPT_MODULE_VARIABLE} STREQUAL "dynamic") OR
|
||||
(${SCRIPT_MODULE_VARIABLE} STREQUAL "default" AND IS_DEFAULT_VALUE_DYNAMIC))
|
||||
set(IS_REQUIRED ON)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
set(${variable} ${IS_REQUIRED} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Stores the native variable name
|
||||
function(GetNativeSharedLibraryName module variable)
|
||||
if(WIN32)
|
||||
set(${variable} "${module}.dll" PARENT_SCOPE)
|
||||
elseif(APPLE)
|
||||
set(${variable} "lib${module}.dylib" PARENT_SCOPE)
|
||||
else()
|
||||
set(${variable} "lib${module}.so" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Stores the native install path in the variable
|
||||
function(GetInstallOffset variable)
|
||||
if(WIN32)
|
||||
set(${variable} "${CMAKE_INSTALL_PREFIX}/scripts" PARENT_SCOPE)
|
||||
else()
|
||||
set(${variable} "${CMAKE_INSTALL_PREFIX}/bin/scripts" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
110
src/cmake/macros/ConfigureTools.cmake
Normal file
110
src/cmake/macros/ConfigureTools.cmake
Normal file
@@ -0,0 +1,110 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
set(BUILD_TOOLS_MAPS 0)
|
||||
set(BUILD_TOOLS_DB_IMPORT 0)
|
||||
|
||||
# Returns the base path to the tools directory in the source directory
|
||||
function(GetToolsBasePath variable)
|
||||
set(${variable} "${CMAKE_SOURCE_DIR}/src/tools" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Stores the absolut path of the given tool in the variable
|
||||
function(GetPathToTool tool variable)
|
||||
GetToolsBasePath(TOOLS_BASE_PATH)
|
||||
set(${variable} "${TOOLS_BASE_PATH}/${tool}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Stores the project name of the given tool in the variable
|
||||
function(GetProjectNameOfToolName tool variable)
|
||||
string(TOLOWER "${tool}" GENERATED_NAME)
|
||||
set(${variable} "${GENERATED_NAME}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Creates a list of all applications and stores it in the given variable.
|
||||
function(GetToolsList variable)
|
||||
GetToolsBasePath(BASE_PATH)
|
||||
file(GLOB LOCALE_SOURCE_TOOL_LIST RELATIVE
|
||||
${BASE_PATH}
|
||||
${BASE_PATH}/*)
|
||||
|
||||
set(${variable})
|
||||
|
||||
foreach(SOURCE_TOOL ${LOCALE_SOURCE_TOOL_LIST})
|
||||
GetPathToTool(${SOURCE_TOOL} SOURCE_TOOL_PATH)
|
||||
if(IS_DIRECTORY ${SOURCE_TOOL_PATH})
|
||||
list(APPEND ${variable} ${SOURCE_TOOL})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(${variable} ${${variable}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Converts the given application name into it's
|
||||
# variable name which holds the build type.
|
||||
function(ToolNameToVariable application variable)
|
||||
string(TOUPPER ${application} ${variable})
|
||||
set(${variable} "TOOL_${${variable}}")
|
||||
set(${variable} ${${variable}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(CheckToolsBuildList)
|
||||
GetToolsList(TOOLS_BUILD_LIST)
|
||||
|
||||
if (TOOLS_BUILD STREQUAL "none")
|
||||
set(TOOLS_DEFAULT_BUILD "disabled")
|
||||
else()
|
||||
set(TOOLS_DEFAULT_BUILD "enabled")
|
||||
endif()
|
||||
|
||||
# Sets BUILD_TOOLS_USE_WHITELIST
|
||||
# Sets BUILD_TOOLS_WHITELIST
|
||||
if (TOOLS_BUILD MATCHES "-only")
|
||||
set(BUILD_TOOLS_USE_WHITELIST ON)
|
||||
|
||||
if (TOOLS_BUILD STREQUAL "maps-only")
|
||||
list(APPEND BUILD_TOOLS_WHITELIST map_extractor mmaps_generator vmap4_assembler vmap4_extractor)
|
||||
endif()
|
||||
|
||||
if (TOOLS_BUILD STREQUAL "db-only")
|
||||
list(APPEND BUILD_TOOLS_WHITELIST dbimport)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Set the TOOL_${TOOL_BUILD_NAME} variables from the
|
||||
# variables set above
|
||||
foreach(TOOL_BUILD_NAME ${TOOLS_BUILD_LIST})
|
||||
ToolNameToVariable(${TOOL_BUILD_NAME} TOOL_BUILD_VARIABLE)
|
||||
|
||||
if (${TOOL_BUILD_VARIABLE} STREQUAL "default")
|
||||
if (BUILD_TOOLS_USE_WHITELIST)
|
||||
list(FIND BUILD_TOOLS_WHITELIST "${TOOL_BUILD_NAME}" INDEX)
|
||||
if (${INDEX} GREATER -1)
|
||||
set(${TOOL_BUILD_VARIABLE} ${TOOLS_DEFAULT_BUILD})
|
||||
else()
|
||||
set(${TOOL_BUILD_VARIABLE} "disabled")
|
||||
endif()
|
||||
else()
|
||||
set(${TOOL_BUILD_VARIABLE} ${TOOLS_DEFAULT_BUILD})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Build the Graph values
|
||||
if (${TOOL_BUILD_VARIABLE} MATCHES "enabled")
|
||||
if (${TOOL_BUILD_NAME} MATCHES "dbimport")
|
||||
set(BUILD_TOOLS_DB_IMPORT 1 PARENT_SCOPE)
|
||||
else()
|
||||
set(BUILD_TOOLS_MAPS 1 PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
114
src/cmake/macros/EnsureVersion.cmake
Normal file
114
src/cmake/macros/EnsureVersion.cmake
Normal file
@@ -0,0 +1,114 @@
|
||||
# This file defines the following macros for developers to use in ensuring
|
||||
# that installed software is of the right version:
|
||||
#
|
||||
# ENSURE_VERSION - test that a version number is greater than
|
||||
# or equal to some minimum
|
||||
# ENSURE_VERSION_RANGE - test that a version number is greater than
|
||||
# or equal to some minimum and less than some
|
||||
# maximum
|
||||
# ENSURE_VERSION2 - deprecated, do not use in new code
|
||||
#
|
||||
|
||||
# ENSURE_VERSION
|
||||
# This macro compares version numbers of the form "x.y.z" or "x.y"
|
||||
# ENSURE_VERSION( FOO_MIN_VERSION FOO_VERSION_FOUND FOO_VERSION_OK)
|
||||
# will set FOO_VERSION_OK to true if FOO_VERSION_FOUND >= FOO_MIN_VERSION
|
||||
# Leading and trailing text is ok, e.g.
|
||||
# ENSURE_VERSION( "2.5.31" "flex 2.5.4a" VERSION_OK)
|
||||
# which means 2.5.31 is required and "flex 2.5.4a" is what was found on the system
|
||||
|
||||
# Copyright (c) 2006, David Faure, <faure@kde.org>
|
||||
# Copyright (c) 2007, Will Stephenson <wstephenson@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
# ENSURE_VERSION_RANGE
|
||||
# This macro ensures that a version number of the form
|
||||
# "x.y.z" or "x.y" falls within a range defined by
|
||||
# min_version <= found_version < max_version.
|
||||
# If this expression holds, FOO_VERSION_OK will be set TRUE
|
||||
#
|
||||
# Example: ENSURE_VERSION_RANGE3( "0.1.0" ${FOOCODE_VERSION} "0.7.0" FOO_VERSION_OK )
|
||||
#
|
||||
# This macro will break silently if any of x,y,z are greater than 100.
|
||||
#
|
||||
# Copyright (c) 2007, Will Stephenson <wstephenson@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
# NORMALIZE_VERSION
|
||||
# Helper macro to convert version numbers of the form "x.y.z"
|
||||
# to an integer equal to 10^4 * x + 10^2 * y + z
|
||||
#
|
||||
# This macro will break silently if any of x,y,z are greater than 100.
|
||||
#
|
||||
# Copyright (c) 2006, David Faure, <faure@kde.org>
|
||||
# Copyright (c) 2007, Will Stephenson <wstephenson@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
# CHECK_RANGE_INCLUSIVE_LOWER
|
||||
# Helper macro to check whether x <= y < z
|
||||
#
|
||||
# Copyright (c) 2007, Will Stephenson <wstephenson@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
MACRO(NORMALIZE_VERSION _requested_version _normalized_version)
|
||||
STRING(REGEX MATCH "[^0-9]*[0-9]+\\.[0-9]+\\.[0-9]+.*" _threePartMatch "${_requested_version}")
|
||||
if (_threePartMatch)
|
||||
# parse the parts of the version string
|
||||
STRING(REGEX REPLACE "[^0-9]*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" _major_vers "${_requested_version}")
|
||||
STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" _minor_vers "${_requested_version}")
|
||||
STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" _patch_vers "${_requested_version}")
|
||||
else (_threePartMatch)
|
||||
STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+" "\\1" _major_vers "${_requested_version}")
|
||||
STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)" "\\1" _minor_vers "${_requested_version}")
|
||||
set(_patch_vers "0")
|
||||
endif (_threePartMatch)
|
||||
|
||||
# compute an overall version number which can be compared at once
|
||||
MATH(EXPR ${_normalized_version} "${_major_vers}*10000 + ${_minor_vers}*100 + ${_patch_vers}")
|
||||
ENDMACRO(NORMALIZE_VERSION)
|
||||
|
||||
MACRO(CHECK_RANGE_INCLUSIVE_LOWER _lower_limit _value _upper_limit _ok)
|
||||
if (${_value} LESS ${_lower_limit})
|
||||
set( ${_ok} FALSE )
|
||||
elseif (${_value} EQUAL ${_lower_limit})
|
||||
set( ${_ok} TRUE )
|
||||
elseif (${_value} EQUAL ${_upper_limit})
|
||||
set( ${_ok} FALSE )
|
||||
elseif (${_value} GREATER ${_upper_limit})
|
||||
set( ${_ok} FALSE )
|
||||
else (${_value} LESS ${_lower_limit})
|
||||
set( ${_ok} TRUE )
|
||||
endif (${_value} LESS ${_lower_limit})
|
||||
ENDMACRO(CHECK_RANGE_INCLUSIVE_LOWER)
|
||||
|
||||
MACRO(ENSURE_VERSION requested_version found_version var_too_old)
|
||||
NORMALIZE_VERSION( ${requested_version} req_vers_num )
|
||||
NORMALIZE_VERSION( ${found_version} found_vers_num )
|
||||
|
||||
if (found_vers_num LESS req_vers_num)
|
||||
set( ${var_too_old} FALSE )
|
||||
else (found_vers_num LESS req_vers_num)
|
||||
set( ${var_too_old} TRUE )
|
||||
endif (found_vers_num LESS req_vers_num)
|
||||
|
||||
ENDMACRO(ENSURE_VERSION)
|
||||
|
||||
MACRO(ENSURE_VERSION2 requested_version2 found_version2 var_too_old2)
|
||||
ENSURE_VERSION( ${requested_version2} ${found_version2} ${var_too_old2})
|
||||
ENDMACRO(ENSURE_VERSION2)
|
||||
|
||||
MACRO(ENSURE_VERSION_RANGE min_version found_version max_version var_ok)
|
||||
NORMALIZE_VERSION( ${min_version} req_vers_num )
|
||||
NORMALIZE_VERSION( ${found_version} found_vers_num )
|
||||
NORMALIZE_VERSION( ${max_version} max_vers_num )
|
||||
|
||||
CHECK_RANGE_INCLUSIVE_LOWER( ${req_vers_num} ${found_vers_num} ${max_vers_num} ${var_ok})
|
||||
ENDMACRO(ENSURE_VERSION_RANGE)
|
||||
243
src/cmake/macros/FindFilesystem.cmake
Normal file
243
src/cmake/macros/FindFilesystem.cmake
Normal file
@@ -0,0 +1,243 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
#
|
||||
# Copied from:
|
||||
# https://github.com/lethal-guitar/RigelEngine/blob/master/cmake/Modules/FindFilesystem.cmake
|
||||
#
|
||||
# Which is copied from:
|
||||
# https://github.com/vector-of-bool/CMakeCM/blob/master/modules/FindFilesystem.cmake
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
|
||||
FindFilesystem
|
||||
##############
|
||||
|
||||
This module supports the C++17 standard library's filesystem utilities. Use the
|
||||
:imp-target:`std::filesystem` imported target to
|
||||
|
||||
Options
|
||||
*******
|
||||
|
||||
The ``COMPONENTS`` argument to this module supports the following values:
|
||||
|
||||
.. find-component:: Experimental
|
||||
:name: fs.Experimental
|
||||
|
||||
Allows the module to find the "experimental" Filesystem TS version of the
|
||||
Filesystem library. This is the library that should be used with the
|
||||
``std::experimental::filesystem`` namespace.
|
||||
|
||||
.. find-component:: Final
|
||||
:name: fs.Final
|
||||
|
||||
Finds the final C++17 standard version of the filesystem library.
|
||||
|
||||
If no components are provided, behaves as if the
|
||||
:find-component:`fs.Final` component was specified.
|
||||
|
||||
If both :find-component:`fs.Experimental` and :find-component:`fs.Final` are
|
||||
provided, first looks for ``Final``, and falls back to ``Experimental`` in case
|
||||
of failure. If ``Final`` is found, :imp-target:`std::filesystem` and all
|
||||
:ref:`variables <fs.variables>` will refer to the ``Final`` version.
|
||||
|
||||
Imported Targets
|
||||
****************
|
||||
|
||||
.. imp-target:: std::filesystem
|
||||
|
||||
The ``std::filesystem`` imported target is defined when any requested
|
||||
version of the C++ filesystem library has been found, whether it is
|
||||
*Experimental* or *Final*.
|
||||
|
||||
If no version of the filesystem library is available, this target will not
|
||||
be defined.
|
||||
|
||||
.. note::
|
||||
This target has ``cxx_std_17`` as an ``INTERFACE``
|
||||
:ref:`compile language standard feature <req-lang-standards>`. Linking
|
||||
to this target will automatically enable C++17 if no later standard
|
||||
version is already required on the linking target.
|
||||
|
||||
.. _fs.variables:
|
||||
|
||||
Variables
|
||||
*********
|
||||
|
||||
.. variable:: CXX_FILESYSTEM_IS_EXPERIMENTAL
|
||||
|
||||
Set to ``TRUE`` when the :find-component:`fs.Experimental` version of C++
|
||||
filesystem library was found, otherwise ``FALSE``.
|
||||
|
||||
.. variable:: CXX_FILESYSTEM_HAVE_FS
|
||||
|
||||
Set to ``TRUE`` when a filesystem header was found.
|
||||
|
||||
.. variable:: CXX_FILESYSTEM_HEADER
|
||||
|
||||
Set to either ``filesystem`` or ``experimental/filesystem`` depending on
|
||||
whether :find-component:`fs.Final` or :find-component:`fs.Experimental` was
|
||||
found.
|
||||
|
||||
.. variable:: CXX_FILESYSTEM_NAMESPACE
|
||||
|
||||
Set to either ``std::filesystem`` or ``std::experimental::filesystem``
|
||||
depending on whether :find-component:`fs.Final` or
|
||||
:find-component:`fs.Experimental` was found.
|
||||
|
||||
Examples
|
||||
********
|
||||
|
||||
Using `find_package(Filesystem)` with no component arguments:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
find_package(Filesystem REQUIRED)
|
||||
|
||||
add_executable(my-program main.cpp)
|
||||
target_link_libraries(my-program PRIVATE std::filesystem)
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
if(TARGET std::filesystem)
|
||||
# This module has already been processed. Don't do it again.
|
||||
return()
|
||||
endif()
|
||||
|
||||
cmake_policy(PUSH)
|
||||
if(POLICY CMP0067)
|
||||
# pass CMAKE_CXX_STANDARD to check_cxx_source_compiles()
|
||||
# has to appear before including CheckCXXSourceCompiles module
|
||||
cmake_policy(SET CMP0067 NEW)
|
||||
endif()
|
||||
|
||||
include(CMakePushCheckState)
|
||||
include(CheckIncludeFileCXX)
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
cmake_push_check_state()
|
||||
|
||||
set(CMAKE_REQUIRED_QUIET ${Filesystem_FIND_QUIETLY})
|
||||
|
||||
# All of our tests required C++17 or later
|
||||
# But AC already sets this in ConfigureBaseTargets.cmake
|
||||
# set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
# Normalize and check the component list we were given
|
||||
set(want_components ${Filesystem_FIND_COMPONENTS})
|
||||
if(Filesystem_FIND_COMPONENTS STREQUAL "")
|
||||
set(want_components Final)
|
||||
endif()
|
||||
|
||||
# Warn on any unrecognized components
|
||||
set(extra_components ${want_components})
|
||||
list(REMOVE_ITEM extra_components Final Experimental)
|
||||
foreach(component IN LISTS extra_components)
|
||||
message(WARNING "Extraneous find_package component for Filesystem: ${component}")
|
||||
endforeach()
|
||||
|
||||
# Detect which of Experimental and Final we should look for
|
||||
set(find_experimental TRUE)
|
||||
set(find_final TRUE)
|
||||
if(NOT "Final" IN_LIST want_components)
|
||||
set(find_final FALSE)
|
||||
endif()
|
||||
if(NOT "Experimental" IN_LIST want_components)
|
||||
set(find_experimental FALSE)
|
||||
endif()
|
||||
|
||||
if(find_final)
|
||||
check_include_file_cxx("filesystem" _CXX_FILESYSTEM_HAVE_HEADER)
|
||||
mark_as_advanced(_CXX_FILESYSTEM_HAVE_HEADER)
|
||||
if(_CXX_FILESYSTEM_HAVE_HEADER)
|
||||
# We found the non-experimental header. Don't bother looking for the
|
||||
# experimental one.
|
||||
set(find_experimental FALSE)
|
||||
endif()
|
||||
else()
|
||||
set(_CXX_FILESYSTEM_HAVE_HEADER FALSE)
|
||||
endif()
|
||||
|
||||
if(find_experimental)
|
||||
check_include_file_cxx("experimental/filesystem" _CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER)
|
||||
mark_as_advanced(_CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER)
|
||||
else()
|
||||
set(_CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER FALSE)
|
||||
endif()
|
||||
|
||||
if(_CXX_FILESYSTEM_HAVE_HEADER)
|
||||
set(_have_fs TRUE)
|
||||
set(_fs_header filesystem)
|
||||
set(_fs_namespace std::filesystem)
|
||||
elseif(_CXX_FILESYSTEM_HAVE_EXPERIMENTAL_HEADER)
|
||||
set(_have_fs TRUE)
|
||||
set(_fs_header experimental/filesystem)
|
||||
set(_fs_namespace std::experimental::filesystem)
|
||||
else()
|
||||
set(_have_fs FALSE)
|
||||
endif()
|
||||
|
||||
set(CXX_FILESYSTEM_HAVE_FS ${_have_fs} CACHE BOOL "TRUE if we have the C++ filesystem headers")
|
||||
set(CXX_FILESYSTEM_HEADER ${_fs_header} CACHE STRING "The header that should be included to obtain the filesystem APIs")
|
||||
set(CXX_FILESYSTEM_NAMESPACE ${_fs_namespace} CACHE STRING "The C++ namespace that contains the filesystem APIs")
|
||||
|
||||
set(_found FALSE)
|
||||
|
||||
if(CXX_FILESYSTEM_HAVE_FS)
|
||||
# We have some filesystem library available. Do link checks
|
||||
string(CONFIGURE [[
|
||||
#include <@CXX_FILESYSTEM_HEADER@>
|
||||
|
||||
int main() {
|
||||
auto cwd = @CXX_FILESYSTEM_NAMESPACE@::current_path();
|
||||
return static_cast<int>(cwd.string().size());
|
||||
}
|
||||
]] code @ONLY)
|
||||
|
||||
# Try to compile a simple filesystem program without any linker flags
|
||||
check_cxx_source_compiles("${code}" CXX_FILESYSTEM_NO_LINK_NEEDED)
|
||||
|
||||
set(can_link ${CXX_FILESYSTEM_NO_LINK_NEEDED})
|
||||
|
||||
if(NOT CXX_FILESYSTEM_NO_LINK_NEEDED)
|
||||
set(prev_libraries ${CMAKE_REQUIRED_LIBRARIES})
|
||||
# Add the libstdc++ flag
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${prev_libraries} -lstdc++fs)
|
||||
check_cxx_source_compiles("${code}" CXX_FILESYSTEM_STDCPPFS_NEEDED)
|
||||
set(can_link ${CXX_FILESYSTEM_STDCPPFS_NEEDED})
|
||||
if(NOT CXX_FILESYSTEM_STDCPPFS_NEEDED)
|
||||
# Try the libc++ flag
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${prev_libraries} -lc++fs)
|
||||
check_cxx_source_compiles("${code}" CXX_FILESYSTEM_CPPFS_NEEDED)
|
||||
set(can_link ${CXX_FILESYSTEM_CPPFS_NEEDED})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(can_link)
|
||||
add_library(std::filesystem INTERFACE IMPORTED)
|
||||
target_compile_features(std::filesystem INTERFACE cxx_std_17)
|
||||
set(_found TRUE)
|
||||
if(CXX_FILESYSTEM_NO_LINK_NEEDED)
|
||||
# on certain linux distros we have a version of libstdc++ which has the final code for c++17 fs in the
|
||||
# libstdc++.so.*. BUT when compiling with g++ < 9, we MUST still link with libstdc++fs.a
|
||||
# libc++ should not suffer from this issue, so, in theory we should be fine with only checking for
|
||||
# GCC's libstdc++
|
||||
if((CMAKE_CXX_COMPILER_ID MATCHES "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.0"))
|
||||
target_link_libraries(std::filesystem INTERFACE -lstdc++fs)
|
||||
endif()
|
||||
elseif(CXX_FILESYSTEM_STDCPPFS_NEEDED)
|
||||
target_link_libraries(std::filesystem INTERFACE -lstdc++fs)
|
||||
elseif(CXX_FILESYSTEM_CPPFS_NEEDED)
|
||||
target_link_libraries(std::filesystem INTERFACE -lc++fs)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
cmake_pop_check_state()
|
||||
|
||||
set(Filesystem_FOUND ${_found} CACHE BOOL "TRUE if we can compile and link a program using std::filesystem" FORCE)
|
||||
|
||||
if(Filesystem_FIND_REQUIRED AND NOT Filesystem_FOUND)
|
||||
message(FATAL_ERROR "Cannot Compile simple program using std::filesystem")
|
||||
endif()
|
||||
|
||||
cmake_policy(POP)
|
||||
49
src/cmake/macros/FindGit.cmake
Normal file
49
src/cmake/macros/FindGit.cmake
Normal file
@@ -0,0 +1,49 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
include(${CMAKE_SOURCE_DIR}/src/cmake/macros/EnsureVersion.cmake)
|
||||
|
||||
set(_REQUIRED_GIT_VERSION "1.7")
|
||||
|
||||
find_program(GIT_EXECUTABLE
|
||||
NAMES
|
||||
git git.cmd
|
||||
HINTS
|
||||
ENV PATH
|
||||
DOC "Full path to git commandline client"
|
||||
)
|
||||
MARK_AS_ADVANCED(GIT_EXECUTABLE)
|
||||
|
||||
if(NOT GIT_EXECUTABLE)
|
||||
message(FATAL_ERROR "
|
||||
Git was NOT FOUND on your system - did you forget to install a recent version, or setting the path to it?
|
||||
Observe that for revision hash/date to work you need at least version ${_REQUIRED_GIT_VERSION}")
|
||||
else()
|
||||
message(STATUS "Found git binary : ${GIT_EXECUTABLE}")
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" --version
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE _GIT_VERSION
|
||||
ERROR_QUIET
|
||||
)
|
||||
|
||||
# make sure we're using minimum the required version of git, so the "dirty-testing" will work properly
|
||||
ensure_version( "${_REQUIRED_GIT_VERSION}" "${_GIT_VERSION}" _GIT_VERSION_OK)
|
||||
|
||||
# throw an error if we don't have a recent enough version of git...
|
||||
if(NOT _GIT_VERSION_OK)
|
||||
message(STATUS "Git version too old : ${_GIT_VERSION}")
|
||||
message(FATAL_ERROR "
|
||||
Git was found but is OUTDATED - did you forget to install a recent version, or setting the path to it?
|
||||
Observe that for revision hash/date to work you need at least version ${_REQUIRED_GIT_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
51
src/cmake/macros/FindGperftools.cmake
Normal file
51
src/cmake/macros/FindGperftools.cmake
Normal file
@@ -0,0 +1,51 @@
|
||||
# Tries to find Gperftools.
|
||||
#
|
||||
# Usage of this module as follows:
|
||||
#
|
||||
# find_package(Gperftools)
|
||||
#
|
||||
# Variables used by this module, they can change the default behaviour and need
|
||||
# to be set before calling find_package:
|
||||
#
|
||||
# Gperftools_ROOT_DIR Set this variable to the root installation of
|
||||
# Gperftools if the module has problems finding
|
||||
# the proper installation path.
|
||||
#
|
||||
# Variables defined by this module:
|
||||
#
|
||||
# GPERFTOOLS_FOUND System has Gperftools libs/headers
|
||||
# GPERFTOOLS_LIBRARIES The Gperftools libraries (tcmalloc & profiler)
|
||||
# GPERFTOOLS_INCLUDE_DIR The location of Gperftools headers
|
||||
|
||||
find_library(GPERFTOOLS_TCMALLOC
|
||||
NAMES tcmalloc
|
||||
HINTS ${Gperftools_ROOT_DIR}/lib)
|
||||
|
||||
find_library(GPERFTOOLS_PROFILER
|
||||
NAMES profiler
|
||||
HINTS ${Gperftools_ROOT_DIR}/lib)
|
||||
|
||||
find_library(GPERFTOOLS_TCMALLOC_AND_PROFILER
|
||||
NAMES tcmalloc_and_profiler
|
||||
HINTS ${Gperftools_ROOT_DIR}/lib)
|
||||
|
||||
find_path(GPERFTOOLS_INCLUDE_DIR
|
||||
NAMES gperftools/heap-profiler.h
|
||||
HINTS ${Gperftools_ROOT_DIR}/include)
|
||||
|
||||
set(GPERFTOOLS_LIBRARIES ${GPERFTOOLS_TCMALLOC_AND_PROFILER})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
Gperftools
|
||||
DEFAULT_MSG
|
||||
GPERFTOOLS_LIBRARIES
|
||||
GPERFTOOLS_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(
|
||||
Gperftools_ROOT_DIR
|
||||
GPERFTOOLS_TCMALLOC
|
||||
GPERFTOOLS_PROFILER
|
||||
GPERFTOOLS_TCMALLOC_AND_PROFILER
|
||||
GPERFTOOLS_LIBRARIES
|
||||
GPERFTOOLS_INCLUDE_DIR)
|
||||
273
src/cmake/macros/FindMySQL.cmake
Normal file
273
src/cmake/macros/FindMySQL.cmake
Normal file
@@ -0,0 +1,273 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
#
|
||||
# Find the MySQL client includes and library
|
||||
#
|
||||
|
||||
# This module defines
|
||||
# MYSQL_INCLUDE_DIR, where to find mysql.h
|
||||
# MYSQL_LIBRARIES, the libraries to link against to connect to MySQL
|
||||
# MYSQL_FOUND, if false, you cannot build anything that requires MySQL.
|
||||
|
||||
# also defined, but not for general use are
|
||||
# MYSQL_LIBRARY, where to find the MySQL library.
|
||||
|
||||
set( MYSQL_FOUND 0 )
|
||||
|
||||
# Find MariaDB for Windows
|
||||
if (WIN32)
|
||||
# Set know versions MariaDB
|
||||
set(_MARIADB_KNOWN_VERSIONS "MariaDB 10.9" "MariaDB 10.8" "MariaDB 10.7" "MariaDB 10.6" "MariaDB 10.5")
|
||||
|
||||
# Set default options
|
||||
set(MARIADB_FOUND_LIB 0)
|
||||
set(MARIADB_FOUND_INCLUDE 0)
|
||||
set(MARIADB_FOUND_EXECUTABLE 0)
|
||||
set(MARIADB_FOUND 0)
|
||||
|
||||
macro(FindLibMariaDB MariaDBVersion)
|
||||
# Find include
|
||||
find_path(MYSQL_INCLUDE_DIR
|
||||
NAMES
|
||||
mysql.h
|
||||
PATHS
|
||||
${MYSQL_ADD_INCLUDE_PATH}
|
||||
"$ENV{ProgramW6432}/${MariaDBVersion}/include/mysql"
|
||||
"$ENV{ProgramFiles}/${MariaDBVersion}/include/mysql"
|
||||
"${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/mysql"
|
||||
DOC
|
||||
"Specify the directory containing mysql.h."
|
||||
)
|
||||
|
||||
if(MYSQL_INCLUDE_DIR)
|
||||
set(MARIADB_FOUND_INCLUDE 1)
|
||||
endif()
|
||||
|
||||
find_library(MYSQL_LIBRARY
|
||||
NAMES
|
||||
libmariadb
|
||||
PATHS
|
||||
${MYSQL_ADD_LIBRARIES_PATH}
|
||||
"$ENV{ProgramW6432}/${MariaDBVersion}/lib"
|
||||
"$ENV{ProgramW6432}/${MariaDBVersion}/lib/opt"
|
||||
"$ENV{ProgramFiles}/${MariaDBVersion}/lib"
|
||||
"$ENV{ProgramFiles}/${MariaDBVersion}/lib/opt"
|
||||
"$ENV{SystemDrive}/${MariaDBVersion}/lib/opt"
|
||||
"${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib"
|
||||
DOC
|
||||
"Specify the location of the mysql library here."
|
||||
)
|
||||
|
||||
if(MYSQL_LIBRARY)
|
||||
set(MARIADB_FOUND_LIB 1)
|
||||
endif()
|
||||
|
||||
find_program(MYSQL_EXECUTABLE mysql
|
||||
PATHS
|
||||
"$ENV{ProgramW6432}/${MariaDBVersion}/bin"
|
||||
"$ENV{ProgramW6432}/${MariaDBVersion}/bin/opt"
|
||||
"$ENV{ProgramFiles}/${MariaDBVersion}/bin"
|
||||
"$ENV{ProgramFiles}/${MariaDBVersion}/bin/opt"
|
||||
"$ENV{SystemDrive}/${MariaDBVersion}/bin/opt"
|
||||
DOC
|
||||
"path to your mysql binary.")
|
||||
|
||||
if (MYSQL_LIBRARY AND MYSQL_INCLUDE_DIR AND MYSQL_EXECUTABLE)
|
||||
set(MARIADB_FOUND 1)
|
||||
endif()
|
||||
|
||||
endmacro(FindLibMariaDB)
|
||||
|
||||
foreach(version ${_MARIADB_KNOWN_VERSIONS})
|
||||
if (NOT MARIADB_FOUND)
|
||||
FindLibMariaDB(${version})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if( UNIX )
|
||||
set(MYSQL_CONFIG_PREFER_PATH "$ENV{MYSQL_HOME}/bin" CACHE FILEPATH
|
||||
"preferred path to MySQL (mysql_config)"
|
||||
)
|
||||
|
||||
find_program(MYSQL_CONFIG mysql_config
|
||||
${MYSQL_CONFIG_PREFER_PATH}
|
||||
/usr/local/mysql/bin/
|
||||
/usr/local/bin/
|
||||
/usr/bin/
|
||||
)
|
||||
|
||||
if( MYSQL_CONFIG )
|
||||
message(STATUS "Using mysql-config: ${MYSQL_CONFIG}")
|
||||
# set INCLUDE_DIR
|
||||
exec_program(${MYSQL_CONFIG}
|
||||
ARGS --include
|
||||
OUTPUT_VARIABLE MY_TMP
|
||||
)
|
||||
|
||||
string(REGEX REPLACE "-I([^ ]*)( .*)?" "\\1" MY_TMP "${MY_TMP}")
|
||||
set(MYSQL_ADD_INCLUDE_PATH ${MY_TMP} CACHE FILEPATH INTERNAL)
|
||||
#message("[DEBUG] MYSQL ADD_INCLUDE_PATH : ${MYSQL_ADD_INCLUDE_PATH}")
|
||||
# set LIBRARY_DIR
|
||||
exec_program(${MYSQL_CONFIG}
|
||||
ARGS --libs_r
|
||||
OUTPUT_VARIABLE MY_TMP
|
||||
)
|
||||
set(MYSQL_ADD_LIBRARIES "")
|
||||
string(REGEX MATCHALL "-l[^ ]*" MYSQL_LIB_LIST "${MY_TMP}")
|
||||
foreach(LIB ${MYSQL_LIB_LIST})
|
||||
string(REGEX REPLACE "[ ]*-l([^ ]*)" "\\1" LIB "${LIB}")
|
||||
list(APPEND MYSQL_ADD_LIBRARIES "${LIB}")
|
||||
#message("[DEBUG] MYSQL ADD_LIBRARIES : ${MYSQL_ADD_LIBRARIES}")
|
||||
endforeach(LIB ${MYSQL_LIB_LIST})
|
||||
|
||||
set(MYSQL_ADD_LIBRARIES_PATH "")
|
||||
string(REGEX MATCHALL "-L[^ ]*" MYSQL_LIBDIR_LIST "${MY_TMP}")
|
||||
foreach(LIB ${MYSQL_LIBDIR_LIST})
|
||||
string(REGEX REPLACE "[ ]*-L([^ ]*)" "\\1" LIB "${LIB}")
|
||||
list(APPEND MYSQL_ADD_LIBRARIES_PATH "${LIB}")
|
||||
#message("[DEBUG] MYSQL ADD_LIBRARIES_PATH : ${MYSQL_ADD_LIBRARIES_PATH}")
|
||||
endforeach(LIB ${MYSQL_LIBS})
|
||||
|
||||
else( MYSQL_CONFIG )
|
||||
set(MYSQL_ADD_LIBRARIES "")
|
||||
list(APPEND MYSQL_ADD_LIBRARIES "mysqlclient_r")
|
||||
endif( MYSQL_CONFIG )
|
||||
endif( UNIX )
|
||||
|
||||
find_path(MYSQL_INCLUDE_DIR
|
||||
NAMES
|
||||
mysql.h
|
||||
PATHS
|
||||
${MYSQL_ADD_INCLUDE_PATH}
|
||||
/usr/include
|
||||
/usr/include/mysql
|
||||
/usr/local/include
|
||||
/usr/local/include/mysql
|
||||
/usr/local/mysql/include
|
||||
"C:/tools/mysql/current/include" # chocolatey package
|
||||
"$ENV{ProgramW6432}/MySQL/MySQL Server 8.1/include"
|
||||
"$ENV{ProgramW6432}/MySQL/MySQL Server 8.0/include"
|
||||
"$ENV{ProgramW6432}/MySQL/MySQL Server 5.7/include"
|
||||
"$ENV{ProgramFiles}/MySQL/MySQL Server 8.1/include"
|
||||
"$ENV{ProgramFiles}/MySQL/MySQL Server 8.0/include"
|
||||
"$ENV{ProgramFiles}/MySQL/MySQL Server 5.7/include"
|
||||
"$ENV{SystemDrive}/MySQL/MySQL Server 8.1/include"
|
||||
"$ENV{SystemDrive}/MySQL/MySQL Server 8.0/include"
|
||||
"$ENV{SystemDrive}/MySQL/MySQL Server 5.7/include"
|
||||
"$ENV{MYSQL_INCLUDE_DIR}"
|
||||
"$ENV{MYSQL_DIR}/include"
|
||||
DOC
|
||||
"Specify the directory containing mysql.h."
|
||||
)
|
||||
|
||||
if( UNIX )
|
||||
foreach(LIB ${MYSQL_ADD_LIBRARIES})
|
||||
find_library( MYSQL_LIBRARY
|
||||
NAMES
|
||||
mysql libmysql ${LIB}
|
||||
PATHS
|
||||
${MYSQL_ADD_LIBRARIES_PATH}
|
||||
/usr/lib
|
||||
/usr/lib/mysql
|
||||
/usr/local/lib
|
||||
/usr/local/lib/mysql
|
||||
/usr/local/mysql/lib
|
||||
DOC "Specify the location of the mysql library here."
|
||||
)
|
||||
endforeach(LIB ${MYSQL_ADD_LIBRARY})
|
||||
endif( UNIX )
|
||||
|
||||
if( WIN32 )
|
||||
find_library( MYSQL_LIBRARY
|
||||
NAMES
|
||||
libmysql
|
||||
PATHS
|
||||
${MYSQL_ADD_LIBRARIES_PATH}
|
||||
"C:/tools/mysql/current/lib" # chocolatey package
|
||||
"$ENV{ProgramW6432}/MySQL/MySQL Server 8.1/lib"
|
||||
"$ENV{ProgramW6432}/MySQL/MySQL Server 8.0/lib"
|
||||
"$ENV{ProgramW6432}/MySQL/MySQL Server 5.7/lib"
|
||||
"$ENV{ProgramFiles}/MySQL/MySQL Server 8.1/lib"
|
||||
"$ENV{ProgramFiles}/MySQL/MySQL Server 8.0/lib"
|
||||
"$ENV{ProgramFiles}/MySQL/MySQL Server 5.7/lib"
|
||||
"$ENV{SystemDrive}/MySQL/MySQL Server 8.1/lib"
|
||||
"$ENV{SystemDrive}/MySQL/MySQL Server 8.0/lib"
|
||||
"$ENV{SystemDrive}/MySQL/MySQL Server 5.7/lib"
|
||||
"$ENV{MYSQL_LIBRARY}"
|
||||
"$ENV{MYSQL_DIR}/lib"
|
||||
DOC "Specify the location of the mysql library here."
|
||||
)
|
||||
endif( WIN32 )
|
||||
|
||||
# On Windows you typically don't need to include any extra libraries
|
||||
# to build MYSQL stuff.
|
||||
if( NOT WIN32 )
|
||||
find_library( MYSQL_EXTRA_LIBRARIES
|
||||
NAMES
|
||||
z zlib
|
||||
PATHS
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
DOC
|
||||
"if more libraries are necessary to link in a MySQL client (typically zlib), specify them here."
|
||||
)
|
||||
else( NOT WIN32 )
|
||||
set( MYSQL_EXTRA_LIBRARIES "" )
|
||||
endif( NOT WIN32 )
|
||||
|
||||
if( UNIX )
|
||||
find_program(MYSQL_EXECUTABLE mysql
|
||||
PATHS
|
||||
${MYSQL_CONFIG_PREFER_PATH}
|
||||
/usr/local/mysql/bin/
|
||||
/usr/local/bin/
|
||||
/usr/bin/
|
||||
DOC
|
||||
"path to your mysql binary."
|
||||
)
|
||||
endif( UNIX )
|
||||
|
||||
if( WIN32 )
|
||||
find_program(MYSQL_EXECUTABLE mysql
|
||||
PATHS
|
||||
"C:/tools/mysql/current/bin" # chocolatey package
|
||||
"$ENV{ProgramW6432}/MySQL/MySQL Server 8.1/bin"
|
||||
"$ENV{ProgramW6432}/MySQL/MySQL Server 8.0/bin"
|
||||
"$ENV{ProgramW6432}/MySQL/MySQL Server 5.7/bin"
|
||||
"$ENV{ProgramFiles}/MySQL/MySQL Server 8.1/bin"
|
||||
"$ENV{ProgramFiles}/MySQL/MySQL Server 8.0/bin"
|
||||
"$ENV{ProgramFiles}/MySQL/MySQL Server 5.7/bin"
|
||||
"$ENV{SystemDrive}/MySQL/MySQL Server 8.1/bin"
|
||||
"$ENV{SystemDrive}/MySQL/MySQL Server 8.0/bin"
|
||||
"$ENV{SystemDrive}/MySQL/MySQL Server 5.7/bin"
|
||||
"$ENV{MYSQL_ROOT}/bin"
|
||||
DOC
|
||||
"path to your mysql binary.")
|
||||
endif( WIN32 )
|
||||
|
||||
if( MYSQL_LIBRARY )
|
||||
if( MYSQL_INCLUDE_DIR )
|
||||
set( MYSQL_FOUND 1 )
|
||||
message(STATUS "Found MySQL library: ${MYSQL_LIBRARY}")
|
||||
message(STATUS "Found MySQL headers: ${MYSQL_INCLUDE_DIR}")
|
||||
else( MYSQL_INCLUDE_DIR )
|
||||
message(FATAL_ERROR "Could not find MySQL headers! Please install the development libraries and headers")
|
||||
endif( MYSQL_INCLUDE_DIR )
|
||||
if( MYSQL_EXECUTABLE )
|
||||
message(STATUS "Found MySQL executable: ${MYSQL_EXECUTABLE}")
|
||||
endif( MYSQL_EXECUTABLE )
|
||||
mark_as_advanced( MYSQL_FOUND MYSQL_LIBRARY MYSQL_EXTRA_LIBRARIES MYSQL_INCLUDE_DIR MYSQL_EXECUTABLE )
|
||||
else( MYSQL_LIBRARY )
|
||||
message(FATAL_ERROR "Could not find the MySQL libraries! Please install the development libraries and headers")
|
||||
endif( MYSQL_LIBRARY )
|
||||
671
src/cmake/macros/FindOpenSSL.cmake
Normal file
671
src/cmake/macros/FindOpenSSL.cmake
Normal file
@@ -0,0 +1,671 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindOpenSSL
|
||||
-----------
|
||||
|
||||
Find the OpenSSL encryption library.
|
||||
|
||||
Optional COMPONENTS
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
This module supports two optional COMPONENTS: ``Crypto`` and ``SSL``. Both
|
||||
components have associated imported targets, as described below.
|
||||
|
||||
Imported Targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines the following :prop_tgt:`IMPORTED` targets:
|
||||
|
||||
``OpenSSL::SSL``
|
||||
The OpenSSL ``ssl`` library, if found.
|
||||
``OpenSSL::Crypto``
|
||||
The OpenSSL ``crypto`` library, if found.
|
||||
``OpenSSL::applink``
|
||||
The OpenSSL ``applink`` components that might be need to be compiled into
|
||||
projects under MSVC. This target is available only if found OpenSSL version
|
||||
is not less than 0.9.8. By linking this target the above OpenSSL targets can
|
||||
be linked even if the project has different MSVC runtime configurations with
|
||||
the above OpenSSL targets. This target has no effect on platforms other than
|
||||
MSVC.
|
||||
|
||||
NOTE: Due to how ``INTERFACE_SOURCES`` are consumed by the consuming target,
|
||||
unless you certainly know what you are doing, it is always preferred to link
|
||||
``OpenSSL::applink`` target as ``PRIVATE`` and to make sure that this target is
|
||||
linked at most once for the whole dependency graph of any library or
|
||||
executable:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
target_link_libraries(myTarget PRIVATE OpenSSL::applink)
|
||||
|
||||
Otherwise you would probably encounter unexpected random problems when building
|
||||
and linking, as both the ISO C and the ISO C++ standard claims almost nothing
|
||||
about what a link process should be.
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module will set the following variables in your project:
|
||||
|
||||
``OPENSSL_FOUND``
|
||||
System has the OpenSSL library. If no components are requested it only
|
||||
requires the crypto library.
|
||||
``OPENSSL_INCLUDE_DIR``
|
||||
The OpenSSL include directory.
|
||||
``OPENSSL_CRYPTO_LIBRARY``
|
||||
The OpenSSL crypto library.
|
||||
``OPENSSL_CRYPTO_LIBRARIES``
|
||||
The OpenSSL crypto library and its dependencies.
|
||||
``OPENSSL_SSL_LIBRARY``
|
||||
The OpenSSL SSL library.
|
||||
``OPENSSL_SSL_LIBRARIES``
|
||||
The OpenSSL SSL library and its dependencies.
|
||||
``OPENSSL_LIBRARIES``
|
||||
All OpenSSL libraries and their dependencies.
|
||||
``OPENSSL_VERSION``
|
||||
This is set to ``$major.$minor.$revision$patch`` (e.g. ``0.9.8s``).
|
||||
``OPENSSL_APPLINK_SOURCE``
|
||||
The sources in the target ``OpenSSL::applink`` that is mentioned above. This
|
||||
variable shall always be undefined if found openssl version is less than
|
||||
0.9.8 or if platform is not MSVC.
|
||||
|
||||
Hints
|
||||
^^^^^
|
||||
|
||||
Set ``OPENSSL_ROOT_DIR`` to the root directory of an OpenSSL installation.
|
||||
Set ``OPENSSL_USE_STATIC_LIBS`` to ``TRUE`` to look for static libraries.
|
||||
Set ``OPENSSL_MSVC_STATIC_RT`` set ``TRUE`` to choose the MT version of the lib.
|
||||
#]=======================================================================]
|
||||
|
||||
set(OPENSSL_EXPECTED_VERSION "1.0")
|
||||
|
||||
macro(_OpenSSL_test_and_find_dependencies ssl_library crypto_library)
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND
|
||||
(("${ssl_library}" MATCHES "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$") OR
|
||||
("${crypto_library}" MATCHES "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$")))
|
||||
set(_OpenSSL_has_dependencies TRUE)
|
||||
find_package(Threads)
|
||||
else()
|
||||
set(_OpenSSL_has_dependencies FALSE)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
function(_OpenSSL_add_dependencies libraries_var)
|
||||
if(CMAKE_THREAD_LIBS_INIT)
|
||||
list(APPEND ${libraries_var} ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
list(APPEND ${libraries_var} ${CMAKE_DL_LIBS})
|
||||
set(${libraries_var} ${${libraries_var}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(_OpenSSL_target_add_dependencies target)
|
||||
if(_OpenSSL_has_dependencies)
|
||||
set_property( TARGET ${target} APPEND PROPERTY INTERFACE_LINK_LIBRARIES Threads::Threads )
|
||||
set_property( TARGET ${target} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS} )
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
if (UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(_OPENSSL QUIET openssl)
|
||||
endif ()
|
||||
|
||||
# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
|
||||
if(OPENSSL_USE_STATIC_LIBS)
|
||||
set(_openssl_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
# http://www.slproweb.com/products/Win32OpenSSL.html
|
||||
set(_OPENSSL_MSI_INSTALL_GUID "")
|
||||
if(PLATFORM EQUAL 64)
|
||||
set(_OPENSSL_MSI_INSTALL_GUID "117551DB-A110-4BBD-BB05-CFE0BCB3ED31")
|
||||
set(_OPENSSL_ROOT_HINTS
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]"
|
||||
${OPENSSL_ROOT_DIR}
|
||||
ENV OPENSSL_ROOT_DIR
|
||||
)
|
||||
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
|
||||
set(_OPENSSL_ROOT_PATHS
|
||||
"${_programfiles}/OpenSSL"
|
||||
"${_programfiles}/OpenSSL-Win64"
|
||||
"C:/OpenSSL/"
|
||||
"C:/OpenSSL-Win64/"
|
||||
)
|
||||
else()
|
||||
set(_OPENSSL_MSI_INSTALL_GUID "A1EEC576-43B9-4E75-9E02-03DA542D2A38")
|
||||
set(_OPENSSL_ROOT_HINTS
|
||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]"
|
||||
${OPENSSL_ROOT_DIR}
|
||||
ENV OPENSSL_ROOT_DIR
|
||||
)
|
||||
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
|
||||
set(_OPENSSL_ROOT_PATHS
|
||||
"${_programfiles}/OpenSSL"
|
||||
"${_programfiles}/OpenSSL-Win32"
|
||||
"C:/OpenSSL/"
|
||||
"C:/OpenSSL-Win32/"
|
||||
)
|
||||
endif()
|
||||
unset(_programfiles)
|
||||
# If OpenSSL was installed using .msi package instead of .exe, Inno Setup registry values are not written to Uninstall\OpenSSL
|
||||
# but because it is only a shim around Inno Setup it does write the location of uninstaller which we can use to determine path
|
||||
get_filename_component(_OPENSSL_MSI_INSTALL_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Inno Setup MSIs\\${_OPENSSL_MSI_INSTALL_GUID};]" DIRECTORY)
|
||||
if(NOT _OPENSSL_MSI_INSTALL_PATH STREQUAL "/")
|
||||
list(INSERT _OPENSSL_ROOT_HINTS 0 ${_OPENSSL_MSI_INSTALL_PATH})
|
||||
endif()
|
||||
else ()
|
||||
set(_OPENSSL_ROOT_HINTS
|
||||
${OPENSSL_ROOT_DIR}
|
||||
ENV OPENSSL_ROOT_DIR
|
||||
)
|
||||
endif ()
|
||||
|
||||
set(_OPENSSL_ROOT_HINTS_AND_PATHS
|
||||
HINTS ${_OPENSSL_ROOT_HINTS}
|
||||
PATHS ${_OPENSSL_ROOT_PATHS}
|
||||
)
|
||||
|
||||
find_path(OPENSSL_INCLUDE_DIR
|
||||
NAMES
|
||||
openssl/ssl.h
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
HINTS
|
||||
${_OPENSSL_INCLUDEDIR}
|
||||
${_OPENSSL_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
)
|
||||
|
||||
if(WIN32 AND NOT CYGWIN)
|
||||
if(MSVC)
|
||||
# /MD and /MDd are the standard values - if someone wants to use
|
||||
# others, the libnames have to change here too
|
||||
# use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b
|
||||
# enable OPENSSL_MSVC_STATIC_RT to get the libs build /MT (Multithreaded no-DLL)
|
||||
# In Visual C++ naming convention each of these four kinds of Windows libraries has it's standard suffix:
|
||||
# * MD for dynamic-release
|
||||
# * MDd for dynamic-debug
|
||||
# * MT for static-release
|
||||
# * MTd for static-debug
|
||||
|
||||
# Implementation details:
|
||||
# We are using the libraries located in the VC subdir instead of the parent directory even though :
|
||||
# libeay32MD.lib is identical to ../libeay32.lib, and
|
||||
# ssleay32MD.lib is identical to ../ssleay32.lib
|
||||
# enable OPENSSL_USE_STATIC_LIBS to use the static libs located in lib/VC/static
|
||||
|
||||
if (OPENSSL_MSVC_STATIC_RT)
|
||||
set(_OPENSSL_MSVC_RT_MODE "MT")
|
||||
else ()
|
||||
set(_OPENSSL_MSVC_RT_MODE "MD")
|
||||
endif ()
|
||||
|
||||
# Since OpenSSL 1.1, lib names are like libcrypto32MTd.lib and libssl32MTd.lib
|
||||
if( "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8" )
|
||||
set(_OPENSSL_MSVC_ARCH_SUFFIX "64")
|
||||
else()
|
||||
set(_OPENSSL_MSVC_ARCH_SUFFIX "32")
|
||||
endif()
|
||||
|
||||
if(OPENSSL_USE_STATIC_LIBS)
|
||||
set(_OPENSSL_STATIC_SUFFIX
|
||||
"_static"
|
||||
)
|
||||
set(_OPENSSL_PATH_SUFFIXES
|
||||
"lib/VC/static"
|
||||
"VC/static"
|
||||
"lib"
|
||||
)
|
||||
else()
|
||||
set(_OPENSSL_STATIC_SUFFIX
|
||||
""
|
||||
)
|
||||
set(_OPENSSL_PATH_SUFFIXES
|
||||
"lib/VC"
|
||||
"VC"
|
||||
"lib"
|
||||
)
|
||||
endif ()
|
||||
|
||||
find_library(LIB_EAY_DEBUG
|
||||
NAMES
|
||||
# When OpenSSL is built with default options, the static library name is suffixed with "_static".
|
||||
# Looking the "libcrypto_static.lib" with a higher priority than "libcrypto.lib" which is the
|
||||
# import library of "libcrypto.dll".
|
||||
libcrypto${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
|
||||
libcrypto${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
|
||||
libcrypto${_OPENSSL_STATIC_SUFFIX}d
|
||||
libeay32${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
|
||||
libeay32${_OPENSSL_STATIC_SUFFIX}d
|
||||
crypto${_OPENSSL_STATIC_SUFFIX}d
|
||||
# When OpenSSL is built with the "-static" option, only the static build is produced,
|
||||
# and it is not suffixed with "_static".
|
||||
libcrypto${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
|
||||
libcrypto${_OPENSSL_MSVC_RT_MODE}d
|
||||
libcryptod
|
||||
libeay32${_OPENSSL_MSVC_RT_MODE}d
|
||||
libeay32d
|
||||
cryptod
|
||||
NAMES_PER_DIR
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES
|
||||
${_OPENSSL_PATH_SUFFIXES}
|
||||
)
|
||||
|
||||
find_library(LIB_EAY_RELEASE
|
||||
NAMES
|
||||
# When OpenSSL is built with default options, the static library name is suffixed with "_static".
|
||||
# Looking the "libcrypto_static.lib" with a higher priority than "libcrypto.lib" which is the
|
||||
# import library of "libcrypto.dll".
|
||||
libcrypto${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
|
||||
libcrypto${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
|
||||
libcrypto${_OPENSSL_STATIC_SUFFIX}
|
||||
libeay32${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
|
||||
libeay32${_OPENSSL_STATIC_SUFFIX}
|
||||
crypto${_OPENSSL_STATIC_SUFFIX}
|
||||
# When OpenSSL is built with the "-static" option, only the static build is produced,
|
||||
# and it is not suffixed with "_static".
|
||||
libcrypto${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
|
||||
libcrypto${_OPENSSL_MSVC_RT_MODE}
|
||||
libcrypto
|
||||
libeay32${_OPENSSL_MSVC_RT_MODE}
|
||||
libeay32
|
||||
crypto
|
||||
NAMES_PER_DIR
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES
|
||||
${_OPENSSL_PATH_SUFFIXES}
|
||||
)
|
||||
|
||||
find_library(SSL_EAY_DEBUG
|
||||
NAMES
|
||||
# When OpenSSL is built with default options, the static library name is suffixed with "_static".
|
||||
# Looking the "libssl_static.lib" with a higher priority than "libssl.lib" which is the
|
||||
# import library of "libssl.dll".
|
||||
libssl${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
|
||||
libssl${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
|
||||
libssl${_OPENSSL_STATIC_SUFFIX}d
|
||||
ssleay32${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
|
||||
ssleay32${_OPENSSL_STATIC_SUFFIX}d
|
||||
ssl${_OPENSSL_STATIC_SUFFIX}d
|
||||
# When OpenSSL is built with the "-static" option, only the static build is produced,
|
||||
# and it is not suffixed with "_static".
|
||||
libssl${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
|
||||
libssl${_OPENSSL_MSVC_RT_MODE}d
|
||||
libssld
|
||||
ssleay32${_OPENSSL_MSVC_RT_MODE}d
|
||||
ssleay32d
|
||||
ssld
|
||||
NAMES_PER_DIR
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES
|
||||
${_OPENSSL_PATH_SUFFIXES}
|
||||
)
|
||||
|
||||
find_library(SSL_EAY_RELEASE
|
||||
NAMES
|
||||
# When OpenSSL is built with default options, the static library name is suffixed with "_static".
|
||||
# Looking the "libssl_static.lib" with a higher priority than "libssl.lib" which is the
|
||||
# import library of "libssl.dll".
|
||||
libssl${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
|
||||
libssl${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
|
||||
libssl${_OPENSSL_STATIC_SUFFIX}
|
||||
ssleay32${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
|
||||
ssleay32${_OPENSSL_STATIC_SUFFIX}
|
||||
ssl${_OPENSSL_STATIC_SUFFIX}
|
||||
# When OpenSSL is built with the "-static" option, only the static build is produced,
|
||||
# and it is not suffixed with "_static".
|
||||
libssl${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
|
||||
libssl${_OPENSSL_MSVC_RT_MODE}
|
||||
libssl
|
||||
ssleay32${_OPENSSL_MSVC_RT_MODE}
|
||||
ssleay32
|
||||
ssl
|
||||
NAMES_PER_DIR
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES
|
||||
${_OPENSSL_PATH_SUFFIXES}
|
||||
)
|
||||
|
||||
set(LIB_EAY_LIBRARY_DEBUG "${LIB_EAY_DEBUG}")
|
||||
set(LIB_EAY_LIBRARY_RELEASE "${LIB_EAY_RELEASE}")
|
||||
set(SSL_EAY_LIBRARY_DEBUG "${SSL_EAY_DEBUG}")
|
||||
set(SSL_EAY_LIBRARY_RELEASE "${SSL_EAY_RELEASE}")
|
||||
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(LIB_EAY)
|
||||
select_library_configurations(SSL_EAY)
|
||||
|
||||
mark_as_advanced(LIB_EAY_LIBRARY_DEBUG LIB_EAY_LIBRARY_RELEASE
|
||||
SSL_EAY_LIBRARY_DEBUG SSL_EAY_LIBRARY_RELEASE)
|
||||
set(OPENSSL_SSL_LIBRARY ${SSL_EAY_LIBRARY} )
|
||||
set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY_LIBRARY} )
|
||||
elseif(MINGW)
|
||||
# same player, for MinGW
|
||||
set(LIB_EAY_NAMES crypto libeay32)
|
||||
set(SSL_EAY_NAMES ssl ssleay32)
|
||||
find_library(LIB_EAY
|
||||
NAMES
|
||||
${LIB_EAY_NAMES}
|
||||
NAMES_PER_DIR
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES
|
||||
"lib/MinGW"
|
||||
"lib"
|
||||
)
|
||||
|
||||
find_library(SSL_EAY
|
||||
NAMES
|
||||
${SSL_EAY_NAMES}
|
||||
NAMES_PER_DIR
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES
|
||||
"lib/MinGW"
|
||||
"lib"
|
||||
)
|
||||
|
||||
mark_as_advanced(SSL_EAY LIB_EAY)
|
||||
set(OPENSSL_SSL_LIBRARY ${SSL_EAY} )
|
||||
set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} )
|
||||
unset(LIB_EAY_NAMES)
|
||||
unset(SSL_EAY_NAMES)
|
||||
else()
|
||||
# Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues:
|
||||
find_library(LIB_EAY
|
||||
NAMES
|
||||
libcrypto
|
||||
libeay32
|
||||
NAMES_PER_DIR
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
HINTS
|
||||
${_OPENSSL_LIBDIR}
|
||||
PATH_SUFFIXES
|
||||
lib
|
||||
)
|
||||
|
||||
find_library(SSL_EAY
|
||||
NAMES
|
||||
libssl
|
||||
ssleay32
|
||||
NAMES_PER_DIR
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
HINTS
|
||||
${_OPENSSL_LIBDIR}
|
||||
PATH_SUFFIXES
|
||||
lib
|
||||
)
|
||||
|
||||
mark_as_advanced(SSL_EAY LIB_EAY)
|
||||
set(OPENSSL_SSL_LIBRARY ${SSL_EAY} )
|
||||
set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY} )
|
||||
endif()
|
||||
else()
|
||||
|
||||
find_library(OPENSSL_SSL_LIBRARY
|
||||
NAMES
|
||||
ssl
|
||||
ssleay32
|
||||
ssleay32MD
|
||||
NAMES_PER_DIR
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
HINTS
|
||||
${_OPENSSL_LIBDIR}
|
||||
${_OPENSSL_LIBRARY_DIRS}
|
||||
PATH_SUFFIXES
|
||||
lib
|
||||
)
|
||||
|
||||
find_library(OPENSSL_CRYPTO_LIBRARY
|
||||
NAMES
|
||||
crypto
|
||||
NAMES_PER_DIR
|
||||
${_OPENSSL_ROOT_HINTS_AND_PATHS}
|
||||
HINTS
|
||||
${_OPENSSL_LIBDIR}
|
||||
${_OPENSSL_LIBRARY_DIRS}
|
||||
PATH_SUFFIXES
|
||||
lib
|
||||
)
|
||||
|
||||
mark_as_advanced(OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY)
|
||||
|
||||
endif()
|
||||
|
||||
set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY})
|
||||
set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
|
||||
set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES} )
|
||||
_OpenSSL_test_and_find_dependencies("${OPENSSL_SSL_LIBRARY}" "${OPENSSL_CRYPTO_LIBRARY}")
|
||||
if(_OpenSSL_has_dependencies)
|
||||
_OpenSSL_add_dependencies( OPENSSL_SSL_LIBRARIES )
|
||||
_OpenSSL_add_dependencies( OPENSSL_CRYPTO_LIBRARIES )
|
||||
_OpenSSL_add_dependencies( OPENSSL_LIBRARIES )
|
||||
endif()
|
||||
|
||||
function(from_hex HEX DEC)
|
||||
string(TOUPPER "${HEX}" HEX)
|
||||
set(_res 0)
|
||||
string(LENGTH "${HEX}" _strlen)
|
||||
|
||||
while (_strlen GREATER 0)
|
||||
math(EXPR _res "${_res} * 16")
|
||||
string(SUBSTRING "${HEX}" 0 1 NIBBLE)
|
||||
string(SUBSTRING "${HEX}" 1 -1 HEX)
|
||||
if (NIBBLE STREQUAL "A")
|
||||
math(EXPR _res "${_res} + 10")
|
||||
elseif (NIBBLE STREQUAL "B")
|
||||
math(EXPR _res "${_res} + 11")
|
||||
elseif (NIBBLE STREQUAL "C")
|
||||
math(EXPR _res "${_res} + 12")
|
||||
elseif (NIBBLE STREQUAL "D")
|
||||
math(EXPR _res "${_res} + 13")
|
||||
elseif (NIBBLE STREQUAL "E")
|
||||
math(EXPR _res "${_res} + 14")
|
||||
elseif (NIBBLE STREQUAL "F")
|
||||
math(EXPR _res "${_res} + 15")
|
||||
else()
|
||||
math(EXPR _res "${_res} + ${NIBBLE}")
|
||||
endif()
|
||||
|
||||
string(LENGTH "${HEX}" _strlen)
|
||||
endwhile()
|
||||
|
||||
set(${DEC} ${_res} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
|
||||
file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str
|
||||
REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
|
||||
|
||||
if(openssl_version_str)
|
||||
# The version number is encoded as 0xMNNFFPPS: major minor fix patch status
|
||||
# The status gives if this is a developer or prerelease and is ignored here.
|
||||
# Major, minor, and fix directly translate into the version numbers shown in
|
||||
# the string. The patch field translates to the single character suffix that
|
||||
# indicates the bug fix state, which 00 -> nothing, 01 -> a, 02 -> b and so
|
||||
# on.
|
||||
|
||||
string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F]).*$"
|
||||
"\\1;\\2;\\3;\\4;\\5" OPENSSL_VERSION_LIST "${openssl_version_str}")
|
||||
list(GET OPENSSL_VERSION_LIST 0 OPENSSL_VERSION_MAJOR)
|
||||
list(GET OPENSSL_VERSION_LIST 1 OPENSSL_VERSION_MINOR)
|
||||
from_hex("${OPENSSL_VERSION_MINOR}" OPENSSL_VERSION_MINOR)
|
||||
list(GET OPENSSL_VERSION_LIST 2 OPENSSL_VERSION_FIX)
|
||||
from_hex("${OPENSSL_VERSION_FIX}" OPENSSL_VERSION_FIX)
|
||||
list(GET OPENSSL_VERSION_LIST 3 OPENSSL_VERSION_PATCH)
|
||||
|
||||
if (NOT OPENSSL_VERSION_PATCH STREQUAL "00")
|
||||
from_hex("${OPENSSL_VERSION_PATCH}" _tmp)
|
||||
# 96 is the ASCII code of 'a' minus 1
|
||||
math(EXPR OPENSSL_VERSION_PATCH_ASCII "${_tmp} + 96")
|
||||
unset(_tmp)
|
||||
# Once anyone knows how OpenSSL would call the patch versions beyond 'z'
|
||||
# this should be updated to handle that, too. This has not happened yet
|
||||
# so it is simply ignored here for now.
|
||||
string(ASCII "${OPENSSL_VERSION_PATCH_ASCII}" OPENSSL_VERSION_PATCH_STRING)
|
||||
endif ()
|
||||
|
||||
set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}${OPENSSL_VERSION_PATCH_STRING}")
|
||||
else ()
|
||||
# Since OpenSSL 3.0.0, the new version format is MAJOR.MINOR.PATCH and
|
||||
# a new OPENSSL_VERSION_STR macro contains exactly that
|
||||
file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" OPENSSL_VERSION_STR
|
||||
REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_STR[\t ]+\"([0-9])+\\.([0-9])+\\.([0-9])+\".*")
|
||||
string(REGEX REPLACE "^.*OPENSSL_VERSION_STR[\t ]+\"([0-9]+\\.[0-9]+\\.[0-9]+)\".*$"
|
||||
"\\1" OPENSSL_VERSION_STR "${OPENSSL_VERSION_STR}")
|
||||
|
||||
set(OPENSSL_VERSION "${OPENSSL_VERSION_STR}")
|
||||
|
||||
unset(OPENSSL_VERSION_STR)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
foreach(_comp IN LISTS OpenSSL_FIND_COMPONENTS)
|
||||
if(_comp STREQUAL "Crypto")
|
||||
if(EXISTS "${OPENSSL_INCLUDE_DIR}" AND
|
||||
(EXISTS "${OPENSSL_CRYPTO_LIBRARY}" OR
|
||||
EXISTS "${LIB_EAY_LIBRARY_DEBUG}" OR
|
||||
EXISTS "${LIB_EAY_LIBRARY_RELEASE}")
|
||||
)
|
||||
set(OpenSSL_${_comp}_FOUND TRUE)
|
||||
else()
|
||||
set(OpenSSL_${_comp}_FOUND FALSE)
|
||||
endif()
|
||||
elseif(_comp STREQUAL "SSL")
|
||||
if(EXISTS "${OPENSSL_INCLUDE_DIR}" AND
|
||||
(EXISTS "${OPENSSL_SSL_LIBRARY}" OR
|
||||
EXISTS "${SSL_EAY_LIBRARY_DEBUG}" OR
|
||||
EXISTS "${SSL_EAY_LIBRARY_RELEASE}")
|
||||
)
|
||||
set(OpenSSL_${_comp}_FOUND TRUE)
|
||||
else()
|
||||
set(OpenSSL_${_comp}_FOUND FALSE)
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "${_comp} is not a valid OpenSSL component")
|
||||
set(OpenSSL_${_comp}_FOUND FALSE)
|
||||
endif()
|
||||
endforeach()
|
||||
unset(_comp)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(OpenSSL
|
||||
REQUIRED_VARS
|
||||
OPENSSL_CRYPTO_LIBRARY
|
||||
OPENSSL_INCLUDE_DIR
|
||||
VERSION_VAR
|
||||
OPENSSL_VERSION
|
||||
HANDLE_COMPONENTS
|
||||
FAIL_MESSAGE
|
||||
"Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR"
|
||||
)
|
||||
|
||||
mark_as_advanced(OPENSSL_INCLUDE_DIR)
|
||||
|
||||
if(OPENSSL_FOUND)
|
||||
message(STATUS "Found OpenSSL library: ${OPENSSL_LIBRARIES}")
|
||||
message(STATUS "Found OpenSSL headers: ${OPENSSL_INCLUDE_DIR}")
|
||||
include(EnsureVersion)
|
||||
ENSURE_VERSION("${OPENSSL_EXPECTED_VERSION}" "${OPENSSL_VERSION}" OPENSSL_VERSION_OK)
|
||||
if(NOT OPENSSL_VERSION_OK)
|
||||
message(FATAL_ERROR "AzerothCore needs OpenSSL version ${OPENSSL_EXPECTED_VERSION} but found too new version ${OPENSSL_VERSION}. AzerothCore needs OpenSSL 1.0.x or 1.1.x to work properly. If you still have problems please install OpenSSL 1.0.x if you still have problems search on forum for TCE00022")
|
||||
endif()
|
||||
|
||||
if(NOT TARGET OpenSSL::Crypto AND
|
||||
(EXISTS "${OPENSSL_CRYPTO_LIBRARY}" OR
|
||||
EXISTS "${LIB_EAY_LIBRARY_DEBUG}" OR
|
||||
EXISTS "${LIB_EAY_LIBRARY_RELEASE}")
|
||||
)
|
||||
add_library(OpenSSL::Crypto UNKNOWN IMPORTED)
|
||||
set_target_properties(OpenSSL::Crypto PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}")
|
||||
if(EXISTS "${OPENSSL_CRYPTO_LIBRARY}")
|
||||
set_target_properties(OpenSSL::Crypto PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${OPENSSL_CRYPTO_LIBRARY}")
|
||||
endif()
|
||||
if(EXISTS "${LIB_EAY_LIBRARY_RELEASE}")
|
||||
set_property(TARGET OpenSSL::Crypto APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(OpenSSL::Crypto PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
|
||||
IMPORTED_LOCATION_RELEASE "${LIB_EAY_LIBRARY_RELEASE}")
|
||||
endif()
|
||||
if(EXISTS "${LIB_EAY_LIBRARY_DEBUG}")
|
||||
set_property(TARGET OpenSSL::Crypto APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(OpenSSL::Crypto PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
|
||||
IMPORTED_LOCATION_DEBUG "${LIB_EAY_LIBRARY_DEBUG}")
|
||||
endif()
|
||||
_OpenSSL_target_add_dependencies(OpenSSL::Crypto)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET OpenSSL::SSL AND
|
||||
(EXISTS "${OPENSSL_SSL_LIBRARY}" OR
|
||||
EXISTS "${SSL_EAY_LIBRARY_DEBUG}" OR
|
||||
EXISTS "${SSL_EAY_LIBRARY_RELEASE}")
|
||||
)
|
||||
add_library(OpenSSL::SSL UNKNOWN IMPORTED)
|
||||
set_target_properties(OpenSSL::SSL PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}")
|
||||
if(EXISTS "${OPENSSL_SSL_LIBRARY}")
|
||||
set_target_properties(OpenSSL::SSL PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${OPENSSL_SSL_LIBRARY}")
|
||||
endif()
|
||||
if(EXISTS "${SSL_EAY_LIBRARY_RELEASE}")
|
||||
set_property(TARGET OpenSSL::SSL APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(OpenSSL::SSL PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
|
||||
IMPORTED_LOCATION_RELEASE "${SSL_EAY_LIBRARY_RELEASE}")
|
||||
endif()
|
||||
if(EXISTS "${SSL_EAY_LIBRARY_DEBUG}")
|
||||
set_property(TARGET OpenSSL::SSL APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(OpenSSL::SSL PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
|
||||
IMPORTED_LOCATION_DEBUG "${SSL_EAY_LIBRARY_DEBUG}")
|
||||
endif()
|
||||
if(TARGET OpenSSL::Crypto)
|
||||
set_target_properties(OpenSSL::SSL PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES OpenSSL::Crypto)
|
||||
endif()
|
||||
_OpenSSL_target_add_dependencies(OpenSSL::SSL)
|
||||
endif()
|
||||
|
||||
if("${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_FIX}" VERSION_GREATER_EQUAL "0.9.8")
|
||||
if(MSVC)
|
||||
if(EXISTS "${OPENSSL_INCLUDE_DIR}")
|
||||
set(_OPENSSL_applink_paths PATHS ${OPENSSL_INCLUDE_DIR})
|
||||
endif()
|
||||
find_file(OPENSSL_APPLINK_SOURCE
|
||||
NAMES
|
||||
openssl/applink.c
|
||||
${_OPENSSL_applink_paths}
|
||||
NO_DEFAULT_PATH)
|
||||
if(OPENSSL_APPLINK_SOURCE)
|
||||
set(_OPENSSL_applink_interface_srcs ${OPENSSL_APPLINK_SOURCE})
|
||||
endif()
|
||||
endif()
|
||||
if(NOT TARGET OpenSSL::applink)
|
||||
add_library(OpenSSL::applink INTERFACE IMPORTED)
|
||||
set_property(TARGET OpenSSL::applink APPEND
|
||||
PROPERTY INTERFACE_SOURCES
|
||||
${_OPENSSL_applink_interface_srcs})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Restore the original find library ordering
|
||||
if(OPENSSL_USE_STATIC_LIBS)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_openssl_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
endif()
|
||||
17
src/cmake/macros/FindPCHSupport.cmake
Normal file
17
src/cmake/macros/FindPCHSupport.cmake
Normal file
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
function(ADD_CXX_PCH TARGET_NAME_LIST PCH_HEADER)
|
||||
foreach(TARGET_NAME ${TARGET_NAME_LIST})
|
||||
target_precompile_headers(${TARGET_NAME} PRIVATE ${PCH_HEADER})
|
||||
endforeach()
|
||||
endfunction(ADD_CXX_PCH)
|
||||
48
src/cmake/macros/GroupSources.cmake
Normal file
48
src/cmake/macros/GroupSources.cmake
Normal file
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
macro(GroupSources dir)
|
||||
# Skip this if WITH_SOURCE_TREE is not set (empty string).
|
||||
if (NOT ${WITH_SOURCE_TREE} STREQUAL "")
|
||||
# Include all header and c files
|
||||
file(GLOB_RECURSE elements RELATIVE ${dir} *.h *.hpp *.c *.cpp *.cc)
|
||||
|
||||
foreach(element ${elements})
|
||||
# Extract filename and directory
|
||||
get_filename_component(element_name ${element} NAME)
|
||||
get_filename_component(element_dir ${element} DIRECTORY)
|
||||
|
||||
if (NOT ${element_dir} STREQUAL "")
|
||||
# If the file is in a subdirectory use it as source group.
|
||||
if (${WITH_SOURCE_TREE} STREQUAL "flat")
|
||||
# Build flat structure by using only the first subdirectory.
|
||||
string(FIND ${element_dir} "/" delemiter_pos)
|
||||
if (NOT ${delemiter_pos} EQUAL -1)
|
||||
string(SUBSTRING ${element_dir} 0 ${delemiter_pos} group_name)
|
||||
source_group("${group_name}" FILES ${dir}/${element})
|
||||
else()
|
||||
# Build hierarchical structure.
|
||||
# File is in root directory.
|
||||
source_group("${element_dir}" FILES ${dir}/${element})
|
||||
endif()
|
||||
else()
|
||||
# Use the full hierarchical structure to build source_groups.
|
||||
string(REPLACE "/" "\\" group_name ${element_dir})
|
||||
source_group("${group_name}" FILES ${dir}/${element})
|
||||
endif()
|
||||
else()
|
||||
# If the file is in the root directory, place it in the root source_group.
|
||||
source_group("\\" FILES ${dir}/${element})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endmacro()
|
||||
16
src/cmake/platform/after_platform.cmake
Normal file
16
src/cmake/platform/after_platform.cmake
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
if( NOT CONF_DIR )
|
||||
set(CONF_DIR ${CMAKE_INSTALL_PREFIX})
|
||||
message(STATUS "Using installation path for configuration files")
|
||||
endif()
|
||||
35
src/cmake/platform/cmake_uninstall.in.cmake
Normal file
35
src/cmake/platform/cmake_uninstall.in.cmake
Normal file
@@ -0,0 +1,35 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
# from cmake wiki
|
||||
IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
|
||||
ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
|
||||
FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
||||
STRING(REGEX REPLACE "\n" ";" files "${files}")
|
||||
FOREACH(file ${files})
|
||||
MESSAGE(STATUS "Uninstalling \"${file}\"")
|
||||
IF(EXISTS "${file}")
|
||||
EXEC_PROGRAM(
|
||||
"@CMAKE_COMMAND@" ARGS "-E remove \"${file}\""
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RETURN_VALUE rm_retval
|
||||
)
|
||||
IF("${rm_retval}" STREQUAL 0)
|
||||
ELSE("${rm_retval}" STREQUAL 0)
|
||||
MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"")
|
||||
ENDIF("${rm_retval}" STREQUAL 0)
|
||||
ELSE(EXISTS "${file}")
|
||||
MESSAGE(STATUS "File \"${file}\" does not exist.")
|
||||
ENDIF(EXISTS "${file}")
|
||||
ENDFOREACH(file)
|
||||
16
src/cmake/platform/settings.cmake
Normal file
16
src/cmake/platform/settings.cmake
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
# set installation prefix
|
||||
if( PREFIX )
|
||||
set(CMAKE_INSTALL_PREFIX "${PREFIX}")
|
||||
endif()
|
||||
58
src/cmake/platform/unix/settings.cmake
Normal file
58
src/cmake/platform/unix/settings.cmake
Normal file
@@ -0,0 +1,58 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
# Package overloads - Linux
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
if (NOT NOJEM)
|
||||
set(JEMALLOC_LIBRARY "jemalloc")
|
||||
message(STATUS "UNIX: Using jemalloc")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# set default configuration directory
|
||||
if( NOT CONF_DIR )
|
||||
set(CONF_DIR ${CMAKE_INSTALL_PREFIX}/etc)
|
||||
message(STATUS "UNIX: Using default configuration directory")
|
||||
endif()
|
||||
|
||||
# set default library directory
|
||||
if( NOT LIBSDIR )
|
||||
set(LIBSDIR ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
message(STATUS "UNIX: Using default library directory")
|
||||
endif()
|
||||
|
||||
# configure uninstaller
|
||||
configure_file(
|
||||
"${CMAKE_SOURCE_DIR}/src/cmake/platform/cmake_uninstall.in.cmake"
|
||||
"${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
@ONLY
|
||||
)
|
||||
message(STATUS "UNIX: Configuring uninstall target")
|
||||
|
||||
# create uninstaller target (allows for using "make uninstall")
|
||||
add_custom_target(uninstall
|
||||
"${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
)
|
||||
message(STATUS "UNIX: Created uninstall target")
|
||||
|
||||
message(STATUS "UNIX: Detected compiler: ${CMAKE_C_COMPILER}")
|
||||
if(CMAKE_C_COMPILER MATCHES "gcc" OR CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
include(${CMAKE_SOURCE_DIR}/src/cmake/compiler/gcc/settings.cmake)
|
||||
elseif(CMAKE_C_COMPILER MATCHES "icc")
|
||||
include(${CMAKE_SOURCE_DIR}/src/cmake/compiler/icc/settings.cmake)
|
||||
elseif(CMAKE_C_COMPILER MATCHES "clang" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
include(${CMAKE_SOURCE_DIR}/src/cmake/compiler/clang/settings.cmake)
|
||||
else()
|
||||
target_compile_definitions(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-D_BUILD_DIRECTIVE="${CMAKE_BUILD_TYPE}")
|
||||
endif()
|
||||
38
src/cmake/platform/win/settings.cmake
Normal file
38
src/cmake/platform/win/settings.cmake
Normal file
@@ -0,0 +1,38 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
# Platform-specfic options
|
||||
option(USE_MYSQL_SOURCES "Use included MySQL-sources to build libraries" 0)
|
||||
|
||||
if( USE_MYSQL_SOURCES )
|
||||
set(MYSQL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/deps/mysqllite/include)
|
||||
set(MYSQL_LIBRARY "libmysql")
|
||||
set( MYSQL_FOUND 1 )
|
||||
message(STATUS "Using supplied MySQL sources")
|
||||
endif()
|
||||
|
||||
# check the CMake preload parameters (commented out by default)
|
||||
|
||||
# overload CMAKE_INSTALL_PREFIX if not being set properly
|
||||
#if( WIN32 )
|
||||
# if( NOT CYGWIN )
|
||||
# if( NOT CMAKE_INSTALL_PREFIX )
|
||||
# set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/bin")
|
||||
# endif()
|
||||
# endif()
|
||||
#endif()
|
||||
|
||||
if ( MSVC )
|
||||
include(${CMAKE_SOURCE_DIR}/src/cmake/compiler/msvc/settings.cmake)
|
||||
elseif ( MINGW )
|
||||
include(${CMAKE_SOURCE_DIR}/src/cmake/compiler/mingw/settings.cmake)
|
||||
endif()
|
||||
19
src/cmake/revision.h.in.cmake
Normal file
19
src/cmake/revision.h.in.cmake
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef __REVISION_H__
|
||||
#define __REVISION_H__
|
||||
#define _REVISION "@rev_id_str@"
|
||||
#define _HASH "@rev_hash@"
|
||||
#define _DATE "@rev_date@"
|
||||
#define _BRANCH "@rev_branch@"
|
||||
#define _CMAKE_COMMAND R"(@CMAKE_COMMAND@)"
|
||||
#define _CMAKE_VERSION R"(@CMAKE_VERSION@)"
|
||||
#define _CMAKE_HOST_SYSTEM R"(@CMAKE_HOST_SYSTEM_NAME@ @CMAKE_HOST_SYSTEM_VERSION@)"
|
||||
#define _SOURCE_DIRECTORY R"(@CMAKE_SOURCE_DIR@)"
|
||||
#define _BUILD_DIRECTORY R"(@BUILDDIR@)"
|
||||
#define _MYSQL_EXECUTABLE R"(@MYSQL_EXECUTABLE@)"
|
||||
#define VER_COMPANYNAME_STR "AzerothCore"
|
||||
#define VER_LEGALCOPYRIGHT_STR "(c)2016-@rev_year@ AzerothCore"
|
||||
#define VER_FILEVERSION 0,0,0
|
||||
#define VER_FILEVERSION_STR "@rev_hash@ @rev_date@ (@rev_branch@ branch)"
|
||||
#define VER_PRODUCTVERSION VER_FILEVERSION
|
||||
#define VER_PRODUCTVERSION_STR VER_FILEVERSION_STR
|
||||
#endif // __REVISION_H__
|
||||
215
src/cmake/showoptions.cmake
Normal file
215
src/cmake/showoptions.cmake
Normal file
@@ -0,0 +1,215 @@
|
||||
#
|
||||
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
|
||||
# output generic information about the core and buildtype chosen
|
||||
message("")
|
||||
message("* AzerothCore revision : ${rev_hash} ${rev_date} (${rev_branch} branch)")
|
||||
if( UNIX )
|
||||
message("* AzerothCore buildtype : ${CMAKE_BUILD_TYPE}")
|
||||
endif()
|
||||
message("")
|
||||
|
||||
# output information about installation-directories and locations
|
||||
|
||||
message("* Install core to : ${CMAKE_INSTALL_PREFIX}")
|
||||
if( UNIX )
|
||||
message("* Install libraries to : ${LIBSDIR}")
|
||||
endif()
|
||||
|
||||
message("* Install configs to : ${CONF_DIR}")
|
||||
add_definitions(-D_CONF_DIR=$<1:"${CONF_DIR}">)
|
||||
|
||||
message("")
|
||||
|
||||
# Show infomation about the options selected during configuration
|
||||
|
||||
if (APPS_BUILD AND (NOT APPS_BUILD STREQUAL "none"))
|
||||
message("* Build applications : Yes (${APPS_BUILD})")
|
||||
else()
|
||||
message("* Build applications : No")
|
||||
endif()
|
||||
|
||||
if (TOOLS_BUILD AND (NOT TOOLS_BUILD STREQUAL "none"))
|
||||
message("* Build tools : Yes (${TOOLS_BUILD})")
|
||||
add_definitions(-DNO_CORE_FUNCS)
|
||||
else()
|
||||
message("* Build tools : No")
|
||||
endif()
|
||||
|
||||
if (SCRIPTS AND (NOT SCRIPTS STREQUAL "none"))
|
||||
message("* Build with scripts : Yes (${SCRIPTS})")
|
||||
|
||||
else()
|
||||
message("* Build with scripts : No")
|
||||
endif()
|
||||
|
||||
if (MODULES AND (NOT MODULES STREQUAL "none"))
|
||||
message("* Build with modules : Yes (${MODULES})")
|
||||
else()
|
||||
message("* Build with modules : No")
|
||||
endif()
|
||||
|
||||
if( BUILD_TESTING )
|
||||
message("* Build unit tests : Yes")
|
||||
else()
|
||||
message("* Build unit tests : No (default)")
|
||||
endif()
|
||||
|
||||
if( USE_COREPCH )
|
||||
message("* Build core w/PCH : Yes (default)")
|
||||
else()
|
||||
message("* Build core w/PCH : No")
|
||||
endif()
|
||||
|
||||
if( USE_SCRIPTPCH )
|
||||
message("* Build scripts w/PCH : Yes (default)")
|
||||
else()
|
||||
message("* Build scripts w/PCH : No")
|
||||
endif()
|
||||
|
||||
if( WITH_WARNINGS )
|
||||
message("* Show all warnings : Yes")
|
||||
else()
|
||||
message("* Show compile-warnings : No (default)")
|
||||
endif()
|
||||
|
||||
if( WITH_COREDEBUG )
|
||||
message("* Use coreside debug : Yes")
|
||||
add_definitions(-DACORE_DEBUG)
|
||||
else()
|
||||
message("* Use coreside debug : No (default)")
|
||||
endif()
|
||||
|
||||
if ( UNIX )
|
||||
if( WITH_PERFTOOLS )
|
||||
message("* Use unix gperftools : Yes")
|
||||
add_definitions(-DPERF_TOOLS)
|
||||
else()
|
||||
message("* Use unix gperftools : No (default)")
|
||||
endif()
|
||||
endif( UNIX )
|
||||
|
||||
if( WIN32 )
|
||||
if( USE_MYSQL_SOURCES )
|
||||
message("* Use MySQL sourcetree : Yes (default)")
|
||||
else()
|
||||
message("* Use MySQL sourcetree : No")
|
||||
endif()
|
||||
endif( WIN32 )
|
||||
|
||||
if ( WITHOUT_GIT )
|
||||
message("* Use GIT revision hash : No")
|
||||
message("")
|
||||
message(" *** WITHOUT_GIT - WARNING!")
|
||||
message(" *** By choosing the WITHOUT_GIT option you have waived all rights for support,")
|
||||
message(" *** and accept that or all requests for support or assistance sent to the core")
|
||||
message(" *** developers will be rejected. This due to that we will be unable to detect")
|
||||
message(" *** what revision of the codebase you are using in a proper way.")
|
||||
message(" *** We remind you that you need to use the repository codebase and a supported")
|
||||
message(" *** version of git for the revision-hash to work, and be allowede to ask for")
|
||||
message(" *** support if needed.")
|
||||
else()
|
||||
message("* Use GIT revision hash : Yes (default)")
|
||||
endif()
|
||||
|
||||
if ( NOJEM )
|
||||
message("")
|
||||
message(" *** NOJEM - WARNING!")
|
||||
message(" *** jemalloc linking has been disabled!")
|
||||
message(" *** Please note that this is for DEBUGGING WITH VALGRIND only!")
|
||||
message(" *** DO NOT DISABLE IT UNLESS YOU KNOW WHAT YOU'RE DOING!")
|
||||
endif()
|
||||
|
||||
# Performance optimization options:
|
||||
|
||||
if( ENABLE_VMAP_CHECKS )
|
||||
message("* Enable vmap DisableMgr checks : Yes (default)")
|
||||
add_definitions(-DENABLE_VMAP_CHECKS)
|
||||
else()
|
||||
message("* Enable vmap DisableMgr checks : No")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
if(NOT WITH_SOURCE_TREE STREQUAL "no")
|
||||
message("* Show source tree : Yes - \"${WITH_SOURCE_TREE}\"")
|
||||
else()
|
||||
message("* Show source tree : No")
|
||||
endif()
|
||||
else()
|
||||
message("* Show source tree : No (For UNIX default)")
|
||||
endif()
|
||||
|
||||
if(WITH_STRICT_DATABASE_TYPE_CHECKS)
|
||||
message("")
|
||||
message(" *** WITH_STRICT_DATABASE_TYPE_CHECKS - WARNING!")
|
||||
message(" *** Validates uses of database Get***() functions from Field class")
|
||||
message(" *** invalid calls will result in returning value 0")
|
||||
message(" *** NOT COMPATIBLE WITH MARIADB!")
|
||||
add_definitions(-DACORE_STRICT_DATABASE_TYPE_CHECKS)
|
||||
endif()
|
||||
|
||||
if(WITHOUT_METRICS)
|
||||
message("")
|
||||
message(" *** WITHOUT_METRICS - WARNING!")
|
||||
message(" *** Please note that this will disable all metrics output (i.e. InfluxDB and Grafana)")
|
||||
add_definitions(-DWITHOUT_METRICS)
|
||||
elseif (WITH_DETAILED_METRICS)
|
||||
message("")
|
||||
message(" *** WITH_DETAILED_METRICS - WARNING!")
|
||||
message(" *** Please note that this will enable detailed metrics output (i.e. time each session takes to update)")
|
||||
add_definitions(-DWITH_DETAILED_METRICS)
|
||||
endif()
|
||||
|
||||
if(MSAN)
|
||||
message("")
|
||||
message(" *** MSAN - WARNING!")
|
||||
message(" *** Please note that this is for DEBUGGING WITH MEMORY SANITIZER only!")
|
||||
add_definitions(-DMSAN)
|
||||
endif()
|
||||
|
||||
if(UBSAN)
|
||||
message("")
|
||||
message(" *** UBSAN - WARNING!")
|
||||
message(" *** Please note that this is for DEBUGGING WITH UNDEFINED BEHAVIOR SANITIZER only!")
|
||||
add_definitions(-DUBSAN)
|
||||
endif()
|
||||
|
||||
if(TSAN)
|
||||
message("")
|
||||
message(" *** TSAN - WARNING!")
|
||||
message(" *** Please note that this is for DEBUGGING WITH THREAD SANITIZER only!")
|
||||
add_definitions(-DTSAN -DNO_BUFFERPOOL)
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
message("")
|
||||
message(" *** WITH_DYNAMIC_LINKING - INFO!")
|
||||
message(" *** Will link against shared libraries!")
|
||||
message(" *** Please note that this is an experimental feature!")
|
||||
if(WITH_DYNAMIC_LINKING_FORCED)
|
||||
message("")
|
||||
message(" *** Dynamic linking was enforced through a dynamic script module!")
|
||||
endif()
|
||||
add_definitions(-DACORE_API_USE_DYNAMIC_LINKING)
|
||||
|
||||
WarnAboutSpacesInBuildPath()
|
||||
endif()
|
||||
|
||||
if (CONFIG_ABORT_INCORRECT_OPTIONS)
|
||||
message("")
|
||||
message(" WARNING !")
|
||||
message(" Enabled abort if core found incorrect option in config files")
|
||||
|
||||
add_definitions(-DCONFIG_ABORT_INCORRECT_OPTIONS)
|
||||
endif()
|
||||
|
||||
message("")
|
||||
Reference in New Issue
Block a user