CMake: Provide proper interface targets from dependencies

* to make use of cmakes inherited link dependencies which
  imports all include directories/ definitions from the link library

(cherry picked from commit 1a572d2425)
This commit is contained in:
Naios
2016-03-14 15:27:33 +01:00
parent fee9bb904a
commit b0ac332d58
27 changed files with 492 additions and 226 deletions

View File

@@ -8,11 +8,13 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# We require CMake >= 3.0
cmake_minimum_required(VERSION 3.0)
# Set projectname (must be done AFTER setting configurationtypes)
project(TrinityCore)
# CMake policies (can not be handled elsewhere)
cmake_minimum_required(VERSION 2.8.9)
cmake_policy(SET CMP0005 OLD)
if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD) # Disable 'Ignore COMPILE_DEFINITIONS_<Config> properties'
@@ -22,6 +24,9 @@ endif(POLICY CMP0043)
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
# build static libraries
set(BUILD_SHARED_LIBS OFF)
# Set RPATH-handing (CMake parameters)
set(CMAKE_SKIP_BUILD_RPATH 0)
set(CMAKE_BUILD_WITH_INSTALL_RPATH 0)
@@ -52,22 +57,9 @@ include(CheckPlatform)
include(GroupSources)
# basic packagesearching and setup (further support will be needed, this is a preliminary release!)
set(OPENSSL_EXPECTED_VERSION 1.0.0)
find_package(PCHSupport)
find_package(OpenSSL REQUIRED)
find_package(Threads REQUIRED)
find_package(MySQL)
include(ConfigureBoost)
if( UNIX )
find_package(Readline)
find_package(ZLIB)
find_package(BZip2)
endif()
if(NOT WITHOUT_GIT)
find_package(Git)
endif()

View File

@@ -1,18 +0,0 @@
# find Readline (terminal input library) includes and library
#
# READLINE_INCLUDE_DIR - where the directory containing the READLINE headers can be found
# READLINE_LIBRARY - full path to the READLINE library
# READLINE_FOUND - TRUE if READLINE was found
FIND_PATH(READLINE_INCLUDE_DIR readline/readline.h)
FIND_LIBRARY(READLINE_LIBRARY NAMES readline)
IF (READLINE_INCLUDE_DIR AND READLINE_LIBRARY)
SET(READLINE_FOUND TRUE)
MESSAGE(STATUS "Found Readline library: ${READLINE_LIBRARY}")
MESSAGE(STATUS "Include dir is: ${READLINE_INCLUDE_DIR}")
INCLUDE_DIRECTORIES(${READLINE_INCLUDE_DIR})
ELSE (READLINE_INCLUDE_DIR AND READLINE_LIBRARY)
SET(READLINE_FOUND FALSE)
MESSAGE(FATAL_ERROR "** Readline library not found!\n** Your distro may provide a binary for Readline e.g. for ubuntu try apt-get install libreadline5-dev")
ENDIF (READLINE_INCLUDE_DIR AND READLINE_LIBRARY)

View File

@@ -1,12 +1,3 @@
# Package overloads - Linux
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
if (NOT NOJEM)
set(JEMALLOC_LIBRARY "jemalloc")
add_definitions(-DNO_BUFFERPOOL)
message(STATUS "UNIX: Using jemalloc")
endif()
endif()
# set default configuration directory
if( NOT CONF_DIR )
set(CONF_DIR ${CMAKE_INSTALL_PREFIX}/etc)

View File

@@ -1,7 +1,3 @@
# Package overloads
set(BZIP2_LIBRARIES "bzip2")
set(ZLIB_LIBRARIES "zlib")
# check the CMake preload parameters (commented out by default)
# overload CMAKE_INSTALL_PREFIX if not being set properly
@@ -13,6 +9,10 @@ set(ZLIB_LIBRARIES "zlib")
# endif()
#endif()
if (WIN32)
add_definitions(-D_WIN32_WINNT=0x0601)
endif()
if ( MSVC )
include(${CMAKE_SOURCE_DIR}/cmake/compiler/msvc/settings.cmake)
elseif ( MINGW )

View File

@@ -14,32 +14,31 @@ else()
add_definitions(-w)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(SERVERS AND NOT NOJEM)
add_subdirectory(jemalloc)
endif()
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
if(TOOLS)
add_subdirectory(bzip2)
endif()
if(SERVERS OR TOOLS)
add_subdirectory(zlib)
endif()
endif()
add_subdirectory(threads)
if(SERVERS OR TOOLS)
add_subdirectory(boost)
add_subdirectory(zlib)
add_subdirectory(g3dlite)
add_subdirectory(recastnavigation)
add_subdirectory(jemalloc)
add_subdirectory(cppformat)
add_subdirectory(SFMT)
add_subdirectory(utf8cpp)
add_subdirectory(valgrind)
add_subdirectory(openssl)
endif()
if(SERVERS)
add_subdirectory(mysql)
add_subdirectory(process)
add_subdirectory(readline)
add_subdirectory(gsoap)
add_subdirectory(zmq)
add_subdirectory(zmqpp)
endif()
if(TOOLS)
add_subdirectory(bzip2)
add_subdirectory(CascLib)
endif()

View File

@@ -44,6 +44,15 @@ set(TOMCRYPT_FILES
src/libtomcrypt/src/misc/crypt_libc.c
)
include_directories(${CMAKE_SOURCE_DIR}/dep)
add_library(casc STATIC ${SRC_FILES} ${TOMCRYPT_FILES})
target_include_directories(casc
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
PRIVATE
${CMAKE_SOURCE_DIR}/dep)
set_target_properties(casc
PROPERTIES
FOLDER
"dep")

View File

@@ -1,6 +1,6 @@
TrinityCore uses (parts of or in whole) the following opensource software :
Boost
Boost (external)
http://www.boost.org
Version: 1.55
@@ -24,6 +24,14 @@ jemalloc (a general-purpose scalable concurrent malloc-implementation)
http://www.canonware.com/jemalloc/
Version: 3.6.0
libreadline (command line editing library)
https://cnswww.cns.cwru.edu/php/chet/readline/rltop.html
Version: external
OpenSSL (general-purpose cryptography library)
https://www.openssl.org/
Version: external
SFMT (SIMD-oriented Fast Mersenne Twister)
Based on http://agner.org/random/
Version: 2010-Aug-03

15
dep/SFMT/CMakeLists.txt Normal file
View File

@@ -0,0 +1,15 @@
# Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
#
# 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.
add_library(sfmt INTERFACE)
target_include_directories(sfmt
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR})

View File

@@ -1,3 +1,13 @@
# Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
#
# 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(WIN32)
set(BOOST_DEBUG ON)
if(DEFINED ENV{BOOST_ROOT})
@@ -14,14 +24,9 @@ if(WIN32)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
add_definitions(-D_WIN32_WINNT=0x0601)
endif()
find_package(Boost 1.51 REQUIRED system filesystem thread program_options iostreams regex)
add_definitions(-DBOOST_DATE_TIME_NO_LIB)
add_definitions(-DBOOST_REGEX_NO_LIB)
add_definitions(-DBOOST_CHRONO_NO_LIB)
# Find if Boost was compiled in C++03 mode because it requires -DBOOST_NO_CXX11_SCOPED_ENUMS
@@ -41,9 +46,22 @@ unset(CMAKE_REQUIRED_LIBRARIES CACHE)
unset(CMAKE_REQUIRED_FLAGS CACHE)
if (NOT boost_filesystem_copy_links_without_NO_SCOPED_ENUM)
add_definitions(-DBOOST_NO_CXX11_SCOPED_ENUMS)
set(OPTIONAL_BOOST_NO_SCOPED_ENUMS -DBOOST_NO_CXX11_SCOPED_ENUMS)
endif()
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
endif()
add_library(boost INTERFACE)
target_link_libraries(boost
INTERFACE
${Boost_LIBRARIES})
target_include_directories(boost
INTERFACE
${Boost_INCLUDE_DIRS})
target_compile_definitions(boost
INTERFACE
-DBOOST_DATE_TIME_NO_LIB
-DBOOST_REGEX_NO_LIB
-DBOOST_CHRONO_NO_LIB
${OPTIONAL_BOOST_NO_SCOPED_ENUMS})

View File

@@ -8,15 +8,30 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
file(GLOB sources *.c)
if(UNIX)
# Look for an installed bzip2 on unix
find_package(BZip2 REQUIRED)
set(bzip2_STAT_SRCS
${sources}
)
add_library(bzip2 SHARED IMPORTED GLOBAL)
include_directories(
${CMAKE_SOURCE_DIR}/dep/zlib
${CMAKE_CURRENT_SOURCE_DIR}
)
set_target_properties(bzip2
PROPERTIES
IMPORTED_LOCATION
"${BZIP2_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES
"${BZIP2_INCLUDE_DIRS}")
else()
# Use the bundled source on windows
file(GLOB sources *.c)
add_library(bzip2 STATIC
${sources})
add_library(bzip2 STATIC ${bzip2_STAT_SRCS})
target_include_directories(bzip2
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(bzip2
PROPERTIES
FOLDER
"dep")
endif()

View File

@@ -1,31 +1,37 @@
include(CheckCXXCompilerFlag)
# Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
#
# 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(CheckSymbolExists)
set(FMT_SOURCES cppformat/format.cc cppformat/format.h)
# Use variadic templates
add_definitions(-DFMT_VARIADIC_TEMPLATES=1)
# Use deleted functions
add_definitions(-DFMT_USE_DELETED_FUNCTIONS=1)
# Use static assert
add_definitions(-DFMT_USE_STATIC_ASSERT=1)
if (WIN32)
check_symbol_exists(open io.h HAVE_OPEN)
else ()
check_symbol_exists(open fcntl.h HAVE_OPEN)
endif ()
set(FMT_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/cppformat/format.h
${CMAKE_CURRENT_SOURCE_DIR}/cppformat/format.cc)
if (HAVE_OPEN)
add_definitions(-DFMT_USE_FILE_DESCRIPTORS=1)
set(FMT_SOURCES ${FMT_SOURCES} cppformat/posix.cc cppformat/posix.h)
endif ()
set(FMT_SOURCES ${FMT_SOURCES}
${CMAKE_CURRENT_SOURCE_DIR}/cppformat/posix.h
${CMAKE_CURRENT_SOURCE_DIR}/cppformat/posix.cc)
endif()
add_library(cppformat STATIC ${FMT_SOURCES})
if (CMAKE_COMPILER_IS_GNUCXX)
set_target_properties(cppformat PROPERTIES COMPILE_FLAGS
"-Wall -Wextra -Wshadow -pedantic")
endif ()
target_include_directories(cppformat
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(cppformat
PROPERTIES
FOLDER
"dep")

View File

@@ -8,7 +8,6 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
set(g3dlib_STAT_SRCS
source/AABox.cpp
source/Any.cpp
@@ -55,20 +54,18 @@ set(g3dlib_STAT_SRCS
source/Vector4.cpp
)
if(WIN32)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/dep/zlib
)
else()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include
)
endif()
add_library(g3dlib STATIC ${g3dlib_STAT_SRCS})
target_include_directories(g3dlib
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(g3dlib
${ZLIB_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
PUBLIC
zlib
threads)
set_target_properties(g3dlib
PROPERTIES
FOLDER
"dep")

View File

@@ -10,17 +10,22 @@
file(GLOB sources *.cpp *.h)
set(gsoap_STAT_SRCS
${sources}
)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
)
# Little fix for MSVC / Windows platforms
add_definitions(-D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=0)
add_library(gsoap STATIC ${gsoap_STAT_SRCS})
add_library(gsoap STATIC ${sources})
set_target_properties(gsoap PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(gsoap
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(gsoap
PROPERTIES
FOLDER
"dep")
if (MSVC)
# Little fix for MSVC / Windows platforms
target_compile_definitions(gsoap
PRIVATE
-D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=0)
endif()

View File

@@ -8,54 +8,79 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# We need to generate the jemalloc_def.h header based on platform-specific settings
if (PLATFORM EQUAL 32)
set(JEM_SIZEDEF 2)
set(JEM_TLSMODEL)
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT NOJEM)
# We need to generate the jemalloc_def.h header based on platform-specific settings
if (PLATFORM EQUAL 32)
set(JEM_SIZEDEF 2)
set(JEM_TLSMODEL)
else()
set(JEM_SIZEDEF 3)
set(JEM_TLSMODEL "__attribute__\(\(tls_model\(\"initial-exec\"\)\)\)")
endif()
# Create the header, so we can use it
configure_file(
"${CMAKE_SOURCE_DIR}/dep/jemalloc/jemalloc_defs.h.in.cmake"
"${BUILDDIR}/jemalloc_defs.h"
@ONLY
)
# Done, let's continue
set(jemalloc_STAT_SRC
${CMAKE_CURRENT_SOURCE_DIR}/src/arena.c
${CMAKE_CURRENT_SOURCE_DIR}/src/atomic.c
${CMAKE_CURRENT_SOURCE_DIR}/src/base.c
${CMAKE_CURRENT_SOURCE_DIR}/src/bitmap.c
${CMAKE_CURRENT_SOURCE_DIR}/src/chunk.c
${CMAKE_CURRENT_SOURCE_DIR}/src/chunk_dss.c
${CMAKE_CURRENT_SOURCE_DIR}/src/chunk_mmap.c
${CMAKE_CURRENT_SOURCE_DIR}/src/ckh.c
${CMAKE_CURRENT_SOURCE_DIR}/src/ctl.c
${CMAKE_CURRENT_SOURCE_DIR}/src/extent.c
${CMAKE_CURRENT_SOURCE_DIR}/src/hash.c
${CMAKE_CURRENT_SOURCE_DIR}/src/huge.c
${CMAKE_CURRENT_SOURCE_DIR}/src/jemalloc.c
${CMAKE_CURRENT_SOURCE_DIR}/src/mb.c
${CMAKE_CURRENT_SOURCE_DIR}/src/mutex.c
${CMAKE_CURRENT_SOURCE_DIR}/src/prof.c
${CMAKE_CURRENT_SOURCE_DIR}/src/quarantine.c
${CMAKE_CURRENT_SOURCE_DIR}/src/rtree.c
${CMAKE_CURRENT_SOURCE_DIR}/src/stats.c
${CMAKE_CURRENT_SOURCE_DIR}/src/tcache.c
${CMAKE_CURRENT_SOURCE_DIR}/src/tsd.c
${CMAKE_CURRENT_SOURCE_DIR}/src/util.c
)
add_library(jemalloc STATIC ${jemalloc_STAT_SRC})
target_include_directories(jemalloc
PRIVATE
${BUILDDIR}
${CMAKE_CURRENT_SOURCE_DIR}/include)
target_compile_definitions(jemalloc
PUBLIC
-DNO_BUFFERPOOL
PRIVATE
-D_GNU_SOURCE
-D_REENTRAN)
target_link_libraries(jemalloc
PUBLIC
threads
valgrind)
set_target_properties(jemalloc
PROPERTIES
FOLDER
"dep")
else()
set(JEM_SIZEDEF 3)
set(JEM_TLSMODEL "__attribute__\(\(tls_model\(\"initial-exec\"\)\)\)")
# Provide a dummy target for jemalloc which is used when jemalloc
# is disabled or not supported.
add_library(jemalloc INTERFACE)
target_link_libraries(jemalloc
INTERFACE
valgrind)
endif()
# Create the header, so we can use it
configure_file(
"${CMAKE_SOURCE_DIR}/dep/jemalloc/jemalloc_defs.h.in.cmake"
"${BUILDDIR}/jemalloc_defs.h"
@ONLY
)
# Done, let's continue
set(jemalloc_STAT_SRC
${CMAKE_CURRENT_SOURCE_DIR}/src/arena.c
${CMAKE_CURRENT_SOURCE_DIR}/src/atomic.c
${CMAKE_CURRENT_SOURCE_DIR}/src/base.c
${CMAKE_CURRENT_SOURCE_DIR}/src/bitmap.c
${CMAKE_CURRENT_SOURCE_DIR}/src/chunk.c
${CMAKE_CURRENT_SOURCE_DIR}/src/chunk_dss.c
${CMAKE_CURRENT_SOURCE_DIR}/src/chunk_mmap.c
${CMAKE_CURRENT_SOURCE_DIR}/src/ckh.c
${CMAKE_CURRENT_SOURCE_DIR}/src/ctl.c
${CMAKE_CURRENT_SOURCE_DIR}/src/extent.c
${CMAKE_CURRENT_SOURCE_DIR}/src/hash.c
${CMAKE_CURRENT_SOURCE_DIR}/src/huge.c
${CMAKE_CURRENT_SOURCE_DIR}/src/jemalloc.c
${CMAKE_CURRENT_SOURCE_DIR}/src/mb.c
${CMAKE_CURRENT_SOURCE_DIR}/src/mutex.c
${CMAKE_CURRENT_SOURCE_DIR}/src/prof.c
${CMAKE_CURRENT_SOURCE_DIR}/src/quarantine.c
${CMAKE_CURRENT_SOURCE_DIR}/src/rtree.c
${CMAKE_CURRENT_SOURCE_DIR}/src/stats.c
${CMAKE_CURRENT_SOURCE_DIR}/src/tcache.c
${CMAKE_CURRENT_SOURCE_DIR}/src/tsd.c
${CMAKE_CURRENT_SOURCE_DIR}/src/util.c
)
include_directories(
${BUILDDIR}/
${CMAKE_CURRENT_SOURCE_DIR}/include
${VALGRIND_INCLUDE_DIR}
)
add_definitions(-D_GNU_SOURCE -D_REENTRANT)
add_library(jemalloc STATIC ${jemalloc_STAT_SRC})

22
dep/mysql/CMakeLists.txt Normal file
View File

@@ -0,0 +1,22 @@
# Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
#
# 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 MYSQL_FOUND)
message(FATAL_ERROR "MySQL wasn't found on your system but it's required to build the servers!")
endif()
add_library(mysql STATIC IMPORTED GLOBAL)
set_target_properties(mysql
PROPERTIES
IMPORTED_LOCATION
"${MYSQL_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES
"${MYSQL_INCLUDE_DIR}")

View File

@@ -0,0 +1,26 @@
# Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
#
# 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.
# basic packagesearching and setup
# (further support will be needed, this is a preliminary release!)
set(OPENSSL_EXPECTED_VERSION 1.0.0)
find_package(OpenSSL REQUIRED)
add_library(openssl INTERFACE)
target_link_libraries(openssl
INTERFACE
${OPENSSL_LIBRARIES})
target_include_directories(openssl
INTERFACE
${OPENSSL_INCLUDE_DIR})

View File

@@ -0,0 +1,19 @@
# Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
#
# 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.
add_library(process INTERFACE)
target_include_directories(process
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(process
INTERFACE
boost)

View File

@@ -0,0 +1,38 @@
# Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
#
# 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( UNIX )
# find Readline (terminal input library) includes and library
#
# READLINE_INCLUDE_DIR - where the directory containing the READLINE headers can be found
# READLINE_LIBRARY - full path to the READLINE library
find_path(READLINE_INCLUDE_DIR readline/readline.h)
find_library(READLINE_LIBRARY NAMES readline)
message(STATUS "Found Readline library: ${READLINE_LIBRARY}")
message(STATUS "Include dir is: ${READLINE_INCLUDE_DIR}")
if (NOT READLINE_INCLUDE_DIR OR NOT READLINE_LIBRARY)
message(FATAL_ERROR "** Readline library not found!\n** Your distro may provide a binary for Readline e.g. for ubuntu try apt-get install libreadline5-dev")
endif ()
add_library(readline SHARED IMPORTED GLOBAL)
set_target_properties(readline
PROPERTIES
IMPORTED_LOCATION
"${READLINE_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES
"${READLINE_INCLUDE_DIR}")
else()
# Provide a dummy target
add_library(readline INTERFACE)
endif()

View File

@@ -16,14 +16,18 @@ set(Detour_STAT_SRCS
Source/DetourNavMeshQuery.cpp
Source/DetourNode.cpp
)
include_directories(Include)
if(WIN32)
include_directories(
${CMAKE_SOURCE_DIR}/dep/zlib
)
endif()
add_library(Detour STATIC ${Detour_STAT_SRCS})
target_link_libraries(Detour ${ZLIB_LIBRARIES})
target_include_directories(Detour
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/Include)
target_link_libraries(Detour
PUBLIC
zlib)
set_target_properties(Detour
PROPERTIES
FOLDER
"dep")

View File

@@ -14,21 +14,24 @@ set(Recast_STAT_SRCS
Source/RecastArea.cpp
Source/RecastContour.cpp
Source/RecastFilter.cpp
Source/RecastLayers.cpp
Source/RecastLayers.cpp
Source/RecastMesh.cpp
Source/RecastMeshDetail.cpp
Source/RecastRasterization.cpp
Source/RecastRegion.cpp
)
include_directories(Include)
if(WIN32)
include_directories(
${CMAKE_SOURCE_DIR}/dep/zlib
)
endif()
add_library(Recast STATIC ${Recast_STAT_SRCS})
target_link_libraries(Recast ${ZLIB_LIBRARIES})
target_include_directories(Recast
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/Include)
target_link_libraries(Recast
PUBLIC
zlib)
set_target_properties(Recast
PROPERTIES
FOLDER
"dep")

View File

@@ -0,0 +1,16 @@
# Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
#
# 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_package(Threads REQUIRED)
add_library(threads INTERFACE)
target_link_libraries(threads
INTERFACE
${CMAKE_THREAD_LIBS_INIT})

View File

@@ -0,0 +1,15 @@
# Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
#
# 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.
add_library(utf8cpp INTERFACE)
target_include_directories(utf8cpp
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR})

View File

@@ -0,0 +1,15 @@
# Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
#
# 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.
add_library(valgrind INTERFACE)
target_include_directories(valgrind
INTERFACE
"${VALGRIND_INCLUDE_DIR}")

View File

@@ -8,22 +8,43 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
SET(zlib_STAT_SRCS
adler32.c
compress.c
crc32.c
deflate.c
infback.c
inffast.c
inflate.c
inftrees.c
trees.c
uncompr.c
zutil.c
)
if(UNIX)
# Look for an installed zlib on unix
find_package(ZLIB REQUIRED)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
)
add_library(zlib SHARED IMPORTED GLOBAL)
add_library(zlib STATIC ${zlib_STAT_SRCS})
set_target_properties(zlib
PROPERTIES
IMPORTED_LOCATION
"${ZLIB_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES
"${ZLIB_INCLUDE_DIRS}")
else()
# Use the bundled source on windows
SET(zlib_STAT_SRCS
adler32.c
compress.c
crc32.c
deflate.c
infback.c
inffast.c
inflate.c
inftrees.c
trees.c
uncompr.c
zutil.c
)
add_library(zlib STATIC
${zlib_STAT_SRCS})
target_include_directories(zlib
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(zlib
PROPERTIES
FOLDER
"dep")
endif()

21
dep/zmq/CMakeLists.txt Normal file
View File

@@ -0,0 +1,21 @@
# Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
#
# 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_package(ZMQ REQUIRED)
add_library(zmq INTERFACE)
target_link_libraries(zmq
INTERFACE
${ZMQ_LIBRARY})
target_include_directories(zmq
INTERFACE
${ZMQ_INCLUDE_DIR})

View File

@@ -10,22 +10,28 @@
file(GLOB_RECURSE sources_zmqpp zmqpp/*.cpp zmqpp/*.hpp zmqpp/*.h)
set(zmqpp_STAT_SRCS
${sources_zmqpp}
)
include_directories(${ZMQ_INCLUDE_DIR})
add_library(zmqpp STATIC
${zmqpp_STAT_SRCS}
${sources_zmqpp}
)
if (WIN32)
add_definitions(-DBUILD_VERSION=\\"3.2.0\\")
else()
add_definitions(-DBUILD_VERSION='"3.2.0"')
endif()
target_link_libraries(zmqpp
PUBLIC
zmq)
add_definitions(-DBUILD_VERSION_MAJOR=3)
add_definitions(-DBUILD_VERSION_MINOR=2)
add_definitions(-DBUILD_VERSION_REVISION=0)
target_include_directories(zmqpp
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(zmqpp
PROPERTIES
FOLDER
"dep")
target_compile_definitions(zmqpp
PRIVATE
-DBUILD_VERSION_MAJOR=3
-DBUILD_VERSION_MINOR=2
-DBUILD_VERSION_REVISION=0
-DBUILD_VERSION="3.2.0")

View File

@@ -8,8 +8,6 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
find_package(ZMQ REQUIRED)
file(GLOB_RECURSE sources_ipc *.cpp *.h)
set(ipc_SRCS