Fix Travis build on OS X.

This commit is contained in:
H0zen 2015-09-16 05:36:53 +03:00
parent a11f1e62a0
commit 22791e3f35
9 changed files with 86 additions and 18 deletions

7
.travis.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -eu
if [[ x$OSTYPE =~ ^xdarwin ]]; then
brew install "mysql"
fi

View File

@ -1,5 +1,8 @@
language: cpp
before_install:
- bash .travis.sh
# reduce clone time by only getting the latest commit and not the whole history (default for travis is 100)
git:
depth: 1
@ -14,10 +17,10 @@ branches:
- release20
- develop21
# build on both Linux and OSX
# build on both Linux and OSX (finally)
os:
- linux
# - osx
- osx
# build with both gcc and clang to ensure compatibility
compiler:

View File

@ -146,6 +146,6 @@ elseif(UNIX)
# -Wno-narrowing needed to suppress a warning in g3d
# -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 -Wno-ignored-attributes")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-narrowing -Wno-deprecated-register -Wno-ignored-attributes -Wno-deprecated-declarations")
endif()
endif()

View File

@ -27,6 +27,10 @@
#include <sys/types.h>
#if defined(__APPLE__)
# define ACE_UINT64_TYPE unsigned long long
#endif
#include <ace/Basic_Types.h>
#include <ace/Default_Constants.h>
#include <ace/OS_NS_dlfcn.h>

View File

@ -28,9 +28,18 @@
#include "Platform/CompilerDefs.h"
#include "Platform/Define.h"
#if defined(__APPLE__)
#include <AvailabilityMacros.h>
#endif
#if COMPILER == COMPILER_CLANG
# if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_9) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9
# include <unordered_map>
# include <unordered_set>
# else
# include <tr1/unordered_map>
# include <tr1/unordered_set>
# endif
#elif COMPILER == COMPILER_INTEL
# include <ext/hash_map>
# include <ext/hash_set>
@ -102,15 +111,29 @@ using std::hash_set;
# define HASH_NAMESPACE_START namespace std { namespace __1 {
# define HASH_NAMESPACE_END } }
#elif COMPILER == COMPILER_CLANG
# if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_9) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9
# define UNORDERED_MAP std::unordered_map
# define UNORDERED_SET std::unordered_set
# define HASH_NAMESPACE_START namespace std {
# define HASH_NAMESPACE_END }
# else
# define UNORDERED_MAP std::tr1::unordered_map
# define UNORDERED_SET std::tr1::unordered_set
# define HASH_NAMESPACE_START namespace std { namespace tr1 {
# define HASH_NAMESPACE_END } }
# endif
#elif COMPILER == COMPILER_GNU && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 3)
# if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_9) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9
# define UNORDERED_MAP std::unordered_map
# define UNORDERED_SET std::unordered_set
# define HASH_NAMESPACE_START namespace std {
# define HASH_NAMESPACE_END }
# else
# define UNORDERED_MAP std::tr1::unordered_map
# define UNORDERED_SET std::tr1::unordered_set
# define HASH_NAMESPACE_START namespace std { namespace tr1 {
# define HASH_NAMESPACE_END } }
# endif
#elif COMPILER == COMPILER_GNU && __GNUC__ >= 3 && (__GNUC__ < 4 || __GNUC__ == 4 && __GNUC_MINOR__ < 3)
# define UNORDERED_MAP __gnu_cxx::hash_map
# define UNORDERED_SET __gnu_cxx::hash_set

View File

@ -31,6 +31,10 @@
#ifndef MANGOS_H_WORLDSOCKET
#define MANGOS_H_WORLDSOCKET
#if defined(__APPLE__)
# define ACE_UINT64_TYPE unsigned long long
#endif
#include <ace/Basic_Types.h>
#include <ace/Synch_Traits.h>
#include <ace/Svc_Handler.h>

View File

@ -149,7 +149,16 @@ typedef off_t ACE_OFF_T;
#endif
#define UI64FMTD ACE_UINT64_FORMAT_SPECIFIER
#if defined(__APPLE__)
# if defined(I64FMT)
# undef(I64FMT)
# endif
# define I64FMT "%016llX"
# define UI64FMTD "%llu"
#else
# define UI64FMTD ACE_UINT64_FORMAT_SPECIFIER
#endif
#define UI64LIT(N) ACE_UINT64_LITERAL(N)
#define SI64FMTD ACE_INT64_FORMAT_SPECIFIER

View File

@ -67,11 +67,23 @@ else()
target_link_libraries(${EXECUTABLE_NAME} ACE)
endif()
target_link_libraries(${EXECUTABLE_NAME} g3dlite vmap detour recast zlib shared)
set(EXECUTABLE_LINK_FLAGS "")
if(UNIX)
target_link_libraries(${EXECUTABLE_NAME} rt)
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(EXECUTABLE_LINK_FLAGS "-Wl,-pthread -lrt ${EXECUTABLE_LINK_FLAGS}")
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(EXECUTABLE_LINK_FLAGS "-Wl,-ldl -pthread -lrt ${EXECUTABLE_LINK_FLAGS}")
endif()
endif()
target_link_libraries(${EXECUTABLE_NAME} g3dlite vmap detour recast zlib shared)
if(APPLE)
set(EXECUTABLE_LINK_FLAGS "-framework CoreServices ${EXECUTABLE_LINK_FLAGS}")
endif()
set_target_properties(${EXECUTABLE_NAME} PROPERTIES LINK_FLAGS "${EXECUTABLE_LINK_FLAGS}")
#Output the compiled exes to build/bin/$(Configuration)/tools directory on windows by default
if(WIN32)

View File

@ -56,11 +56,17 @@ target_link_libraries(${EXECUTABLE_NAME} vmap g3dlite zlib)
set(EXECUTABLE_LINK_FLAGS "")
if(UNIX)
if(CMAKE_C_COMPILER MATCHES "clang" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(EXECUTABLE_LINK_FLAGS "-pthread${EXECUTABLE_LINK_FLAGS}")
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(EXECUTABLE_LINK_FLAGS "-Wl,-pthread -lrt ${EXECUTABLE_LINK_FLAGS}")
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(EXECUTABLE_LINK_FLAGS "-Wl,-ldl -pthread -lrt ${EXECUTABLE_LINK_FLAGS}")
endif()
endif()
if(APPLE)
set(EXECUTABLE_LINK_FLAGS "-framework CoreServices ${EXECUTABLE_LINK_FLAGS}")
endif()
set_target_properties(${EXECUTABLE_NAME} PROPERTIES LINK_FLAGS "${EXECUTABLE_LINK_FLAGS}")
#Output the compiled exes to build/bin/$(Configuration)/tools directory on windows by default