diff options
author | Naios <naios-dev@live.de> | 2016-03-14 15:27:33 +0100 |
---|---|---|
committer | Naios <naios-dev@live.de> | 2016-03-19 23:19:50 +0100 |
commit | b0ac332d58cc7d7e2da4ba26efc2f3416c674784 (patch) | |
tree | adf5cf58803efeb51650c2da754278c2cc2f6c27 /dep | |
parent | fee9bb904a5dcfc93e6ea85789b5aacc203a440a (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
(cherry picked from commit 1a572d242593124f986d3ed08710b96a142a6763)
Diffstat (limited to 'dep')
-rw-r--r-- | dep/CMakeLists.txt | 27 | ||||
-rw-r--r-- | dep/CascLib/CMakeLists.txt | 13 | ||||
-rw-r--r-- | dep/PackageList.txt | 10 | ||||
-rw-r--r-- | dep/SFMT/CMakeLists.txt | 15 | ||||
-rw-r--r-- | dep/boost/CMakeLists.txt | 67 | ||||
-rw-r--r-- | dep/bzip2/CMakeLists.txt | 33 | ||||
-rw-r--r-- | dep/cppformat/CMakeLists.txt | 46 | ||||
-rw-r--r-- | dep/g3dlite/CMakeLists.txt | 27 | ||||
-rw-r--r-- | dep/gsoap/CMakeLists.txt | 25 | ||||
-rw-r--r-- | dep/jemalloc/CMakeLists.txt | 123 | ||||
-rw-r--r-- | dep/mysql/CMakeLists.txt | 22 | ||||
-rw-r--r-- | dep/openssl/CMakeLists.txt | 26 | ||||
-rw-r--r-- | dep/process/CMakeLists.txt | 19 | ||||
-rw-r--r-- | dep/readline/CMakeLists.txt | 38 | ||||
-rw-r--r-- | dep/recastnavigation/Detour/CMakeLists.txt | 20 | ||||
-rw-r--r-- | dep/recastnavigation/Recast/CMakeLists.txt | 21 | ||||
-rw-r--r-- | dep/threads/CMakeLists.txt | 16 | ||||
-rw-r--r-- | dep/utf8cpp/CMakeLists.txt | 15 | ||||
-rw-r--r-- | dep/valgrind/CMakeLists.txt | 15 | ||||
-rw-r--r-- | dep/zlib/CMakeLists.txt | 55 | ||||
-rw-r--r-- | dep/zmq/CMakeLists.txt | 21 | ||||
-rw-r--r-- | dep/zmqpp/CMakeLists.txt | 32 |
22 files changed, 519 insertions, 167 deletions
diff --git a/dep/CMakeLists.txt b/dep/CMakeLists.txt index 6caa1e1e70c..2e7c2addb1f 100644 --- a/dep/CMakeLists.txt +++ b/dep/CMakeLists.txt @@ -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() diff --git a/dep/CascLib/CMakeLists.txt b/dep/CascLib/CMakeLists.txt index 83b7ea38493..79be0a0830c 100644 --- a/dep/CascLib/CMakeLists.txt +++ b/dep/CascLib/CMakeLists.txt @@ -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") diff --git a/dep/PackageList.txt b/dep/PackageList.txt index 7f10848aa0a..39182485eb1 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 @@ -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 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/dep/boost/CMakeLists.txt b/dep/boost/CMakeLists.txt new file mode 100644 index 00000000000..118635c85bd --- /dev/null +++ b/dep/boost/CMakeLists.txt @@ -0,0 +1,67 @@ +# 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}) + set(BOOST_ROOT $ENV{BOOST_ROOT}) + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0) + set(BOOST_LIBRARYDIR ${BOOST_ROOT}/lib${PLATFORM}-msvc-12.0) + else() + set(BOOST_LIBRARYDIR ${BOOST_ROOT}/lib${PLATFORM}-msvc-14.0) + endif() + else() + message(FATAL_ERROR "No BOOST_ROOT environment variable could be found! Please make sure it is set and the points to your Boost installation.") + endif() + + set(Boost_USE_STATIC_LIBS ON) + set(Boost_USE_MULTITHREADED ON) + set(Boost_USE_STATIC_RUNTIME OFF) +endif() + +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 + +include (CheckCXXSourceCompiles) + +set(CMAKE_REQUIRED_INCLUDES ${Boost_INCLUDE_DIR}) +set(CMAKE_REQUIRED_LIBRARIES ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_IOSTREAMS_LIBRARY}) +set(CMAKE_REQUIRED_FLAGS "-std=c++11") +unset(boost_filesystem_copy_links_without_NO_SCOPED_ENUM CACHE) +check_cxx_source_compiles(" + #include <boost/filesystem/path.hpp> + #include <boost/filesystem/operations.hpp> + int main() { boost::filesystem::copy_file(boost::filesystem::path(), boost::filesystem::path()); }" +boost_filesystem_copy_links_without_NO_SCOPED_ENUM) +unset(CMAKE_REQUIRED_INCLUDES CACHE) +unset(CMAKE_REQUIRED_LIBRARIES CACHE) +unset(CMAKE_REQUIRED_FLAGS CACHE) + +if (NOT boost_filesystem_copy_links_without_NO_SCOPED_ENUM) + set(OPTIONAL_BOOST_NO_SCOPED_ENUMS -DBOOST_NO_CXX11_SCOPED_ENUMS) +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/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() diff --git a/dep/zmq/CMakeLists.txt b/dep/zmq/CMakeLists.txt new file mode 100644 index 00000000000..9d9f78ca8e5 --- /dev/null +++ b/dep/zmq/CMakeLists.txt @@ -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}) diff --git a/dep/zmqpp/CMakeLists.txt b/dep/zmqpp/CMakeLists.txt index 24b1d08c265..0514d73be0b 100644 --- a/dep/zmqpp/CMakeLists.txt +++ b/dep/zmqpp/CMakeLists.txt @@ -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) + +target_include_directories(zmqpp + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}) + +set_target_properties(zmqpp + PROPERTIES + FOLDER + "dep") -add_definitions(-DBUILD_VERSION_MAJOR=3) -add_definitions(-DBUILD_VERSION_MINOR=2) -add_definitions(-DBUILD_VERSION_REVISION=0) +target_compile_definitions(zmqpp + PRIVATE + -DBUILD_VERSION_MAJOR=3 + -DBUILD_VERSION_MINOR=2 + -DBUILD_VERSION_REVISION=0 + -DBUILD_VERSION="3.2.0") |