2014-10-03 08:56:13 +02:00
|
|
|
SET(LOG_SRC ${g3log_SOURCE_DIR}/src)
|
|
|
|
include_directories(${LOG_SRC})
|
|
|
|
SET(ACTIVE_CPP0xx_DIR "Release")
|
|
|
|
|
|
|
|
#cmake -DCMAKE_CXX_COMPILER=clang++ ..
|
|
|
|
# WARNING: If Clang for Linux does not work with full C++11 support it might be your
|
|
|
|
# installation that is faulty. When I tested Clang on Ubuntu I followed the following
|
|
|
|
# description
|
|
|
|
# 1) http://kjellkod.wordpress.com/2013/09/23/experimental-g2log-with-clang/
|
|
|
|
# 2) https://github.com/maidsafe/MaidSafe/wiki/Hacking-with-Clang-llvm-abi-and-llvm-libc
|
|
|
|
IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES ".*Clang")
|
|
|
|
MESSAGE("")
|
|
|
|
MESSAGE("cmake for Clang ")
|
|
|
|
IF (APPLE)
|
|
|
|
set(PLATFORM_LINK_LIBRIES c++abi)
|
|
|
|
ELSE()
|
|
|
|
set(PLATFORM_LINK_LIBRIES rt c++abi)
|
|
|
|
ENDIF()
|
|
|
|
SET(CMAKE_CXX_FLAGS "-Wall -std=c++11 -pthread -stdlib=libc++ -Wunused -D_GLIBCXX_USE_NANOSLEEP")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
|
|
MESSAGE("cmake for GCC ")
|
|
|
|
IF (APPLE)
|
|
|
|
set(CMAKE_CXX_FLAGS "-Wall -Wunused -std=c++11 -pthread -D_GLIBCXX_USE_NANOSLEEP")
|
2015-03-29 14:29:07 +02:00
|
|
|
ELSEIF (MINGW)
|
|
|
|
set(CMAKE_CXX_FLAGS "-Wall -Wunused -std=c++11 -pthread -D_GLIBCXX_USE_NANOSLEEP -D_GLIBCXX_USE_SCHED_YIELD")
|
2014-10-03 08:56:13 +02:00
|
|
|
ELSE()
|
|
|
|
set(PLATFORM_LINK_LIBRIES rt)
|
|
|
|
set(CMAKE_CXX_FLAGS "-Wall -rdynamic -Wunused -std=c++11 -pthread -D_GLIBCXX_USE_NANOSLEEP -D_GLIBCXX_USE_SCHED_YIELD")
|
|
|
|
ENDIF()
|
2015-03-29 14:29:07 +02:00
|
|
|
ENDIF()
|
2014-10-03 08:56:13 +02:00
|
|
|
|
|
|
|
|
2015-03-29 14:29:07 +02:00
|
|
|
IF (MSVC OR MINGW)
|
2015-02-02 08:31:43 +01:00
|
|
|
set(PLATFORM_LINK_LIBRIES dbghelp)
|
2014-10-03 08:56:13 +02:00
|
|
|
# VC11 bug: http://code.google.com/p/googletest/issues/detail?id=408
|
|
|
|
# add_definition(-D_VARIADIC_MAX=10)
|
|
|
|
# https://github.com/anhstudios/swganh/pull/186/files
|
|
|
|
ADD_DEFINITIONS (/D_VARIADIC_MAX=10)
|
|
|
|
MESSAGE(STATUS "- MSVC: Set variadic max to 10 for MSVC compatibility")
|
|
|
|
# Remember to set set target properties if using GTEST similar to done below on target "unit_test"
|
|
|
|
# "set_target_properties(unit_test PROPERTIES COMPILE_DEFINITIONS "GTEST_USE_OWN_TR1_TUPLE=0")
|
|
|
|
MESSAGE("")
|
2014-12-11 08:10:47 +01:00
|
|
|
MESSAGE("Windows: Run cmake with the appropriate Visual Studio generator")
|
|
|
|
MESSAGE("The generator is one number below the official version number. I.e. VS2013 -> Generator 'Visual Studio 12'")
|
|
|
|
MESSAGE("I.e. if VS2013: Please run the command [cmake -DCMAKE_BUILD_TYPE=Release -G \"Visual Studio 12\" ..]")
|
2014-10-03 08:56:13 +02:00
|
|
|
MESSAGE("if cmake finishes OK, do 'msbuild g3log.sln /p:Configuration=Release'")
|
2014-10-03 09:53:21 +02:00
|
|
|
MESSAGE("then run 'Release\\g3log-FATAL-*' examples")
|
2014-10-03 08:56:13 +02:00
|
|
|
MESSAGE("")
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# GENERIC STEPS
|
|
|
|
file(GLOB SRC_FILES ${LOG_SRC}/*.h ${LOG_SRC}/*.hpp ${LOG_SRC}/*.cpp ${LOG_SRC}/*.ipp)
|
|
|
|
file(GLOB HEADER_FILES ${LOG_SRC}/*.h ${LOG_SRC}/*.hpp)
|
2014-10-03 09:53:21 +02:00
|
|
|
#MESSAGE(" HEADER FILES ARE: ${HEADER_FILES}")
|
2014-10-03 08:56:13 +02:00
|
|
|
|
|
|
|
IF (MSVC OR MINGW)
|
|
|
|
list(REMOVE_ITEM SRC_FILES ${LOG_SRC}/crashhandler_unix.cpp)
|
|
|
|
ELSE()
|
2015-02-02 08:31:43 +01:00
|
|
|
list(REMOVE_ITEM SRC_FILES ${LOG_SRC}/crashhandler_windows.cpp ${LOG_SRC}/stacktrace_windows.hpp ${LOG_SRC}/stacktrace_windows.cpp)
|
2014-10-03 08:56:13 +02:00
|
|
|
ENDIF (MSVC OR MINGW)
|
|
|
|
|
|
|
|
set(SRC_FILES ${SRC_FILES} ${SRC_PLATFORM_SPECIFIC})
|
|
|
|
|
2014-10-03 09:53:21 +02:00
|
|
|
# Create the g3log library
|
2014-10-03 08:56:13 +02:00
|
|
|
include_directories(${LOG_SRC})
|
2014-10-03 09:53:21 +02:00
|
|
|
#MESSAGE(" g3logger files: [${SRC_FILES}]")
|
2014-10-03 08:56:13 +02:00
|
|
|
add_library(g3logger ${SRC_FILES})
|
|
|
|
set_target_properties(g3logger PROPERTIES LINKER_LANGUAGE CXX)
|
2015-02-02 08:31:43 +01:00
|
|
|
target_link_libraries(g3logger ${PLATFORM_LINK_LIBRIES})
|
|
|
|
|
2014-10-03 08:56:13 +02:00
|
|
|
add_library(g3logger_shared SHARED ${SRC_FILES})
|
|
|
|
set_target_properties(g3logger_shared PROPERTIES LINKER_LANGUAGE CXX)
|
2015-02-02 08:31:43 +01:00
|
|
|
target_link_libraries(g3logger_shared ${PLATFORM_LINK_LIBRIES})
|
2014-10-03 08:56:13 +02:00
|
|
|
|
|
|
|
SET(G3LOG_SHARED_LIBRARY g3logger_shared)
|
|
|
|
SET(G3LOG_LIBRARY g3logger)
|
|
|
|
|
|
|
|
|
|
|
|
|