rework cmake files
This commit is contained in:
@@ -1,271 +0,0 @@
|
||||
# FindSystemBoost.cmake - Locate system Boost 1.89+ with fallback support
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
|
||||
# Check for environment variable or CMake variable first
|
||||
if(DEFINED ENV{BOOST_ROOT})
|
||||
set(BOOST_ROOT $ENV{BOOST_ROOT})
|
||||
message(STATUS "Using BOOST_ROOT from environment: ${BOOST_ROOT}")
|
||||
elseif(NOT DEFINED BOOST_ROOT)
|
||||
# Fallback: Try common installation locations
|
||||
if(WIN32)
|
||||
if(EXISTS "C:/libs/boost_1_89_0-bin-msvc-all-32-64/boost_1_89_0")
|
||||
set(BOOST_ROOT "C:/libs/boost_1_89_0-bin-msvc-all-32-64/boost_1_89_0")
|
||||
message(STATUS "Using default Boost location: ${BOOST_ROOT}")
|
||||
elseif(EXISTS "C:/local/boost_1_89_0")
|
||||
set(BOOST_ROOT "C:/local/boost_1_89_0")
|
||||
message(STATUS "Using Boost at C:/local: ${BOOST_ROOT}")
|
||||
elseif(EXISTS "C:/Program Files/boost/boost_1_89_0")
|
||||
set(BOOST_ROOT "C:/Program Files/boost/boost_1_89_0")
|
||||
message(STATUS "Using Boost at Program Files: ${BOOST_ROOT}")
|
||||
endif()
|
||||
else()
|
||||
# Linux/Unix fallback paths
|
||||
if(EXISTS "/usr/local/boost_1_89_0")
|
||||
set(BOOST_ROOT "/usr/local/boost_1_89_0")
|
||||
elseif(EXISTS "/opt/boost_1_89_0")
|
||||
set(BOOST_ROOT "/opt/boost_1_89_0")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Only proceed with custom logic if BOOST_ROOT is set
|
||||
if(DEFINED BOOST_ROOT AND EXISTS "${BOOST_ROOT}")
|
||||
message(STATUS "Attempting to use system Boost from: ${BOOST_ROOT}")
|
||||
|
||||
# Clear vcpkg interference only when using custom Boost
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG FALSE)
|
||||
|
||||
set(BOOST_INCLUDEDIR "${BOOST_ROOT}")
|
||||
|
||||
# Auto-detect library directory based on compiler
|
||||
if(MSVC)
|
||||
# Detect MSVC toolset version (e.g., 14.3 for VS2022)
|
||||
if(MSVC_TOOLSET_VERSION)
|
||||
string(LENGTH "${MSVC_TOOLSET_VERSION}" _TOOLSET_LEN)
|
||||
math(EXPR _TOOLSET_LEN "${_TOOLSET_LEN} - 1")
|
||||
string(SUBSTRING "${MSVC_TOOLSET_VERSION}" 0 ${_TOOLSET_LEN} _TOOLSET_MAJOR)
|
||||
string(SUBSTRING "${MSVC_TOOLSET_VERSION}" ${_TOOLSET_LEN} -1 _TOOLSET_MINOR)
|
||||
set(_MSVC_VER "${_TOOLSET_MAJOR}.${_TOOLSET_MINOR}")
|
||||
else()
|
||||
# Fallback for older CMake versions
|
||||
set(_MSVC_VER "14.3")
|
||||
endif()
|
||||
|
||||
# Try different library directory naming conventions
|
||||
if(EXISTS "${BOOST_ROOT}/lib64-msvc-${_MSVC_VER}")
|
||||
set(BOOST_LIBRARYDIR "${BOOST_ROOT}/lib64-msvc-${_MSVC_VER}")
|
||||
elseif(EXISTS "${BOOST_ROOT}/lib")
|
||||
set(BOOST_LIBRARYDIR "${BOOST_ROOT}/lib")
|
||||
elseif(EXISTS "${BOOST_ROOT}/stage/lib")
|
||||
set(BOOST_LIBRARYDIR "${BOOST_ROOT}/stage/lib")
|
||||
else()
|
||||
message(WARNING "Could not auto-detect Boost library directory. Tried: lib64-msvc-${_MSVC_VER}, lib, stage/lib")
|
||||
endif()
|
||||
else()
|
||||
# Non-MSVC (GCC, Clang, etc.)
|
||||
if(EXISTS "${BOOST_ROOT}/lib")
|
||||
set(BOOST_LIBRARYDIR "${BOOST_ROOT}/lib")
|
||||
elseif(EXISTS "${BOOST_ROOT}/stage/lib")
|
||||
set(BOOST_LIBRARYDIR "${BOOST_ROOT}/stage/lib")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "BOOST_ROOT not set or doesn't exist. Will attempt standard find_package.")
|
||||
# Let CMake's standard mechanism handle it
|
||||
set(USE_STANDARD_BOOST_SEARCH TRUE)
|
||||
endif()
|
||||
|
||||
# Only use custom search if we have a valid BOOST_ROOT
|
||||
if(NOT USE_STANDARD_BOOST_SEARCH)
|
||||
# Force CMake to use custom paths
|
||||
set(Boost_NO_SYSTEM_PATHS ON)
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||
|
||||
# Auto-detect compiler and architecture
|
||||
if(MSVC)
|
||||
set(Boost_COMPILER "-vc${MSVC_TOOLSET_VERSION}")
|
||||
endif()
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(Boost_ARCHITECTURE "-x64")
|
||||
else()
|
||||
set(Boost_ARCHITECTURE "-x32")
|
||||
endif()
|
||||
|
||||
# Disable boost auto-linking on Windows
|
||||
add_definitions(-DBOOST_ALL_NO_LIB)
|
||||
|
||||
message(STATUS "Using custom Boost search from: ${BOOST_ROOT}")
|
||||
|
||||
# For multi-config generators (Visual Studio), find both Release and Debug libraries
|
||||
# Manually find boost libraries using old-style approach
|
||||
find_path(Boost_INCLUDE_DIRS
|
||||
NAMES boost/version.hpp
|
||||
PATHS "${BOOST_ROOT}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
# Note: Boost.System is header-only since 1.69, no separate library needed
|
||||
|
||||
# Detect Boost version from version.hpp
|
||||
if(EXISTS "${Boost_INCLUDE_DIRS}/boost/version.hpp")
|
||||
file(STRINGS "${Boost_INCLUDE_DIRS}/boost/version.hpp" BOOST_VERSION_LINE REGEX "define BOOST_VERSION ")
|
||||
string(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" BOOST_VERSION_NUMBER "${BOOST_VERSION_LINE}")
|
||||
math(EXPR BOOST_VERSION_MAJOR "${BOOST_VERSION_NUMBER} / 100000")
|
||||
math(EXPR BOOST_VERSION_MINOR "(${BOOST_VERSION_NUMBER} / 100) % 1000")
|
||||
set(BOOST_VERSION_STR "${BOOST_VERSION_MAJOR}_${BOOST_VERSION_MINOR}")
|
||||
message(STATUS "Detected Boost version: ${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}")
|
||||
else()
|
||||
# Fallback to 1.89 if detection fails
|
||||
set(BOOST_VERSION_STR "1_89")
|
||||
message(WARNING "Could not detect Boost version, assuming 1.89")
|
||||
endif()
|
||||
|
||||
# Build library name patterns
|
||||
if(MSVC)
|
||||
set(_BOOST_LIB_PREFIX "libboost_")
|
||||
set(_BOOST_LIB_SUFFIX "-vc${MSVC_TOOLSET_VERSION}-mt${Boost_ARCHITECTURE}-${BOOST_VERSION_STR}")
|
||||
set(_BOOST_LIB_SUFFIX_DEBUG "-vc${MSVC_TOOLSET_VERSION}-mt-gd${Boost_ARCHITECTURE}-${BOOST_VERSION_STR}")
|
||||
else()
|
||||
set(_BOOST_LIB_PREFIX "libboost_")
|
||||
set(_BOOST_LIB_SUFFIX "")
|
||||
set(_BOOST_LIB_SUFFIX_DEBUG "")
|
||||
endif()
|
||||
|
||||
# Find Release libraries
|
||||
find_library(Boost_THREAD_LIBRARY_RELEASE
|
||||
NAMES ${_BOOST_LIB_PREFIX}thread${_BOOST_LIB_SUFFIX} boost_thread-mt boost_thread
|
||||
PATHS "${BOOST_LIBRARYDIR}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_library(Boost_FILESYSTEM_LIBRARY_RELEASE
|
||||
NAMES ${_BOOST_LIB_PREFIX}filesystem${_BOOST_LIB_SUFFIX} boost_filesystem-mt boost_filesystem
|
||||
PATHS "${BOOST_LIBRARYDIR}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_library(Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE
|
||||
NAMES ${_BOOST_LIB_PREFIX}program_options${_BOOST_LIB_SUFFIX} boost_program_options-mt boost_program_options
|
||||
PATHS "${BOOST_LIBRARYDIR}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_library(Boost_REGEX_LIBRARY_RELEASE
|
||||
NAMES ${_BOOST_LIB_PREFIX}regex${_BOOST_LIB_SUFFIX} boost_regex-mt boost_regex
|
||||
PATHS "${BOOST_LIBRARYDIR}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_library(Boost_LOCALE_LIBRARY_RELEASE
|
||||
NAMES ${_BOOST_LIB_PREFIX}locale${_BOOST_LIB_SUFFIX} boost_locale-mt boost_locale
|
||||
PATHS "${BOOST_LIBRARYDIR}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
# Find Debug libraries (-gd suffix for MSVC)
|
||||
find_library(Boost_THREAD_LIBRARY_DEBUG
|
||||
NAMES ${_BOOST_LIB_PREFIX}thread${_BOOST_LIB_SUFFIX_DEBUG} boost_thread-mt-gd boost_thread-gd
|
||||
PATHS "${BOOST_LIBRARYDIR}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_library(Boost_FILESYSTEM_LIBRARY_DEBUG
|
||||
NAMES ${_BOOST_LIB_PREFIX}filesystem${_BOOST_LIB_SUFFIX_DEBUG} boost_filesystem-mt-gd boost_filesystem-gd
|
||||
PATHS "${BOOST_LIBRARYDIR}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_library(Boost_PROGRAM_OPTIONS_LIBRARY_DEBUG
|
||||
NAMES ${_BOOST_LIB_PREFIX}program_options${_BOOST_LIB_SUFFIX_DEBUG} boost_program_options-mt-gd boost_program_options-gd
|
||||
PATHS "${BOOST_LIBRARYDIR}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_library(Boost_REGEX_LIBRARY_DEBUG
|
||||
NAMES ${_BOOST_LIB_PREFIX}regex${_BOOST_LIB_SUFFIX_DEBUG} boost_regex-mt-gd boost_regex-gd
|
||||
PATHS "${BOOST_LIBRARYDIR}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_library(Boost_LOCALE_LIBRARY_DEBUG
|
||||
NAMES ${_BOOST_LIB_PREFIX}locale${_BOOST_LIB_SUFFIX_DEBUG} boost_locale-mt-gd boost_locale-gd
|
||||
PATHS "${BOOST_LIBRARYDIR}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
# Set the main library variables using Release versions for validation
|
||||
set(Boost_THREAD_LIBRARY ${Boost_THREAD_LIBRARY_RELEASE})
|
||||
set(Boost_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY_RELEASE})
|
||||
set(Boost_PROGRAM_OPTIONS_LIBRARY ${Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE})
|
||||
set(Boost_REGEX_LIBRARY ${Boost_REGEX_LIBRARY_RELEASE})
|
||||
set(Boost_LOCALE_LIBRARY ${Boost_LOCALE_LIBRARY_RELEASE})
|
||||
|
||||
if(Boost_INCLUDE_DIRS AND Boost_THREAD_LIBRARY_RELEASE AND Boost_FILESYSTEM_LIBRARY_RELEASE AND Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE AND Boost_REGEX_LIBRARY_RELEASE AND Boost_LOCALE_LIBRARY_RELEASE)
|
||||
set(Boost_FOUND TRUE)
|
||||
|
||||
# Use optimized library selection for multi-config generators
|
||||
# Use Debug libraries if available, otherwise fall back to Release for Debug builds
|
||||
if(Boost_THREAD_LIBRARY_DEBUG)
|
||||
set(Boost_LIBRARIES
|
||||
optimized ${Boost_THREAD_LIBRARY_RELEASE} debug ${Boost_THREAD_LIBRARY_DEBUG}
|
||||
optimized ${Boost_FILESYSTEM_LIBRARY_RELEASE} debug ${Boost_FILESYSTEM_LIBRARY_DEBUG}
|
||||
optimized ${Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE} debug ${Boost_PROGRAM_OPTIONS_LIBRARY_DEBUG}
|
||||
optimized ${Boost_REGEX_LIBRARY_RELEASE} debug ${Boost_REGEX_LIBRARY_DEBUG}
|
||||
optimized ${Boost_LOCALE_LIBRARY_RELEASE} debug ${Boost_LOCALE_LIBRARY_DEBUG})
|
||||
else()
|
||||
# No Debug libraries found, use Release for both configurations
|
||||
set(Boost_LIBRARIES
|
||||
${Boost_THREAD_LIBRARY_RELEASE}
|
||||
${Boost_FILESYSTEM_LIBRARY_RELEASE}
|
||||
${Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE}
|
||||
${Boost_REGEX_LIBRARY_RELEASE}
|
||||
${Boost_LOCALE_LIBRARY_RELEASE})
|
||||
endif()
|
||||
|
||||
message(STATUS "✅ Custom Boost found at: ${Boost_INCLUDE_DIRS}")
|
||||
message(STATUS "✅ Boost Release libraries found: ${Boost_THREAD_LIBRARY_RELEASE};${Boost_FILESYSTEM_LIBRARY_RELEASE};${Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE};${Boost_REGEX_LIBRARY_RELEASE};${Boost_LOCALE_LIBRARY_RELEASE}")
|
||||
if(Boost_THREAD_LIBRARY_DEBUG)
|
||||
message(STATUS "✅ Boost Debug libraries found: ${Boost_THREAD_LIBRARY_DEBUG};${Boost_FILESYSTEM_LIBRARY_DEBUG};${Boost_PROGRAM_OPTIONS_LIBRARY_DEBUG};${Boost_REGEX_LIBRARY_DEBUG};${Boost_LOCALE_LIBRARY_DEBUG}")
|
||||
else()
|
||||
message(STATUS "⚠️ Boost Debug libraries not found (Release libraries will be used for Debug builds)")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "Custom Boost search failed. Diagnostic information:")
|
||||
message(STATUS " Include dirs: ${Boost_INCLUDE_DIRS}")
|
||||
message(STATUS " BOOST_LIBRARYDIR: ${BOOST_LIBRARYDIR}")
|
||||
message(STATUS " Thread lib (Release): ${Boost_THREAD_LIBRARY_RELEASE}")
|
||||
message(STATUS " Filesystem lib (Release): ${Boost_FILESYSTEM_LIBRARY_RELEASE}")
|
||||
message(STATUS " Program options lib (Release): ${Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE}")
|
||||
message(STATUS " Regex lib (Release): ${Boost_REGEX_LIBRARY_RELEASE}")
|
||||
message(STATUS " Locale lib (Release): ${Boost_LOCALE_LIBRARY_RELEASE}")
|
||||
message(STATUS "Falling back to standard find_package(Boost)...")
|
||||
set(USE_STANDARD_BOOST_SEARCH TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Fallback to standard CMake Boost finding if custom search failed or wasn't attempted
|
||||
if(USE_STANDARD_BOOST_SEARCH)
|
||||
message(STATUS "Using standard CMake Boost finding mechanism")
|
||||
|
||||
# Clear previous attempts
|
||||
unset(Boost_FOUND)
|
||||
unset(Boost_NO_SYSTEM_PATHS)
|
||||
|
||||
# Use standard CMake FindBoost
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||
|
||||
if(WIN32)
|
||||
set(BOOST_REQUIRED_VERSION 1.74) # Minimum version
|
||||
else()
|
||||
set(BOOST_REQUIRED_VERSION 1.74)
|
||||
endif()
|
||||
|
||||
find_package(Boost ${BOOST_REQUIRED_VERSION} REQUIRED
|
||||
COMPONENTS
|
||||
filesystem
|
||||
program_options
|
||||
regex
|
||||
locale
|
||||
thread)
|
||||
|
||||
if(Boost_FOUND)
|
||||
message(STATUS "✅ Standard Boost ${Boost_VERSION} found at: ${Boost_INCLUDE_DIRS}")
|
||||
set(Boost_LIBRARIES ${Boost_LIBRARIES})
|
||||
set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
|
||||
else()
|
||||
message(FATAL_ERROR "❌ Boost not found. Please install Boost 1.74+ or set BOOST_ROOT environment variable.")
|
||||
endif()
|
||||
endif()
|
||||
@@ -48,10 +48,6 @@ if("${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild")
|
||||
target_compile_options(trinity-compile-option-interface
|
||||
INTERFACE
|
||||
/MP)
|
||||
# Forces writes to the PDB file to be serialized through mspdbsrv.exe (/FS) - needed for Debug builds
|
||||
target_compile_options(trinity-compile-option-interface
|
||||
INTERFACE
|
||||
$<$<CONFIG:Debug,RelWithDebInfo>:/FS>)
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
# Forces writes to the PDB file to be serialized through mspdbsrv.exe (/FS)
|
||||
# Enable faster PDB generation in parallel builds by minimizing RPC calls to mspdbsrv.exe (/Zf)
|
||||
|
||||
+1
-5
@@ -134,11 +134,7 @@ if(WIN32)
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
# Remove "Microsoft Windows" from the result
|
||||
if(TRINITY_BUILD_HOST_SYSTEM_RELEASE)
|
||||
string(REGEX REPLACE "^.* Windows " "" TRINITY_BUILD_HOST_SYSTEM_RELEASE ${TRINITY_BUILD_HOST_SYSTEM_RELEASE})
|
||||
else()
|
||||
set(TRINITY_BUILD_HOST_SYSTEM_RELEASE "Windows")
|
||||
endif()
|
||||
string(REGEX REPLACE "^.* Windows " "" TRINITY_BUILD_HOST_SYSTEM_RELEASE "${TRINITY_BUILD_HOST_SYSTEM_RELEASE}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_SCRIPT_MODE_FILE)
|
||||
|
||||
@@ -81,4 +81,4 @@ function(CollectIncludeDirectories current_dir sources_variable)
|
||||
endforeach()
|
||||
set(${sources_variable} ${${sources_variable}} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
endfunction()
|
||||
|
||||
@@ -1,368 +0,0 @@
|
||||
# FindPlayerbotDependencies.cmake
|
||||
# Cross-platform dependency detection for TrinityCore Playerbot enterprise features
|
||||
# Supports Linux (GCC/Clang) and Windows (MSVC/Clang-cl)
|
||||
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
|
||||
# Set policy for better cross-platform compatibility
|
||||
if(POLICY CMP0074)
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
endif()
|
||||
|
||||
if(POLICY CMP0167)
|
||||
cmake_policy(SET CMP0167 NEW)
|
||||
endif()
|
||||
|
||||
message(STATUS "=== Playerbot Enterprise Dependency Detection ===")
|
||||
|
||||
# Cross-platform compiler validation
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11.0")
|
||||
message(FATAL_ERROR "GCC 11.0+ required for C++20 support, found ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
endif()
|
||||
message(STATUS "✅ GCC ${CMAKE_CXX_COMPILER_VERSION} (C++20 capable)")
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "14.0")
|
||||
message(FATAL_ERROR "Clang 14.0+ required for C++20 support, found ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
endif()
|
||||
message(STATUS "✅ Clang ${CMAKE_CXX_COMPILER_VERSION} (C++20 capable)")
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.30")
|
||||
message(FATAL_ERROR "MSVC 19.30+ (VS2022) required for C++20 support, found ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
endif()
|
||||
message(STATUS "✅ MSVC ${CMAKE_CXX_COMPILER_VERSION} (C++20 capable)")
|
||||
else()
|
||||
message(WARNING "Unknown compiler ${CMAKE_CXX_COMPILER_ID}, C++20 support not verified")
|
||||
endif()
|
||||
|
||||
# 1. Intel Threading Building Blocks (TBB) - WITH VENDORED FALLBACK
|
||||
message(STATUS "Detecting Intel TBB...")
|
||||
|
||||
# Priority 1: Try vendored TBB from Playerbot deps/
|
||||
set(VENDORED_TBB_DIR "${CMAKE_SOURCE_DIR}/src/modules/Playerbot/deps/tbb")
|
||||
|
||||
if(EXISTS "${VENDORED_TBB_DIR}/include/tbb/version.h")
|
||||
# Use vendored TBB (will be built from source)
|
||||
set(TBB_DIR "${VENDORED_TBB_DIR}")
|
||||
set(TBB_SOURCE "vendored")
|
||||
|
||||
# Add TBB subdirectory to build it from source
|
||||
# oneTBB provides its own CMakeLists.txt
|
||||
if(NOT TARGET TBB::tbb)
|
||||
message(STATUS " Building TBB from vendored source...")
|
||||
add_subdirectory("${VENDORED_TBB_DIR}" "${CMAKE_BINARY_DIR}/tbb-build" EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
set(TBB_FOUND TRUE)
|
||||
message(STATUS "✅ Using vendored TBB from: ${VENDORED_TBB_DIR}")
|
||||
message(STATUS " (Zero installation required - git submodule, building from source)")
|
||||
else()
|
||||
# Priority 2: Try system-installed TBB
|
||||
find_path(TBB_INCLUDE_DIR
|
||||
NAMES tbb/version.h
|
||||
HINTS
|
||||
"C:/libs/vcpkg/packages/tbb_x64-windows"
|
||||
"C:/libs/vcpkg/installed/x64-windows"
|
||||
"C:/libs/oneapi-tbb-2022.2.0"
|
||||
${TBB_ROOT}
|
||||
$ENV{TBB_ROOT}
|
||||
${CMAKE_PREFIX_PATH}
|
||||
PATH_SUFFIXES include
|
||||
)
|
||||
|
||||
find_library(TBB_LIBRARY
|
||||
NAMES tbb12 tbb
|
||||
HINTS
|
||||
"C:/libs/vcpkg/packages/tbb_x64-windows"
|
||||
"C:/libs/vcpkg/installed/x64-windows"
|
||||
"C:/libs/oneapi-tbb-2022.2.0"
|
||||
${TBB_ROOT}
|
||||
$ENV{TBB_ROOT}
|
||||
${CMAKE_PREFIX_PATH}
|
||||
PATH_SUFFIXES lib lib/intel64/vc14 lib/intel64 lib64
|
||||
)
|
||||
|
||||
if(TBB_INCLUDE_DIR AND TBB_LIBRARY)
|
||||
if(NOT TARGET TBB::tbb)
|
||||
add_library(TBB::tbb UNKNOWN IMPORTED)
|
||||
set_target_properties(TBB::tbb PROPERTIES
|
||||
IMPORTED_LOCATION ${TBB_LIBRARY}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${TBB_INCLUDE_DIR}
|
||||
)
|
||||
endif()
|
||||
set(TBB_FOUND TRUE)
|
||||
set(TBB_SOURCE "system")
|
||||
message(STATUS "✅ Using system-installed TBB from: ${TBB_INCLUDE_DIR}")
|
||||
message(STATUS " TBB library: ${TBB_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT TBB_FOUND)
|
||||
message(FATAL_ERROR "❌ Intel TBB 2021.5+ not found. Install options:
|
||||
|
||||
OPTION 1 (RECOMMENDED): Initialize vendored dependencies (zero installation)
|
||||
git submodule update --init --recursive
|
||||
|
||||
OPTION 2: Install system-wide packages
|
||||
Linux: sudo apt-get install libtbb-dev (Ubuntu/Debian)
|
||||
sudo yum install tbb-devel (RHEL/CentOS)
|
||||
Windows: vcpkg install tbb:x64-windows
|
||||
macOS: brew install tbb")
|
||||
endif()
|
||||
|
||||
message(STATUS "✅ Intel TBB enterprise components verified (source: ${TBB_SOURCE})")
|
||||
|
||||
# 2. Parallel Hashmap (phmap) - CRITICAL with Vendored Fallback
|
||||
message(STATUS "Detecting Parallel Hashmap...")
|
||||
|
||||
# Priority 1: Try vendored phmap from Playerbot deps/
|
||||
set(VENDORED_PHMAP_DIR "${CMAKE_SOURCE_DIR}/src/modules/Playerbot/deps/phmap")
|
||||
|
||||
if(EXISTS "${VENDORED_PHMAP_DIR}/parallel_hashmap/phmap.h")
|
||||
set(PHMAP_INCLUDE_DIR "${VENDORED_PHMAP_DIR}")
|
||||
set(PHMAP_SOURCE "vendored")
|
||||
message(STATUS "✅ Using vendored phmap from: ${VENDORED_PHMAP_DIR}")
|
||||
message(STATUS " (Zero installation required - git submodule)")
|
||||
else()
|
||||
# Priority 2: Try system-installed phmap
|
||||
find_path(PHMAP_INCLUDE_DIR
|
||||
NAMES parallel_hashmap/phmap.h
|
||||
HINTS
|
||||
"C:/libs/vcpkg/packages/parallel-hashmap_x64-windows"
|
||||
"C:/libs/vcpkg/installed/x64-windows"
|
||||
"C:/libs/parallel-hashmap-2.0.0"
|
||||
${PHMAP_ROOT}
|
||||
$ENV{PHMAP_ROOT}
|
||||
${CMAKE_PREFIX_PATH}
|
||||
PATH_SUFFIXES include .
|
||||
)
|
||||
|
||||
if(PHMAP_INCLUDE_DIR)
|
||||
set(PHMAP_SOURCE "system")
|
||||
message(STATUS "✅ Using system-installed phmap from: ${PHMAP_INCLUDE_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT PHMAP_INCLUDE_DIR)
|
||||
message(FATAL_ERROR "❌ Parallel Hashmap (phmap) headers not found. Install options:
|
||||
|
||||
OPTION 1 (RECOMMENDED): Initialize vendored dependencies (zero installation)
|
||||
git submodule update --init --recursive
|
||||
|
||||
OPTION 2: Install system-wide packages
|
||||
Linux: git clone https://github.com/greg7mdp/parallel-hashmap.git && cd parallel-hashmap && cmake -B build && sudo cmake --install build
|
||||
Windows: vcpkg install parallel-hashmap:x64-windows
|
||||
macOS: brew install parallel-hashmap")
|
||||
endif()
|
||||
|
||||
# Create interface target for phmap
|
||||
if(NOT TARGET phmap::phmap)
|
||||
add_library(phmap::phmap INTERFACE IMPORTED)
|
||||
set_target_properties(phmap::phmap PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${PHMAP_INCLUDE_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
message(STATUS "✅ Parallel Hashmap enterprise components verified (source: ${PHMAP_SOURCE})")
|
||||
|
||||
# 3. Boost Libraries - CRITICAL (Use System Boost 1.78)
|
||||
message(STATUS "Detecting Boost libraries...")
|
||||
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/FindSystemBoost.cmake)
|
||||
|
||||
if(NOT Boost_FOUND)
|
||||
message(FATAL_ERROR "❌ Boost 1.74.0+ not found. Install instructions:
|
||||
Linux: sudo apt-get install libboost-all-dev (Ubuntu/Debian)
|
||||
sudo yum install boost-devel (RHEL/CentOS)
|
||||
Windows: vcpkg install boost:x64-windows
|
||||
macOS: brew install boost")
|
||||
endif()
|
||||
|
||||
# Verify Boost components functionality
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${Boost_LIBRARIES})
|
||||
set(CMAKE_REQUIRED_INCLUDES ${Boost_INCLUDE_DIRS})
|
||||
|
||||
check_cxx_source_compiles("
|
||||
#include <boost/circular_buffer.hpp>
|
||||
#include <boost/pool/object_pool.hpp>
|
||||
#include <boost/lockfree/queue.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
int main() {
|
||||
boost::circular_buffer<int> cb(10);
|
||||
boost::object_pool<int> pool;
|
||||
boost::lockfree::queue<int> queue(10);
|
||||
boost::asio::io_context ctx;
|
||||
return 0;
|
||||
}
|
||||
" BOOST_COMPONENTS_FUNCTIONAL)
|
||||
|
||||
if(NOT BOOST_COMPONENTS_FUNCTIONAL)
|
||||
message(WARNING "⚠️ Boost functional test failed, but proceeding for development build")
|
||||
set(BOOST_COMPONENTS_FUNCTIONAL TRUE) # Override for development build
|
||||
endif()
|
||||
|
||||
message(STATUS "✅ Boost ${Boost_VERSION} enterprise components verified")
|
||||
|
||||
# 4. MySQL Connector - CRITICAL
|
||||
message(STATUS "Detecting MySQL client libraries...")
|
||||
|
||||
find_package(MySQL QUIET)
|
||||
|
||||
if(NOT MYSQL_FOUND)
|
||||
# Alternative MySQL detection for cross-platform compatibility
|
||||
find_path(MYSQL_INCLUDE_DIR
|
||||
NAMES mysql.h
|
||||
HINTS
|
||||
${MYSQL_ROOT}
|
||||
$ENV{MYSQL_ROOT}
|
||||
${CMAKE_PREFIX_PATH}
|
||||
PATH_SUFFIXES include include/mysql mysql
|
||||
)
|
||||
|
||||
find_library(MYSQL_LIBRARY
|
||||
NAMES mysqlclient mysql libmysql
|
||||
HINTS
|
||||
${MYSQL_ROOT}
|
||||
$ENV{MYSQL_ROOT}
|
||||
${CMAKE_PREFIX_PATH}
|
||||
PATH_SUFFIXES lib lib64 lib/mysql
|
||||
)
|
||||
|
||||
if(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARY)
|
||||
set(MYSQL_LIBRARIES ${MYSQL_LIBRARY})
|
||||
set(MYSQL_INCLUDE_DIRS ${MYSQL_INCLUDE_DIR})
|
||||
set(MYSQL_FOUND TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT MYSQL_FOUND)
|
||||
message(FATAL_ERROR "❌ MySQL client libraries not found. Install instructions:
|
||||
Linux: sudo apt-get install libmysqlclient-dev (Ubuntu/Debian)
|
||||
sudo yum install mysql-devel (RHEL/CentOS)
|
||||
Windows: vcpkg install mysql:x64-windows
|
||||
macOS: brew install mysql")
|
||||
endif()
|
||||
|
||||
# Verify MySQL functionality
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${MYSQL_LIBRARIES})
|
||||
set(CMAKE_REQUIRED_INCLUDES ${MYSQL_INCLUDE_DIRS})
|
||||
|
||||
check_cxx_source_compiles("
|
||||
#include <mysql.h>
|
||||
int main() {
|
||||
const char* version = mysql_get_client_info();
|
||||
MYSQL* mysql = mysql_init(nullptr);
|
||||
if (mysql) mysql_close(mysql);
|
||||
return 0;
|
||||
}
|
||||
" MYSQL_FUNCTIONAL)
|
||||
|
||||
if(NOT MYSQL_FUNCTIONAL)
|
||||
message(WARNING "⚠️ MySQL functional test failed, but library was found - proceeding with build")
|
||||
set(MYSQL_FUNCTIONAL TRUE) # Override for development build
|
||||
endif()
|
||||
|
||||
# Ensure MYSQL_FOUND is set if we have library and headers
|
||||
if(MYSQL_LIBRARIES AND MYSQL_INCLUDE_DIRS)
|
||||
set(MYSQL_FOUND TRUE)
|
||||
endif()
|
||||
|
||||
message(STATUS "✅ MySQL client library enterprise components verified")
|
||||
|
||||
# 5. OpenSSL (typically required by TrinityCore) - VERIFY
|
||||
find_package(OpenSSL QUIET)
|
||||
if(OpenSSL_FOUND)
|
||||
message(STATUS "✅ OpenSSL ${OPENSSL_VERSION} found")
|
||||
else()
|
||||
message(WARNING "⚠️ OpenSSL not found - may be required by TrinityCore core")
|
||||
endif()
|
||||
|
||||
# Create summary of all dependencies
|
||||
message(STATUS "=== Playerbot Dependency Summary ===")
|
||||
if(DEFINED TBB_SOURCE)
|
||||
message(STATUS "Intel TBB: ✅ Available (${TBB_SOURCE})")
|
||||
else()
|
||||
message(STATUS "Intel TBB: ✅ Available")
|
||||
endif()
|
||||
if(DEFINED PHMAP_SOURCE)
|
||||
message(STATUS "Parallel Hashmap: ✅ Available (${PHMAP_SOURCE})")
|
||||
else()
|
||||
message(STATUS "Parallel Hashmap: ✅ Available")
|
||||
endif()
|
||||
message(STATUS "Boost: ✅ ${Boost_VERSION} (system)")
|
||||
message(STATUS "MySQL: ✅ Available (system)")
|
||||
if(OpenSSL_FOUND)
|
||||
message(STATUS "OpenSSL: ✅ ${OPENSSL_VERSION} (system)")
|
||||
else()
|
||||
message(STATUS "OpenSSL: ⚠️ Not found")
|
||||
endif()
|
||||
message(STATUS "Compiler: ✅ ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
message(STATUS "Platform: ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION}")
|
||||
message(STATUS "Architecture: ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
|
||||
# Vendored dependency status
|
||||
if(TBB_SOURCE STREQUAL "vendored" OR PHMAP_SOURCE STREQUAL "vendored")
|
||||
message(STATUS "")
|
||||
message(STATUS "📦 Vendored Dependencies Active:")
|
||||
if(TBB_SOURCE STREQUAL "vendored")
|
||||
message(STATUS " → TBB: Building from deps/tbb/")
|
||||
endif()
|
||||
if(PHMAP_SOURCE STREQUAL "vendored")
|
||||
message(STATUS " → phmap: Using deps/phmap/ (header-only)")
|
||||
endif()
|
||||
message(STATUS " ✅ Zero system installation required!")
|
||||
endif()
|
||||
|
||||
# Platform-specific optimizations
|
||||
if(WIN32)
|
||||
message(STATUS "Windows optimizations: Enabled")
|
||||
add_compile_definitions(WIN32_LEAN_AND_MEAN NOMINMAX)
|
||||
elseif(UNIX)
|
||||
message(STATUS "Unix optimizations: Enabled")
|
||||
# Linux/macOS specific optimizations if needed
|
||||
endif()
|
||||
|
||||
message(STATUS "🚀 All enterprise dependencies validated - Playerbot ready!")
|
||||
|
||||
# Export variables for parent CMakeLists.txt
|
||||
set(PLAYERBOT_TBB_FOUND ${TBB_FOUND} PARENT_SCOPE)
|
||||
set(PLAYERBOT_PHMAP_FOUND TRUE PARENT_SCOPE)
|
||||
set(PLAYERBOT_BOOST_FOUND ${Boost_FOUND} PARENT_SCOPE)
|
||||
set(PLAYERBOT_MYSQL_FOUND ${MYSQL_FOUND} PARENT_SCOPE)
|
||||
|
||||
# Export include directories and libraries
|
||||
set(PLAYERBOT_INCLUDE_DIRS
|
||||
${TBB_INCLUDE_DIR}
|
||||
${PHMAP_INCLUDE_DIR}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${MYSQL_INCLUDE_DIRS}
|
||||
PARENT_SCOPE)
|
||||
|
||||
set(PLAYERBOT_LIBRARIES
|
||||
TBB::tbb
|
||||
${Boost_LIBRARIES}
|
||||
${MYSQL_LIBRARIES}
|
||||
PARENT_SCOPE)
|
||||
|
||||
# Create convenience target that links all dependencies
|
||||
add_library(playerbot-dependencies INTERFACE)
|
||||
target_link_libraries(playerbot-dependencies
|
||||
INTERFACE
|
||||
TBB::tbb
|
||||
phmap::phmap
|
||||
${Boost_LIBRARIES})
|
||||
|
||||
target_include_directories(playerbot-dependencies
|
||||
INTERFACE
|
||||
${MYSQL_INCLUDE_DIRS})
|
||||
|
||||
target_link_libraries(playerbot-dependencies
|
||||
INTERFACE
|
||||
${MYSQL_LIBRARIES})
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(playerbot-dependencies INTERFACE ws2_32 wsock32)
|
||||
endif()
|
||||
|
||||
# Export the convenience target
|
||||
set(PLAYERBOT_DEPENDENCIES_TARGET playerbot-dependencies PARENT_SCOPE)
|
||||
+1
-2
@@ -34,7 +34,6 @@ foreach(SCRIPT_MODULE ${SCRIPT_MODULE_LIST})
|
||||
endforeach()
|
||||
|
||||
option(TOOLS "Build map/vmap/mmap extraction/assembler tools" 1)
|
||||
option(ELUNA "Build Eluna Lua Engine" 0)
|
||||
option(USE_SCRIPTPCH "Use precompiled headers when compiling scripts" 1)
|
||||
option(USE_COREPCH "Use precompiled headers when compiling servers" 1)
|
||||
option(WITH_DYNAMIC_LINKING "Enable dynamic library linking." 0)
|
||||
@@ -48,7 +47,7 @@ if(WITH_DYNAMIC_LINKING OR WITH_DYNAMIC_LINKING_FORCED)
|
||||
else()
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
endif()
|
||||
if(WITH_FILESYSTEM_WATCHER OR BUILD_SHARED_LIBS OR ELUNA)
|
||||
if(WITH_FILESYSTEM_WATCHER OR BUILD_SHARED_LIBS)
|
||||
set(BUILD_EFSW ON)
|
||||
endif()
|
||||
option(WITH_WARNINGS "Show all warnings during compile" 0)
|
||||
|
||||
@@ -40,15 +40,6 @@ else()
|
||||
message("* Build map/vmap tools : No")
|
||||
endif()
|
||||
|
||||
if(ELUNA)
|
||||
message("* Build Eluna LuaEngine : Yes (default)")
|
||||
add_definitions(-DELUNA)
|
||||
add_definitions(-DELUNA_TRINITY)
|
||||
add_definitions(-DELUNA_EXPANSION=9)
|
||||
else()
|
||||
message("* Build Eluna LuaEngine : No")
|
||||
endif()
|
||||
|
||||
if(BUILD_TESTING)
|
||||
message("* Build unit tests : Yes")
|
||||
else()
|
||||
|
||||
Reference in New Issue
Block a user