diff options
Diffstat (limited to 'cmake')
| -rw-r--r-- | cmake/compiler/clang/settings.cmake | 13 | ||||
| -rw-r--r-- | cmake/compiler/gcc/settings.cmake | 12 | ||||
| -rw-r--r-- | cmake/compiler/msvc/settings.cmake | 33 | ||||
| -rw-r--r-- | cmake/macros/AutoCollect.cmake | 71 | ||||
| -rw-r--r-- | cmake/macros/ConfigureBoost.cmake | 49 | ||||
| -rw-r--r-- | cmake/macros/FindPCHSupport.cmake | 40 | ||||
| -rw-r--r-- | cmake/macros/FindReadline.cmake | 18 | ||||
| -rw-r--r-- | cmake/macros/FindZMQ.cmake | 89 | ||||
| -rw-r--r-- | cmake/macros/GroupSources.cmake | 9 | ||||
| -rw-r--r-- | cmake/options.cmake | 5 | ||||
| -rw-r--r-- | cmake/platform/unix/settings.cmake | 11 | ||||
| -rw-r--r-- | cmake/platform/win/settings.cmake | 8 | ||||
| -rw-r--r-- | cmake/showoptions.cmake | 35 |
13 files changed, 187 insertions, 206 deletions
diff --git a/cmake/compiler/clang/settings.cmake b/cmake/compiler/clang/settings.cmake index 261a55b285f..9a8cb85275e 100644 --- a/cmake/compiler/clang/settings.cmake +++ b/cmake/compiler/clang/settings.cmake @@ -18,3 +18,16 @@ endif() # -Wno-deprecated-register is needed to suppress 185 gsoap warnings on Unix systems. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-narrowing -Wno-deprecated-register") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG=1") + +if (WITH_DYNAMIC_LINKING) + # -fPIC is needed to allow static linking in shared libs. + # -fvisibility=hidden sets the default visibility to hidden to prevent exporting of all symbols. + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -fvisibility=hidden") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fvisibility=hidden") + + # --no-undefined to throw errors when there are undefined symbols + # (caused through missing TRINITY_*_API macros). + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --no-undefined") + + message(STATUS "Clang: Disallow undefined symbols") +endif() diff --git a/cmake/compiler/gcc/settings.cmake b/cmake/compiler/gcc/settings.cmake index acd71e82fd9..d9eda767b8e 100644 --- a/cmake/compiler/gcc/settings.cmake +++ b/cmake/compiler/gcc/settings.cmake @@ -34,3 +34,15 @@ if( WITH_COREDEBUG ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3") message(STATUS "GCC: Debug-flags set (-g3)") endif() + +if (WITH_DYNAMIC_LINKING) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -fvisibility=hidden -Wno-attributes") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fvisibility=hidden -Wno-attributes") + + # Should break the build when there are TRINITY_*_API macros missing + # but it complains about missing references in precompiled headers. + # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--no-undefined") + # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-undefined") + + message(STATUS "GCC: Enabled shared linking") +endif() diff --git a/cmake/compiler/msvc/settings.cmake b/cmake/compiler/msvc/settings.cmake index f4ed0e12786..86470f327c5 100644 --- a/cmake/compiler/msvc/settings.cmake +++ b/cmake/compiler/msvc/settings.cmake @@ -18,11 +18,6 @@ if(PLATFORM EQUAL 64) add_definitions("-D_WIN64") message(STATUS "MSVC: 64-bit platform, enforced -D_WIN64 parameter") - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.23026.0) - #Enable extended object support for debug compiles on X64 (not required on X86) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj") - message(STATUS "MSVC: Enabled increased number of sections in object files") - endif() else() # mark 32 bit executables large address aware so they can use > 2GB address space set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE") @@ -41,15 +36,20 @@ add_definitions(-D_BUILD_DIRECTIVE=\\"$(ConfigurationName)\\") # multithreaded compiling on VS set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") +if((PLATFORM EQUAL 64) OR (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.23026.0) OR WITH_DYNAMIC_LINKING) + # Enable extended object support + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") + message(STATUS "MSVC: Enabled increased number of sections in object files") +endif() + # /Zc:throwingNew. # When you specify Zc:throwingNew on the command line, it instructs the compiler to assume # that the program will eventually be linked with a conforming operator new implementation, # and can omit all of these extra null checks from your program. # http://blogs.msdn.com/b/vcblog/archive/2015/08/06/new-in-vs-2015-zc-throwingnew.aspx if(NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.23026.0)) - # also enable /bigobj for ALL builds under visual studio 2015, increased number of templates in standard library # makes this flag a requirement to build TC at all - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:throwingNew /bigobj") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:throwingNew") endif() # Define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES - eliminates the warning by changing the strcpy call to strcpy_s, which prevents buffer overruns @@ -75,6 +75,13 @@ if(NOT WITH_WARNINGS) message(STATUS "MSVC: Disabled generic compiletime warnings") endif() +if (WITH_DYNAMIC_LINKING) + # C4251: needs to have dll-interface to be used by clients of class '...' + # C4275: non dll-interface class ...' used as base for dll-interface class '...' + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251 /wd4275") + message(STATUS "MSVC: Enabled shared linking") +endif() + # Specify the maximum PreCompiled Header memory allocation limit # Fixes a compiler-problem when using PCH - the /Ym flag is adjusted by the compiler in MSVC2012, hence we need to set an upper limit with /Zm to avoid discrepancies) # (And yes, this is a verified , unresolved bug with MSVC... *sigh*) @@ -85,3 +92,15 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zm500") # 'function' : member function does not override any base class virtual member function # 'virtual_function' : no override available for virtual member function from base 'class'; function is hidden set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /we4263 /we4264") + +# Disable incremental linking in debug builds. +# To prevent linking getting stuck (which might be fixed in a later VS version). +macro(DisableIncrementalLinking variable) + string(REGEX REPLACE "/INCREMENTAL *" "" ${variable} "${${variable}}") + set(${variable} "${${variable}} /INCREMENTAL:NO") +endmacro() + +DisableIncrementalLinking(CMAKE_EXE_LINKER_FLAGS_DEBUG) +DisableIncrementalLinking(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO) +DisableIncrementalLinking(CMAKE_SHARED_LINKER_FLAGS_DEBUG) +DisableIncrementalLinking(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO) diff --git a/cmake/macros/AutoCollect.cmake b/cmake/macros/AutoCollect.cmake new file mode 100644 index 00000000000..cddd3a20290 --- /dev/null +++ b/cmake/macros/AutoCollect.cmake @@ -0,0 +1,71 @@ +# 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. + +# Collects all source files into the given variable, +# which is useful to include all sources in subdirectories. +# Ignores full qualified directories listed in the variadic arguments. +# +# Use it like: +# CollectSourceFiles( +# ${CMAKE_CURRENT_SOURCE_DIR} +# COMMON_PRIVATE_SOURCES +# # Exclude +# ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders +# ${CMAKE_CURRENT_SOURCE_DIR}/Platform) +# +function(CollectSourceFiles current_dir variable) + list(FIND ARGN "${current_dir}" IS_EXCLUDED) + if(IS_EXCLUDED EQUAL -1) + file(GLOB COLLECTED_SOURCES + ${current_dir}/*.c + ${current_dir}/*.cc + ${current_dir}/*.cpp + ${current_dir}/*.inl + ${current_dir}/*.def + ${current_dir}/*.h + ${current_dir}/*.hh + ${current_dir}/*.hpp) + list(APPEND ${variable} ${COLLECTED_SOURCES}) + + file(GLOB SUB_DIRECTORIES ${current_dir}/*) + foreach(SUB_DIRECTORY ${SUB_DIRECTORIES}) + if (IS_DIRECTORY ${SUB_DIRECTORY}) + CollectSourceFiles("${SUB_DIRECTORY}" "${variable}" "${ARGN}") + endif() + endforeach() + set(${variable} ${${variable}} PARENT_SCOPE) + endif() +endfunction() + +# Collects all subdirectoroies into the given variable, +# which is useful to include all subdirectories. +# Ignores full qualified directories listed in the variadic arguments. +# +# Use it like: +# CollectIncludeDirectories( +# ${CMAKE_CURRENT_SOURCE_DIR} +# COMMON_PUBLIC_INCLUDES +# # Exclude +# ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders +# ${CMAKE_CURRENT_SOURCE_DIR}/Platform) +# +function(CollectIncludeDirectories current_dir variable) + list(FIND ARGN "${current_dir}" IS_EXCLUDED) + if(IS_EXCLUDED EQUAL -1) + list(APPEND ${variable} ${current_dir}) + file(GLOB SUB_DIRECTORIES ${current_dir}/*) + foreach(SUB_DIRECTORY ${SUB_DIRECTORIES}) + if (IS_DIRECTORY ${SUB_DIRECTORY}) + CollectIncludeDirectories("${SUB_DIRECTORY}" "${variable}" "${ARGN}") + endif() + endforeach() + set(${variable} ${${variable}} PARENT_SCOPE) + endif() +endfunction() diff --git a/cmake/macros/ConfigureBoost.cmake b/cmake/macros/ConfigureBoost.cmake deleted file mode 100644 index 3db9fc54a8c..00000000000 --- a/cmake/macros/ConfigureBoost.cmake +++ /dev/null @@ -1,49 +0,0 @@ -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) - - 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 - -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) - add_definitions(-DBOOST_NO_CXX11_SCOPED_ENUMS) -endif() - -if(Boost_FOUND) - include_directories(${Boost_INCLUDE_DIRS}) -endif() diff --git a/cmake/macros/FindPCHSupport.cmake b/cmake/macros/FindPCHSupport.cmake index 49d4be904d1..6edc8e92890 100644 --- a/cmake/macros/FindPCHSupport.cmake +++ b/cmake/macros/FindPCHSupport.cmake @@ -1,17 +1,49 @@ -FUNCTION(GET_COMMON_PCH_PARAMS PCH_HEADER PCH_FE INCLUDE_PREFIX) +FUNCTION(GET_COMMON_PCH_PARAMS TARGET_NAME_LIST PCH_HEADER PCH_FE INCLUDE_PREFIX) GET_FILENAME_COMPONENT(PCH_HEADER_N ${PCH_HEADER} NAME) GET_DIRECTORY_PROPERTY(TARGET_INCLUDES INCLUDE_DIRECTORIES) + # Stores the inherited dependency definitions and include directories + # from the given target into the given variables + MACRO(CollectIncludes target inherited_includes inherited_definitions) + # Append the includes and definitions of the current target to the list + get_property(included TARGET ${target} PROPERTY INTERFACE_INCLUDE_DIRECTORIES) + LIST(APPEND "${inherited_includes}" ${included}) + get_property(definitions TARGET ${target} PROPERTY INTERFACE_COMPILE_DEFINITIONS) + FOREACH(def ${definitions}) + LIST(APPEND "${inherited_definitions}" "-D${def}") + ENDFOREACH() + # Add all inherited link targets which weren't included already + get_property(links TARGET ${target} PROPERTY INTERFACE_LINK_LIBRARIES) + # TODO Maybe catch circular dependencies? + FOREACH(target_link ${links}) + IF(TARGET ${target_link}) + CollectIncludes(${target_link} "${inherited_includes}" "${inherited_definitions}") + ENDIF() + ENDFOREACH() + ENDMACRO() + + FOREACH(TARGET_NAME ${TARGET_NAME_LIST}) + CollectIncludes(${TARGET_NAME} TARGET_INCLUDES TARGET_DEFINITIONS) + ENDFOREACH() + + LIST(REMOVE_DUPLICATES TARGET_INCLUDES) + LIST(REMOVE_DUPLICATES TARGET_DEFINITIONS) + FOREACH(ITEM ${TARGET_INCLUDES}) LIST(APPEND INCLUDE_FLAGS_LIST "${INCLUDE_PREFIX}\"${ITEM}\" ") ENDFOREACH(ITEM) + SET(PCH_INCLUDES ${TARGET_INCLUDES} PARENT_SCOPE) + SET(PCH_DEFINITIONS ${TARGET_DEFINITIONS} PARENT_SCOPE) SET(PCH_HEADER_NAME ${PCH_HEADER_N} PARENT_SCOPE) SET(PCH_HEADER_OUT ${CMAKE_CURRENT_BINARY_DIR}/${PCH_HEADER_N}.${PCH_FE} PARENT_SCOPE) SET(INCLUDE_FLAGS ${INCLUDE_FLAGS_LIST} PARENT_SCOPE) ENDFUNCTION(GET_COMMON_PCH_PARAMS) FUNCTION(GENERATE_CXX_PCH_COMMAND TARGET_NAME_LIST INCLUDE_FLAGS IN PCH_SRC OUT) + include_directories(${PCH_INCLUDES}) + add_definitions(${PCH_DEFINITIONS}) + IF (CMAKE_BUILD_TYPE) STRING(TOUPPER _${CMAKE_BUILD_TYPE} CURRENT_BUILD_TYPE) ENDIF () @@ -62,7 +94,7 @@ FUNCTION(GENERATE_CXX_PCH_COMMAND TARGET_NAME_LIST INCLUDE_FLAGS IN PCH_SRC OUT) ENDFUNCTION(GENERATE_CXX_PCH_COMMAND) FUNCTION(ADD_CXX_PCH_GCC TARGET_NAME_LIST PCH_HEADER PCH_SOURCE) - GET_COMMON_PCH_PARAMS(${PCH_HEADER} "gch" "-I") + GET_COMMON_PCH_PARAMS("${TARGET_NAME_LIST}" ${PCH_HEADER} "gch" "-I") GENERATE_CXX_PCH_COMMAND("${TARGET_NAME_LIST}" "${INCLUDE_FLAGS}" ${PCH_HEADER} ${PCH_SOURCE} ${PCH_HEADER_OUT}) FOREACH(TARGET_NAME ${TARGET_NAME_LIST}) @@ -74,7 +106,7 @@ FUNCTION(ADD_CXX_PCH_GCC TARGET_NAME_LIST PCH_HEADER PCH_SOURCE) ENDFUNCTION(ADD_CXX_PCH_GCC) FUNCTION(ADD_CXX_PCH_CLANG TARGET_NAME_LIST PCH_HEADER PCH_SOURCE) - GET_COMMON_PCH_PARAMS(${PCH_HEADER} "pch" "-I") + GET_COMMON_PCH_PARAMS("${TARGET_NAME_LIST}" ${PCH_HEADER} "pch" "-I") GENERATE_CXX_PCH_COMMAND("${TARGET_NAME_LIST}" "${INCLUDE_FLAGS}" ${PCH_HEADER} ${PCH_SOURCE} ${PCH_HEADER_OUT}) FOREACH(TARGET_NAME ${TARGET_NAME_LIST}) @@ -86,7 +118,7 @@ FUNCTION(ADD_CXX_PCH_CLANG TARGET_NAME_LIST PCH_HEADER PCH_SOURCE) ENDFUNCTION(ADD_CXX_PCH_CLANG) FUNCTION(ADD_CXX_PCH_MSVC TARGET_NAME_LIST PCH_HEADER PCH_SOURCE) - GET_COMMON_PCH_PARAMS(${PCH_HEADER} "pch" "/I") + GET_COMMON_PCH_PARAMS("${TARGET_NAME_LIST}" ${PCH_HEADER} "pch" "/I") FOREACH(TARGET_NAME ${TARGET_NAME_LIST}) SET_TARGET_PROPERTIES( 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/macros/FindZMQ.cmake b/cmake/macros/FindZMQ.cmake deleted file mode 100644 index 4f415c539bf..00000000000 --- a/cmake/macros/FindZMQ.cmake +++ /dev/null @@ -1,89 +0,0 @@ -# -# Find the ZMQ includes and library -# - -# This module defines -# ZMQ_INCLUDE_DIR, where to find zmq.h -# ZMQ_LIBRARY, the library needed to use ZMQ -# ZMQ_FOUND, if false, you cannot build anything that requires ZMQ. - -set(ZMQ_FOUND 0) - -if (PLATFORM EQUAL 64) - set(ZMQ_REGISTRY_PATH - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\ZeroMQ (x64);DisplayIcon]" - ) -else() - set(ZMQ_REGISTRY_PATH - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\ZeroMQ;DisplayIcon]" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\ZeroMQ;DisplayIcon]" - ) -endif() - -find_path(ZMQ_ROOT_DIR - NAMES - include/zmq.h - HINTS - ${ZMQ_REGISTRY_PATH} - PATHS - /usr - /usr/local -) - -find_path(ZMQ_INCLUDE_DIR zmq.h ${ZMQ_ROOT_DIR}/include) - -if (MSVC) - # Read registry key holding version - if (PLATFORM EQUAL 64) - get_filename_component(ZMQ_NAME "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\ZeroMQ (x64);DisplayVersion]" NAME) - else() - get_filename_component(ZMQ_NAME "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\ZeroMQ;DisplayVersion]" NAME) - if (${ZMQ_NAME} MATCHES "registry") # if key was not found, the string "registry" is returned - get_filename_component(ZMQ_NAME "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\ZeroMQ;DisplayVersion]" NAME) - endif() - endif() - - # Replace dots with underscores - string(REGEX REPLACE "\\." "_" ZMQ_NAME ${ZMQ_NAME}) - - # Get Visual studio version number - string(REGEX REPLACE "Visual Studio ([0-9]+).*" "\\1" ZMQ_VS_VERSION ${CMAKE_GENERATOR}) - - # HACK - zmq doesnt ship libs for VS 2015 - if (${ZMQ_VS_VERSION} EQUAL 14) - set(ZMQ_VS_VERSION 12) - endif() - - if (${ZMQ_NAME} MATCHES "registry") # if key was not found, the string "registry" is returned - set(_ZMQ_VERSIONS "4_0_4" "4_0_3" "4_0_2" "4_0_1" "4_0_0" "3_2_5" "3_2_4" "3_2_3" "3_2_2" "3_2_1" "3_2_0" "3_1_0") - set(ZMQ_LIBRARY_NAME) - foreach(ver ${_ZMQ_VERSIONS}) - list(APPEND ZMQ_LIBRARY_NAME "libzmq-v${ZMQ_VS_VERSION}0-mt-${ver}") - endforeach() - else() - # Format ZMQ library file name - set(ZMQ_LIBRARY_NAME "libzmq-v${ZMQ_VS_VERSION}0-mt-${ZMQ_NAME}") - endif() -endif() - -find_library(ZMQ_LIBRARY - NAMES - zmq - ${ZMQ_LIBRARY_NAME} - PATHS - /lib - /usr/lib - /usr/local/lib - "${ZMQ_ROOT_DIR}/lib" -) - -if (ZMQ_INCLUDE_DIR AND ZMQ_LIBRARY AND NOT ZMQ_LIBRARY-NOTFOUND) - set(ZMQ_FOUND 1) - message(STATUS "Found ZMQ library: ${ZMQ_LIBRARY}") - message(STATUS "Found ZMQ headers: ${ZMQ_INCLUDE_DIR}") -else() - message(FATAL_ERROR "Could not find ZMQ libraries/headers! Please install ZMQ with libraries and headers") -endif() - -# show the ZMQ_INCLUDE_DIR and ZMQ_LIBRARY variables only in the advanced view -mark_as_advanced(ZMQ_ROOT_DIR ZMQ_INCLUDE_DIR ZMQ_LIBRARY ZMQ_FOUND) diff --git a/cmake/macros/GroupSources.cmake b/cmake/macros/GroupSources.cmake index 198d8c3e187..f8e252fe41a 100644 --- a/cmake/macros/GroupSources.cmake +++ b/cmake/macros/GroupSources.cmake @@ -10,7 +10,7 @@ macro(GroupSources dir) # Skip this if WITH_SOURCE_TREE is not set (empty string). - if (NOT ${_WITH_SOURCE_TREE} STREQUAL "") + if (NOT ${WITH_SOURCE_TREE} STREQUAL "") # Include all header and c files file(GLOB_RECURSE elements RELATIVE ${dir} *.h *.hpp *.c *.cpp *.cc) @@ -21,7 +21,7 @@ macro(GroupSources dir) if (NOT ${element_dir} STREQUAL "") # If the file is in a subdirectory use it as source group. - if (${_WITH_SOURCE_TREE} STREQUAL "flat") + if (${WITH_SOURCE_TREE} STREQUAL "flat") # Build flat structure by using only the first subdirectory. string(FIND ${element_dir} "/" delemiter_pos) if (NOT ${delemiter_pos} EQUAL -1) @@ -44,3 +44,8 @@ macro(GroupSources dir) endforeach() endif() endmacro() + +if (WITH_SOURCE_TREE STREQUAL "hierarchical-folders") + # Use folders + set_property(GLOBAL PROPERTY USE_FOLDERS ON) +endif() diff --git a/cmake/options.cmake b/cmake/options.cmake index 23c913363e1..1a028959047 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -13,8 +13,9 @@ option(SCRIPTS "Build core with scripts included" option(TOOLS "Build map/vmap/mmap extraction/assembler tools" 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) option(WITH_WARNINGS "Show all warnings during compile" 0) option(WITH_COREDEBUG "Include additional debug-code in core" 0) -set(WITH_SOURCE_TREE "no" CACHE STRING "Build the source tree for IDE's.") -set_property(CACHE WITH_SOURCE_TREE PROPERTY STRINGS no flat hierarchical) +set(WITH_SOURCE_TREE "hierarchical" CACHE STRING "Build the source tree for IDE's.") +set_property(CACHE WITH_SOURCE_TREE PROPERTY STRINGS no flat hierarchical hierarchical-folders) option(WITHOUT_GIT "Disable the GIT testing routines" 0) diff --git a/cmake/platform/unix/settings.cmake b/cmake/platform/unix/settings.cmake index 754ff450fcc..79b426d7e03 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) @@ -38,7 +29,7 @@ if(CMAKE_C_COMPILER MATCHES "gcc" OR CMAKE_C_COMPILER_ID STREQUAL "GNU") include(${CMAKE_SOURCE_DIR}/cmake/compiler/gcc/settings.cmake) elseif(CMAKE_C_COMPILER MATCHES "icc") include(${CMAKE_SOURCE_DIR}/cmake/compiler/icc/settings.cmake) -elseif(CMAKE_C_COMPILER MATCHES "clang" OR CMAKE_C_COMPILER_ID STREQUAL "Clang") +elseif(CMAKE_C_COMPILER MATCHES "clang" OR CMAKE_C_COMPILER_ID MATCHES "Clang") include(${CMAKE_SOURCE_DIR}/cmake/compiler/clang/settings.cmake) else() add_definitions(-D_BUILD_DIRECTIVE='"${CMAKE_BUILD_TYPE}"') 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/cmake/showoptions.cmake b/cmake/showoptions.cmake index 51b22c3a863..b485cfe5ce6 100644 --- a/cmake/showoptions.cmake +++ b/cmake/showoptions.cmake @@ -69,27 +69,10 @@ else() message("* Use coreside debug : No (default)") endif() -if( WITH_SOURCE_TREE STREQUAL "flat" OR WITH_SOURCE_TREE STREQUAL "hierarchical" ) - # TODO: Remove this after Debian 8 is released and set general required version to 2.8.12 - # Debian 7 is shipped with CMake 2.8.9 . But DIRECTORY flag of get_filename_component requires 2.8.12 . - if (NOT CMAKE_VERSION VERSION_LESS 2.8.12) - message("* Show source tree : Yes - ${WITH_SOURCE_TREE}") - set(_WITH_SOURCE_TREE ${WITH_SOURCE_TREE} CACHE INTERNAL "WITH_SOURCE_TREE support enabled.") - else() - message("* Show source tree : No (default)") - - message("") - message(" *** WITH_SOURCE_TREE - WARNING!") - message(" *** This functionality is ONLY supported on CMake 2.8.12 or higher.") - message(" *** You are running ${CMAKE_VERSION}, which does not have the functions needed") - message(" *** to create a sourcetree - this option is thus forced to disabled!") - message("") - - set(_WITH_SOURCE_TREE "" CACHE INTERNAL "WITH_SOURCE_TREE support disabled.") - endif() +if( NOT WITH_SOURCE_TREE STREQUAL "no" ) + message("* Show source tree : Yes - \"${WITH_SOURCE_TREE}\"") else() - message("* Show source tree : No (default)") - set(_WITH_SOURCE_TREE "" CACHE INTERNAL "WITH_SOURCE_TREE support disabled.") + message("* Show source tree : No") endif() if ( WITHOUT_GIT ) @@ -130,5 +113,15 @@ if ( HELGRIND ) add_definitions(-DHELGRIND) endif() -message("") +if (WITH_DYNAMIC_LINKING) + message("") + message(" *** WITH_DYNAMIC_LINKING - INFO!") + message(" *** Will link against shared libraries!") + message(" *** Please note that this is an experimental feature!") + add_definitions(-DTRINITY_API_USE_DYNAMIC_LINKING) + set(BUILD_SHARED_LIBS ON) +else() + set(BUILD_SHARED_LIBS OFF) +endif() +message("") |
