Skip to content

Commit

Permalink
Merge pull request #176 from namreeb/boost.cmake
Browse files Browse the repository at this point in the history
Added boost support to cmake
  • Loading branch information
namreeb committed Nov 20, 2015
2 parents 209d2b3 + 4a6a6be commit 9dffa8f
Show file tree
Hide file tree
Showing 31 changed files with 1,762 additions and 7,983 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Expand Up @@ -47,7 +47,8 @@ addons:
- g++-4.8
- make
- cmake

- libboost-dev

# overwrite GCC version for GCC build only
before_install:
- if [ $CC = "gcc" ] ; then export CC=gcc-4.8 CXX=g++-4.8 ; fi
Expand Down
18 changes: 9 additions & 9 deletions CMakeLists.txt
Expand Up @@ -20,8 +20,6 @@ project(CMaNGOS)

cmake_minimum_required(VERSION 2.8.12)

set(MANGOS_VERSION 0.18)

include(cmake/common.cmake)

# Set RPATH-handing (CMake parameters)
Expand Down Expand Up @@ -119,6 +117,14 @@ else()
include(cmake/macros/ImportACE.cmake)
endif()

find_package(Boost REQUIRED)

if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
else()
message(FATAL_ERROR "This project requires boost. Please install from http://www.boost.org")
endif()

if(NOT USE_STD_MALLOC)
unset(TBB_INCLUDE_DIR CACHE)
unset(TBB_LIBRARIES CACHE)
Expand Down Expand Up @@ -267,15 +273,11 @@ if(XCODE)
endif()
endif()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)

add_subdirectory(dep) # TODO: add vmap extractor build support

# Add definitions for all build types
# Don't place this above 'dep' subdirectory! Because of defines build will crash.
set(DEFINITIONS
HAVE_CONFIG_H
VERSION="${MANGOS_VERSION}"
SYSCONFDIR="${CONF_DIR}/"
)

Expand All @@ -296,9 +298,7 @@ if(USE_STD_MALLOC)
set(DEFINITIONS ${DEFINITIONS} USE_STANDARD_MALLOC)
endif()

set_directory_properties(PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}")
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS_RELEASE "${DEFINITIONS_RELEASE}")
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS_DEBUG "${DEFINITIONS_DEBUG}")
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS};$<$<CONFIG:Release>:${DEFINITIONS_RELEASE}>;$<$<CONFIG:Debug>:${DEFINITIONS_DEBUG}>")

add_subdirectory(src)
# if(SQL)
Expand Down
1,296 changes: 1,296 additions & 0 deletions cmake/macros/FindBoost.cmake

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion cmake/options.cmake
@@ -1,7 +1,11 @@
option(DEBUG "Include additional debug-code in core" OFF)
option(WARNINGS "Show all warnings during compile" OFF)
option(TBB_USE_EXTERNAL "Use external TBB" OFF)
option(USE_STD_MALLOC "Use standard malloc instead of TBB" OFF)
if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
option(USE_STD_MALLOC "Use standard malloc instead of TBB" ON)
else()
option(USE_STD_MALLOC "Use standard malloc instead of TBB" OFF)
endif()
option(ACE_USE_EXTERNAL "Use external ACE" OFF)
option(POSTGRESQL "Use PostgreSQL" OFF)

Expand Down
6 changes: 5 additions & 1 deletion cmake/platform/unix/settings.cmake
Expand Up @@ -15,8 +15,12 @@ message(STATUS "UNIX: Created uninstall target")
message(STATUS "UNIX: Detected compiler: ${CMAKE_C_COMPILER}")
if(CMAKE_C_COMPILER MATCHES "gcc" OR CMAKE_C_COMPILER_ID STREQUAL "GNU")
include("${ROOT_DIR}/cmake/compiler/gcc/settings.cmake")
elseif(CMAKE_C_COMPILER MATCHES "clang")
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
include("${ROOT_DIR}/cmake/compiler/clang/settings.cmake")
else()
add_definitions(-D_BUILD_DIRECTIVE='"${CMAKE_BUILD_TYPE}"')
endif()

if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND NOT USE_STD_MALLOC)
message(FATAL_ERROR "Using std malloc is required on FreeBSD")
endif()
14 changes: 14 additions & 0 deletions cmake/showoptions.cmake
Expand Up @@ -47,4 +47,18 @@ endif()
# message(STATUS "Build map/vmap tools : No (default)")
# endif()

if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
if(USE_STD_MALLOC)
message(STATUS "Use std malloc : Yes (default)")
else()
message(STATUS "Use std malloc : No")
endif()
else()
if(USE_STD_MALLOC)
message(STATUS "Use std malloc : Yes")
else()
message(STATUS "Use std malloc : No (default)")
endif()
endif()

message("")
10 changes: 0 additions & 10 deletions config.h.cmake

This file was deleted.

244 changes: 1 addition & 243 deletions dep/ACE_wrappers/configure
Expand Up @@ -35572,250 +35572,8 @@ $as_echo "#define ACE_HAS_NONCONST_GETBY 1" >>confdefs.h

if test "$ace_user_enable_exceptions" = yes; then

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if new throws std::bad_alloc exception on failure" >&5
$as_echo_n "checking if new throws std::bad_alloc exception on failure... " >&6; }
if test "${ace_cv_new_throws_bad_alloc_exception+set}" = set; then :
$as_echo_n "(cached) " >&6
else

if test "$cross_compiling" = yes; then :

ace_cv_new_throws_bad_alloc_exception=no

else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

#if defined (ACE_HAS_NEW_NO_H)
# include <new>
#elif defined (ACE_HAS_NEW_H)
# include <new.h>
#endif

#if defined (ACE_HAS_STDEXCEPT_NO_H)
# include <stdexcept>
#elif defined (ACE_HAS_EXCEPTION_H)
# include <exception.h>
#endif

/* We already checked for ACE_LACKS_NUMERIC_LIMITS */
#if !defined ACE_LACKS_NUMERIC_LIMITS
#include <limits>
#endif

/* We already checked for ACE_LACKS_SYS_RESOURCE_H */
#if !defined ACE_LACKS_SYS_RESOURCE_H
#include <sys/resource.h>
#endif

int main(int, char *[]) {
#if defined ACE_LACKS_NUMERIC_LIMITS
const size_t ALLOC_SIZE = 2 * 1024 * 1024 * 1024;
#else
const size_t ALLOC_SIZE = std::numeric_limits<size_t>::max () / 2;
#endif

#if !defined (ACE_LACKS_RLIMIT)
/* set memory limit to the allocation size, so this test
should terminate on the first iteration. */
struct rlimit rlimit;
if (getrlimit(RLIMIT_DATA, &rlimit) == 0) {
rlimit.rlim_cur = ALLOC_SIZE;
setrlimit(RLIMIT_DATA, &rlimit);
}
#endif

while (1) {
try {
char *a = new char[ALLOC_SIZE];
if (a == 0) {
return 1; /* new() does NOT throw exceptions */
}
}

#ifdef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB
catch (std::bad_alloc)
#else
catch (bad_alloc)
#endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
{
return 0; /* new() does throw exceptions */
}
};

return 1; /* ERROR: We shouldn't get this far! */
}

_ACEOF
if ac_fn_cxx_try_run "$LINENO"; then :

ace_cv_new_throws_bad_alloc_exception=yes

else

ace_cv_new_throws_bad_alloc_exception=no

fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ace_cv_new_throws_bad_alloc_exception" >&5
$as_echo "$ace_cv_new_throws_bad_alloc_exception" >&6; }
if test "$ace_cv_new_throws_bad_alloc_exception" != no; then
ace_just_a_place_holder=fixme
$as_echo "#define ACE_NEW_THROWS_EXCEPTIONS 1" >>confdefs.h

else
ace_just_a_place_holder=fixme

fi


if test "$ace_cv_new_throws_bad_alloc_exception" != yes; then

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if new throws xalloc exception on failure" >&5
$as_echo_n "checking if new throws xalloc exception on failure... " >&6; }
if test "${ace_cv_new_throws_xalloc_exception+set}" = set; then :
$as_echo_n "(cached) " >&6
else

if test "$cross_compiling" = yes; then :

ace_cv_new_throws_xalloc_exception=no

else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

#if defined (ACE_HAS_NEW_NO_H)
# include <new>
#elif defined (ACE_HAS_NEW_H)
# include <new.h>
#endif

#if defined (ACE_HAS_STDEXCEPT_NO_H)
# include <stdexcept>
#elif defined (ACE_HAS_EXCEPTION_H)
# include <exception.h>
#endif

/* We already checked for ACE_LACKS_NUMERIC_LIMITS */
#if !defined ACE_LACKS_NUMERIC_LIMITS
#include <limits>
#endif

/* We already checked for ACE_LACKS_SYS_RESOURCE_H */
#if !defined ACE_LACKS_SYS_RESOURCE_H
#include <sys/resource.h>
#endif


int main(int, char *[]) {
#if defined ACE_LACKS_NUMERIC_LIMITS
const size_t ALLOC_SIZE = 2 * 1024 * 1024 * 1024;
#else
const size_t ALLOC_SIZE = std::numeric_limits<size_t>::max () / 2;
#endif

#if !defined (ACE_LACKS_RLIMIT)
/* set memory limit to the allocation size, so this test
should terminate on the first iteration. */
struct rlimit rlimit;
if (getrlimit(RLIMIT_DATA, &rlimit) == 0) {
rlimit.rlim_cur = ALLOC_SIZE;
setrlimit(RLIMIT_DATA, &rlimit);
}
#endif

while (1) {
try {
char *a = new char[ALLOC_SIZE];
if (a == 0) {
return 1; /* new() does NOT throw exceptions */
}
}

catch (xalloc)
{
return 0; /* new() does throw exceptions */
}
};

return 1; /* ERROR: We shouldn't get this far! */
}

_ACEOF
if ac_fn_cxx_try_run "$LINENO"; then :

ace_cv_new_throws_xalloc_exception=yes

else

ace_cv_new_throws_xalloc_exception=no

fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ace_cv_new_throws_xalloc_exception" >&5
$as_echo "$ace_cv_new_throws_xalloc_exception" >&6; }
if test "$ace_cv_new_throws_xalloc_exception" != no; then
ace_just_a_place_holder=fixme
$as_echo "#define ACE_NEW_THROWS_EXCEPTIONS 1" >>confdefs.h

else
ace_just_a_place_holder=fixme

fi

fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports new(std::nothrow)" >&5
$as_echo_n "checking if compiler supports new(std::nothrow)... " >&6; }
if test "${ace_cv_has_new_nothrow+set}" = set; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

#if defined (ACE_HAS_NEW_NO_H)
# include <new>
#elif defined (ACE_HAS_NEW_H)
# include <new.h>
#endif

int main(int, char*[]) {
int *foo;

#ifdef ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB
foo = new (std::nothrow) int;
#else
foo = new (nothrow) int;
#endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :

ace_cv_has_new_nothrow=yes

else

ace_cv_has_new_nothrow=no

fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ace_cv_has_new_nothrow" >&5
$as_echo "$ace_cv_has_new_nothrow" >&6; }
if test $ace_cv_has_new_nothrow = yes; then
$as_echo "#define ACE_HAS_NEW_NOTHROW 1" >>confdefs.h
$as_echo "#define ACE_HAS_NEW_NOTHROW 1" >>confdefs.h

fi

Expand Down

0 comments on commit 9dffa8f

Please sign in to comment.