aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaios <naios-dev@live.de>2016-03-14 15:27:33 +0100
committerNaios <naios-dev@live.de>2016-03-18 02:52:54 +0100
commit1a572d242593124f986d3ed08710b96a142a6763 (patch)
treebbc1cdcadfb678ce915fc02e18a9926bfb51c1d0
parent87bc353b3446fb95e141d44fe49da3e5059f7436 (diff)
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
-rw-r--r--CMakeLists.txt20
-rw-r--r--cmake/macros/FindReadline.cmake18
-rw-r--r--cmake/platform/unix/settings.cmake9
-rw-r--r--cmake/platform/win/settings.cmake8
-rw-r--r--dep/CMakeLists.txt26
-rw-r--r--dep/PackageList.txt12
-rw-r--r--dep/SFMT/CMakeLists.txt15
-rw-r--r--dep/boost/CMakeLists.txt (renamed from cmake/macros/ConfigureBoost.cmake)42
-rw-r--r--dep/bzip2/CMakeLists.txt33
-rw-r--r--dep/cppformat/CMakeLists.txt46
-rw-r--r--dep/g3dlite/CMakeLists.txt27
-rw-r--r--dep/gsoap/CMakeLists.txt25
-rw-r--r--dep/jemalloc/CMakeLists.txt123
-rw-r--r--dep/libmpq/CMakeLists.txt38
-rw-r--r--dep/mysql/CMakeLists.txt22
-rw-r--r--dep/openssl/CMakeLists.txt26
-rw-r--r--dep/process/CMakeLists.txt19
-rw-r--r--dep/readline/CMakeLists.txt38
-rw-r--r--dep/recastnavigation/Detour/CMakeLists.txt20
-rw-r--r--dep/recastnavigation/Recast/CMakeLists.txt21
-rw-r--r--dep/threads/CMakeLists.txt16
-rw-r--r--dep/utf8cpp/CMakeLists.txt15
-rw-r--r--dep/valgrind/CMakeLists.txt15
-rw-r--r--dep/zlib/CMakeLists.txt55
24 files changed, 459 insertions, 230 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5eeb5911ca9..d24ba679598 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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()
diff --git a/cmake/macros/FindReadline.cmake b/cmake/macros/FindReadline.cmake
deleted file mode 100644
index 34af35204b5..00000000000
--- a/cmake/macros/FindReadline.cmake
+++ /dev/null
@@ -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)
diff --git a/cmake/platform/unix/settings.cmake b/cmake/platform/unix/settings.cmake
index 754ff450fcc..2f9c71f28ed 100644
--- a/cmake/platform/unix/settings.cmake
+++ b/cmake/platform/unix/settings.cmake
@@ -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)
diff --git a/cmake/platform/win/settings.cmake b/cmake/platform/win/settings.cmake
index c68d7bc51cc..da66daf0832 100644
--- a/cmake/platform/win/settings.cmake
+++ b/cmake/platform/win/settings.cmake
@@ -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 )
diff --git a/dep/CMakeLists.txt b/dep/CMakeLists.txt
index 7f4f1cd884c..76007ade563 100644
--- a/dep/CMakeLists.txt
+++ b/dep/CMakeLists.txt
@@ -14,31 +14,29 @@ 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(cppformat)
+ add_subdirectory(SFMT)
+ add_subdirectory(utf8cpp)
+ add_subdirectory(valgrind)
+ add_subdirectory(openssl)
endif()
if(SERVERS)
+ add_subdirectory(mysql)
+ add_subdirectory(readline)
+ add_subdirectory(jemalloc)
add_subdirectory(gsoap)
+ add_subdirectory(process)
endif()
if(TOOLS)
+ add_subdirectory(bzip2)
add_subdirectory(libmpq)
endif()
diff --git a/dep/PackageList.txt b/dep/PackageList.txt
index 6ff4badddf6..f855e8d493d 100644
--- a/dep/PackageList.txt
+++ b/dep/PackageList.txt
@@ -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
@@ -23,11 +23,19 @@ G3D (a commercial-grade C++ 3D engine available as Open Source (BSD License)
jemalloc (a general-purpose scalable concurrent malloc-implementation)
http://www.canonware.com/jemalloc/
Version: 3.6.0
-
+
libMPQ (a library for reading MPQ files)
https://github.com/mbroemme/libmpq/
Version: d59b4cf1d107b5f6a0f67d6bc545c6c6ebef3d74
+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
diff --git a/dep/SFMT/CMakeLists.txt b/dep/SFMT/CMakeLists.txt
new file mode 100644
index 00000000000..5cf1b9bf972
--- /dev/null
+++ b/dep/SFMT/CMakeLists.txt
@@ -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})
diff --git a/cmake/macros/ConfigureBoost.cmake b/dep/boost/CMakeLists.txt
index b3a71b8a682..118635c85bd 100644
--- a/cmake/macros/ConfigureBoost.cmake
+++ b/dep/boost/CMakeLists.txt
@@ -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.49 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_package(Boost 1.51 REQUIRED system filesystem thread program_options iostreams regex)
# Find if Boost was compiled in C++03 mode because it requires -DBOOST_NO_CXX11_SCOPED_ENUMS
@@ -41,13 +46,22 @@ unset(CMAKE_REQUIRED_LIBRARIES CACHE)
unset(CMAKE_REQUIRED_FLAGS CACHE)
if (NOT boost_filesystem_copy_links_without_NO_SCOPED_ENUM)
- if (Boost_VERSION LESS 105100) # 1.51
- add_definitions(-DBOOST_NO_SCOPED_ENUMS)
- else()
- add_definitions(-DBOOST_NO_CXX11_SCOPED_ENUMS)
- endif()
+ 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})
diff --git a/dep/bzip2/CMakeLists.txt b/dep/bzip2/CMakeLists.txt
index d3aadbe002e..d5a7414f383 100644
--- a/dep/bzip2/CMakeLists.txt
+++ b/dep/bzip2/CMakeLists.txt
@@ -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()
diff --git a/dep/cppformat/CMakeLists.txt b/dep/cppformat/CMakeLists.txt
index 3f1bb4f6a9f..1cbff49b871 100644
--- a/dep/cppformat/CMakeLists.txt
+++ b/dep/cppformat/CMakeLists.txt
@@ -1,31 +1,37 @@
-include(CheckCXXCompilerFlag)
-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)
+# 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)
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")
diff --git a/dep/g3dlite/CMakeLists.txt b/dep/g3dlite/CMakeLists.txt
index f1166c72e6d..4e579951d63 100644
--- a/dep/g3dlite/CMakeLists.txt
+++ b/dep/g3dlite/CMakeLists.txt
@@ -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")
diff --git a/dep/gsoap/CMakeLists.txt b/dep/gsoap/CMakeLists.txt
index b5fed7809af..bdcadf6e4dc 100644
--- a/dep/gsoap/CMakeLists.txt
+++ b/dep/gsoap/CMakeLists.txt
@@ -10,17 +10,22 @@
file(GLOB sources *.cpp *.h)
-set(gsoap_STAT_SRCS
- ${sources}
-)
+add_library(gsoap STATIC ${sources})
-include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
-)
+set_target_properties(gsoap PROPERTIES LINKER_LANGUAGE CXX)
-# Little fix for MSVC / Windows platforms
-add_definitions(-D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=0)
+target_include_directories(gsoap
+ PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR})
-add_library(gsoap STATIC ${gsoap_STAT_SRCS})
+set_target_properties(gsoap
+ PROPERTIES
+ FOLDER
+ "dep")
-set_target_properties(gsoap PROPERTIES LINKER_LANGUAGE CXX)
+if (MSVC)
+ # Little fix for MSVC / Windows platforms
+ target_compile_definitions(gsoap
+ PRIVATE
+ -D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=0)
+endif()
diff --git a/dep/jemalloc/CMakeLists.txt b/dep/jemalloc/CMakeLists.txt
index cf0ac435f0a..6774e5a75d2 100644
--- a/dep/jemalloc/CMakeLists.txt
+++ b/dep/jemalloc/CMakeLists.txt
@@ -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\"\)\)\)")
-endif()
+ # 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)
-# 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})
+endif()
diff --git a/dep/libmpq/CMakeLists.txt b/dep/libmpq/CMakeLists.txt
index 1213e6b11b7..e8b420fca53 100644
--- a/dep/libmpq/CMakeLists.txt
+++ b/dep/libmpq/CMakeLists.txt
@@ -8,27 +8,29 @@
# 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_mpq libmpq/*.c libmpq/*.h)
+file(GLOB sources libmpq/*.c libmpq/*.h)
-set(mpq_STAT_SRCS
- ${sources_mpq}
-)
+add_library(mpq STATIC ${sources})
-if( UNIX )
- include_directories(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_SOURCE_DIR}/dep/zlib
- ${CMAKE_SOURCE_DIR}/dep/bzip2
- )
-elseif( WIN32 )
- include_directories(
+set_target_properties(mpq PROPERTIES LINKER_LANGUAGE CXX)
+
+if(WIN32)
+ set(WIN_EXTRA_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/win)
+endif()
+
+target_include_directories(mpq
+ PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}/win
+ ${WIN_EXTRA_INCLUDE}
${CMAKE_SOURCE_DIR}/dep/zlib
- ${CMAKE_SOURCE_DIR}/dep/bzip2
- )
-endif()
+ ${CMAKE_SOURCE_DIR}/dep/bzip2)
-add_library(mpq STATIC ${mpq_STAT_SRCS})
+target_link_libraries(mpq
+ PUBLIC
+ zlib
+ bzip2)
-set_target_properties(mpq PROPERTIES LINKER_LANGUAGE CXX)
+set_target_properties(mpq
+ PROPERTIES
+ FOLDER
+ "dep")
diff --git a/dep/mysql/CMakeLists.txt b/dep/mysql/CMakeLists.txt
new file mode 100644
index 00000000000..472535b0356
--- /dev/null
+++ b/dep/mysql/CMakeLists.txt
@@ -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}")
diff --git a/dep/openssl/CMakeLists.txt b/dep/openssl/CMakeLists.txt
new file mode 100644
index 00000000000..98561b2a0ed
--- /dev/null
+++ b/dep/openssl/CMakeLists.txt
@@ -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})
diff --git a/dep/process/CMakeLists.txt b/dep/process/CMakeLists.txt
new file mode 100644
index 00000000000..5a51917a00c
--- /dev/null
+++ b/dep/process/CMakeLists.txt
@@ -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)
diff --git a/dep/readline/CMakeLists.txt b/dep/readline/CMakeLists.txt
new file mode 100644
index 00000000000..0e8679ba718
--- /dev/null
+++ b/dep/readline/CMakeLists.txt
@@ -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()
diff --git a/dep/recastnavigation/Detour/CMakeLists.txt b/dep/recastnavigation/Detour/CMakeLists.txt
index b21e4ca6273..12be71d32b4 100644
--- a/dep/recastnavigation/Detour/CMakeLists.txt
+++ b/dep/recastnavigation/Detour/CMakeLists.txt
@@ -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")
diff --git a/dep/recastnavigation/Recast/CMakeLists.txt b/dep/recastnavigation/Recast/CMakeLists.txt
index 738c010eb05..1eac4e75399 100644
--- a/dep/recastnavigation/Recast/CMakeLists.txt
+++ b/dep/recastnavigation/Recast/CMakeLists.txt
@@ -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)
+add_library(Recast STATIC ${Recast_STAT_SRCS})
-if(WIN32)
- include_directories(
- ${CMAKE_SOURCE_DIR}/dep/zlib
- )
-endif()
+target_include_directories(Recast
+ PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/Include)
-add_library(Recast STATIC ${Recast_STAT_SRCS})
+target_link_libraries(Recast
+ PUBLIC
+ zlib)
-target_link_libraries(Recast ${ZLIB_LIBRARIES}) \ No newline at end of file
+set_target_properties(Recast
+ PROPERTIES
+ FOLDER
+ "dep")
diff --git a/dep/threads/CMakeLists.txt b/dep/threads/CMakeLists.txt
new file mode 100644
index 00000000000..48e5eb00723
--- /dev/null
+++ b/dep/threads/CMakeLists.txt
@@ -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})
diff --git a/dep/utf8cpp/CMakeLists.txt b/dep/utf8cpp/CMakeLists.txt
new file mode 100644
index 00000000000..edf8604d44c
--- /dev/null
+++ b/dep/utf8cpp/CMakeLists.txt
@@ -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})
diff --git a/dep/valgrind/CMakeLists.txt b/dep/valgrind/CMakeLists.txt
new file mode 100644
index 00000000000..d67cd33b426
--- /dev/null
+++ b/dep/valgrind/CMakeLists.txt
@@ -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}")
diff --git a/dep/zlib/CMakeLists.txt b/dep/zlib/CMakeLists.txt
index 7feb134bcd5..b3e3d58fe55 100644
--- a/dep/zlib/CMakeLists.txt
+++ b/dep/zlib/CMakeLists.txt
@@ -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()