mirror of
https://github.com/KjellKod/g3log.git
synced 2024-12-12 10:23:50 +01:00
play/tryout: It is confusing to name the target g3logger. KISS --> g3log (#372)
* It is confusing to name the target g3logger. KISS --> g3log. This MIGHT break installations for some but it's a needed correction. * Updated version number to 2.1.x
This commit is contained in:
parent
8e79dd6554
commit
69a0be4c9c
16
Build.cmake
16
Build.cmake
@ -26,7 +26,19 @@
|
|||||||
set(SRC_FILES ${SRC_FILES} ${SRC_PLATFORM_SPECIFIC})
|
set(SRC_FILES ${SRC_FILES} ${SRC_PLATFORM_SPECIFIC})
|
||||||
|
|
||||||
# Create the g3log library
|
# Create the g3log library
|
||||||
SET(G3LOG_LIBRARY g3logger)
|
SET(G3LOG_LIBRARY g3log)
|
||||||
|
|
||||||
|
|
||||||
|
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
|
message("CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
|
||||||
|
IF( NOT CMAKE_INSTALL_PREFIX)
|
||||||
|
SET(CMAKE_INSTALL_PREFIX /usr/local)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX})
|
||||||
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
|
message("Install rpath location: ${CMAKE_INSTALL_RPATH}")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
IF( G3_SHARED_LIB )
|
IF( G3_SHARED_LIB )
|
||||||
IF( WIN32 )
|
IF( WIN32 )
|
||||||
@ -62,7 +74,7 @@
|
|||||||
|
|
||||||
SET_TARGET_PROPERTIES(${G3LOG_LIBRARY} PROPERTIES
|
SET_TARGET_PROPERTIES(${G3LOG_LIBRARY} PROPERTIES
|
||||||
LINKER_LANGUAGE CXX
|
LINKER_LANGUAGE CXX
|
||||||
OUTPUT_NAME g3logger
|
OUTPUT_NAME g3log
|
||||||
CLEAN_DIRECT_OUTPUT 1
|
CLEAN_DIRECT_OUTPUT 1
|
||||||
SOVERSION ${VERSION}
|
SOVERSION ${VERSION}
|
||||||
)
|
)
|
||||||
|
249
CMakeLists.txt
249
CMakeLists.txt
@ -6,80 +6,70 @@
|
|||||||
# For more information see g3log/LICENSE or refer refer to http://unlicense.org
|
# For more information see g3log/LICENSE or refer refer to http://unlicense.org
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
|
# Below are details for compiling on Windows and Linux by default only an
|
||||||
# Below are details for compiling on Windows and Linux
|
# example g3log binary is created the performance and unit tests creation can be
|
||||||
# by default only an example g3log binary is created
|
# enabled by switching their OPTIONs from OFF to ON --- See below at around line
|
||||||
# the performance and unit tests creation can be enabled by switching their
|
# 110
|
||||||
# OPTIONs from OFF to ON --- See below at around line 110
|
|
||||||
|
|
||||||
# === WINDOWS ===
|
# === WINDOWS ===
|
||||||
# Example for: Visual Studio 2013 (earlier should work too)
|
# Example for: Visual Studio 2013 (earlier should work too) 1. please use the
|
||||||
# 1. please use the "Visual Studio Command Prompt 12 (2013)"
|
# "Visual Studio Command Prompt 12 (2013)" 2. from the g3log folder mkdir build
|
||||||
# 2. from the g3log folder
|
# cd build; 3. cmake -DCMAKE_BUILD_TYPE=Release -G "Visual Studio XXX" .. (cmake
|
||||||
# mkdir build
|
# -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 12") MAKE SURE you check the
|
||||||
# cd build;
|
# CMake documentation so you are using the correct bit flags(64 bit etc). The
|
||||||
# 3. cmake -DCMAKE_BUILD_TYPE=Release -G "Visual Studio XXX" ..
|
# "XXX" needs tto be replaced for your specific build system, ref: cmake docs.
|
||||||
# (cmake -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 12")
|
|
||||||
# MAKE SURE you check the CMake documentation so you are using
|
|
||||||
# the correct bit flags(64 bit etc). The "XXX" needs
|
|
||||||
# tto be replaced for your specific build system, ref: cmake docs.
|
|
||||||
#
|
|
||||||
# (Example from Appveyor Ci:
|
|
||||||
# https://github.com/KjellKod/g3log/blob/master/appveyor.yml
|
|
||||||
# cmake -G "Visual Studio 14 2015 Win64" -DADD_G3LOG_UNIT_TEST=ON ..)
|
|
||||||
#
|
#
|
||||||
# 4. msbuild g3log.sln /p:Configuration=Release
|
# (Example from Appveyor Ci:
|
||||||
|
# https://github.com/KjellKod/g3log/blob/master/appveyor.yml cmake -G "Visual
|
||||||
|
# Studio 14 2015 Win64" -DADD_G3LOG_UNIT_TEST=ON ..)
|
||||||
#
|
#
|
||||||
# Try to run an example, such as:
|
# 1. msbuild g3log.sln /p:Configuration=Release
|
||||||
# 5. Release\g3log-FATAL-contract.exe
|
|
||||||
#
|
#
|
||||||
|
# Try to run an example, such as: 5. Release\g3log-FATAL-contract.exe
|
||||||
#
|
#
|
||||||
|
|
||||||
# === LINUX: === To try this out from folder g3log:
|
# === LINUX: === To try this out from folder g3log: mkdir build cd build >>
|
||||||
# mkdir build
|
# create makefiles in g3log/build directory cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||||
# cd build
|
# make -jN (where N stands for number of cores you want to utilize)
|
||||||
# >> create makefiles in g3log/build directory
|
|
||||||
# cmake -DCMAKE_BUILD_TYPE=Release ..
|
|
||||||
# make -jN (where N stands for number of cores you want to utilize)
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
#
|
||||||
# === Clang on Linux ===
|
# === Clang on Linux ===
|
||||||
# From g3log
|
# From g3log mkdir build && cd build cmake -DCMAKE_CXX_COMPILER=clang++ .. if
|
||||||
# mkdir build && cd build
|
# you want to double-check settings: "VERBOSE=1 make" otherwise just run:
|
||||||
# cmake -DCMAKE_CXX_COMPILER=clang++ ..
|
# "make -j"
|
||||||
# if you want to double-check settings: "VERBOSE=1 make"
|
|
||||||
# otherwise just run: "make -j"
|
|
||||||
#
|
#
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
cmake_minimum_required (VERSION 3.2)
|
cmake_minimum_required(VERSION 3.2)
|
||||||
|
|
||||||
project (g3log CXX)
|
project(g3log CXX)
|
||||||
|
|
||||||
set (CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
if(NOT CMAKE_BUILD_TYPE AND NOT (MSVC_IDE OR XCODE))
|
if(NOT CMAKE_BUILD_TYPE AND NOT (MSVC_IDE OR XCODE))
|
||||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type, one of: Release, Debug" FORCE)
|
set(CMAKE_BUILD_TYPE
|
||||||
|
Release
|
||||||
|
CACHE STRING "Build type, one of: Release, Debug" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
||||||
message( STATUS "Build type: ${CMAKE_BUILD_TYPE}" )
|
message(STATUS "Configuration types: ${CMAKE_CONFIGURATION_TYPES}")
|
||||||
message( STATUS "Configuration types: ${CMAKE_CONFIGURATION_TYPES}" )
|
|
||||||
|
|
||||||
# Detect 64 or 32 bit
|
# Detect 64 or 32 bit
|
||||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
# 64-bit project
|
# 64-bit project
|
||||||
SET(64_BIT_OS TRUE)
|
set(64_BIT_OS TRUE)
|
||||||
message( STATUS "A 64-bit OS detected" )
|
message(STATUS "A 64-bit OS detected")
|
||||||
else()
|
else()
|
||||||
SET(64_BIT_OS FALSE)
|
set(64_BIT_OS FALSE)
|
||||||
message( STATUS "A 32-bit OS detected" )
|
message(STATUS "A 32-bit OS detected")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
SET(MAJOR_VERSION 1)
|
# Calculate the version number
|
||||||
|
SET(MAJOR_VERSION 2)
|
||||||
|
SET(MINOR_VERSION 1)
|
||||||
|
|
||||||
IF ( NOT VERSION )
|
IF ( NOT VERSION )
|
||||||
IF ( "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows" )
|
IF ( "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows" )
|
||||||
message("windows: Extracting git software version")
|
message("windows: Extracting git software version")
|
||||||
@ -93,118 +83,93 @@ IF ( NOT VERSION )
|
|||||||
execute_process(COMMAND bash "-c" "git rev-list --branches HEAD | wc -l | tr -d ' ' | tr -d '\n'" OUTPUT_VARIABLE GIT_VERSION WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
execute_process(COMMAND bash "-c" "git rev-list --branches HEAD | wc -l | tr -d ' ' | tr -d '\n'" OUTPUT_VARIABLE GIT_VERSION WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
SET(MINOR_VERSION 3)
|
|
||||||
math(EXPR VERSION-BASE ${GIT_VERSION}/255)
|
math(EXPR VERSION-BASE ${GIT_VERSION}/255)
|
||||||
math(EXPR VERSION-REMAINDER ${GIT_VERSION}%255)
|
math(EXPR VERSION-REMAINDER ${GIT_VERSION}%255)
|
||||||
message( STATUS "git build version: ${GIT_VERSION}" )
|
message( STATUS "git build version: ${GIT_VERSION}" )
|
||||||
message( STATUS "version base: ${VERSION-BASE}" )
|
message( STATUS "version base: ${VERSION-BASE}" )
|
||||||
message( STATUS "version remainder: ${VERSION-REMAINDER}" )
|
message( STATUS "version remainder: ${VERSION-REMAINDER}" )
|
||||||
# SET(BUILD_NUMBER ${GIT_VERSION})
|
# SET(BUILD_NUMBER ${GIT_VERSION})
|
||||||
SET(BUILD_NUMBER ${VERSION-BASE})
|
#SET(BUILD_NUMBER ${VERSION-BASE})
|
||||||
SET(VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${BUILD_NUMBER}-${VERSION-REMAINDER})
|
#SET(VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${BUILD_NUMBER}-${VERSION-REMAINDER})
|
||||||
|
SET(VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${GIT_VERSION})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
message( STATUS "Software Version: ${VERSION}" )
|
message( STATUS "Software Version: ${VERSION}" )
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# G3LOG OPTIONAL FEATURES
|
||||||
|
# ============================================================================
|
||||||
|
include(${g3log_SOURCE_DIR}/Options.cmake)
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# G3LOG iOS BUILD SUPPORT
|
||||||
|
# ============================================================================
|
||||||
|
include(${g3log_SOURCE_DIR}/iOSBuild.cmake)
|
||||||
|
|
||||||
# ============================================================================
|
if(G3_IOS_LIB)
|
||||||
# G3LOG OPTIONAL FEATURES
|
# G3_IOS_LIB is the pass used to generate all the other cmakefiles for the
|
||||||
# ============================================================================
|
# different architectures needed for the universal library. So we're done at
|
||||||
INCLUDE (${g3log_SOURCE_DIR}/Options.cmake)
|
# here.
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# =========================================================================
|
||||||
|
# G3 Macro definitions in Options.cmake are written to file this avoids having
|
||||||
|
# to re-state your definitions in your source code or compile options
|
||||||
|
# ==========================================================================
|
||||||
|
include(${g3log_SOURCE_DIR}/GenerateMacroDefinitionsFile.cmake)
|
||||||
|
|
||||||
|
# =========================================================================
|
||||||
|
# G3LOG BUILD
|
||||||
|
# ==========================================================================
|
||||||
|
include(${g3log_SOURCE_DIR}/Build.cmake)
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# G3LOG iOS BUILD SUPPORT
|
# EXAMPLE OPTIONS: By defauls is ON. This will create 'g3log-FATAL-* examples'
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
INCLUDE (${g3log_SOURCE_DIR}/iOSBuild.cmake)
|
# DISABLE WITH: -DADD_FATAL_EXAMPLE=OFF
|
||||||
|
include(${g3log_SOURCE_DIR}/example/Example.cmake)
|
||||||
|
|
||||||
if(G3_IOS_LIB)
|
# ============================================================================
|
||||||
# G3_IOS_LIB is the pass used to generate all the other cmakefiles for the
|
# PERFORMANCE TEST OPTIONS: Performance operations for g3log
|
||||||
# different architectures needed for the universal library. So we're done
|
# ============================================================================
|
||||||
# at here.
|
# ENABLE WITH: -DADD_G3LOG_PERFORMANCE=ON
|
||||||
return()
|
include(${g3log_SOURCE_DIR}/test_performance/Performance.cmake)
|
||||||
endif()
|
|
||||||
|
|
||||||
|
# ==========================================================================
|
||||||
|
# UNIT TEST OPTIONS:
|
||||||
|
# ============================================================================
|
||||||
|
# ENABLE WITH: -DADD_G3LOG_UNIT_TEST=ON
|
||||||
|
include(${g3log_SOURCE_DIR}/test_unit/Test.cmake)
|
||||||
|
|
||||||
|
# ==========================================================================
|
||||||
|
# CMAKE INSTALL AND CPACK OPTIONS:
|
||||||
|
# ==========================================================================
|
||||||
|
#
|
||||||
|
# Alternative 1: Package handling is done AFTER all other CMake setup usage:
|
||||||
|
# make package Check the output result and install accordingly.
|
||||||
|
#
|
||||||
|
# Alternative 2: usage: make; sudo make install
|
||||||
|
#
|
||||||
|
# For OSX you can also install an older version using 'brew install'
|
||||||
|
#
|
||||||
|
# ==========================================================================
|
||||||
|
include(${g3log_SOURCE_DIR}/CPackLists.txt)
|
||||||
|
|
||||||
# =========================================================================
|
if(MINGW)
|
||||||
# G3 Macro definitions in Options.cmake are written to file
|
# this enables strerror_s
|
||||||
# this avoids having to re-state your definitions in your source code
|
add_definitions(-DMINGW_HAS_SECURE_API)
|
||||||
# or compile options
|
endif()
|
||||||
#==========================================================================
|
|
||||||
INCLUDE (${g3log_SOURCE_DIR}/GenerateMacroDefinitionsFile.cmake)
|
|
||||||
|
|
||||||
|
if(NOT MSVC)
|
||||||
|
message(
|
||||||
# =========================================================================
|
STATUS
|
||||||
# G3LOG BUILD
|
"\n\n
|
||||||
#==========================================================================
|
|
||||||
INCLUDE (${g3log_SOURCE_DIR}/Build.cmake)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# EXAMPLE OPTIONS: By defauls is ON. This will create 'g3log-FATAL-* examples'
|
|
||||||
# ============================================================================
|
|
||||||
# DISABLE WITH: -DADD_FATAL_EXAMPLE=OFF
|
|
||||||
INCLUDE (${g3log_SOURCE_DIR}/example/Example.cmake)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# PERFORMANCE TEST OPTIONS: Performance operations for g3log
|
|
||||||
# ============================================================================
|
|
||||||
# ENABLE WITH: -DADD_G3LOG_PERFORMANCE=ON
|
|
||||||
INCLUDE (${g3log_SOURCE_DIR}/test_performance/Performance.cmake)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ==========================================================================
|
|
||||||
# UNIT TEST OPTIONS:
|
|
||||||
# ============================================================================
|
|
||||||
# ENABLE WITH: -DADD_G3LOG_UNIT_TEST=ON
|
|
||||||
INCLUDE (${g3log_SOURCE_DIR}/test_unit/Test.cmake)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ==========================================================================
|
|
||||||
# CMAKE INSTALL AND CPACK OPTIONS:
|
|
||||||
# ==========================================================================
|
|
||||||
#
|
|
||||||
# Alternative 1:
|
|
||||||
# Package handling is done AFTER all other CMake setup
|
|
||||||
# usage: make package
|
|
||||||
# Check the output result and install accordingly.
|
|
||||||
#
|
|
||||||
# Alternative 2:
|
|
||||||
# usage: make; sudo make install
|
|
||||||
#
|
|
||||||
# For OSX you can also install an older version using 'brew install'
|
|
||||||
#
|
|
||||||
# ==========================================================================
|
|
||||||
INCLUDE (${g3log_SOURCE_DIR}/CPackLists.txt)
|
|
||||||
|
|
||||||
|
|
||||||
IF(MINGW)
|
|
||||||
# this enables strerror_s
|
|
||||||
ADD_DEFINITIONS(-DMINGW_HAS_SECURE_API)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF (NOT MSVC)
|
|
||||||
message( STATUS "\n\n
|
|
||||||
*******************************************************************
|
*******************************************************************
|
||||||
Please do 'make clean-cmake' before next cmake generation.
|
Please do 'make clean-cmake' before next cmake generation.
|
||||||
It is a good idea to purge your build directory of CMake
|
It is a good idea to purge your build directory of CMake
|
||||||
generated cache files
|
generated cache files
|
||||||
*******************************************************************
|
*******************************************************************
|
||||||
" )
|
")
|
||||||
add_custom_target(clean-cmake
|
add_custom_target(clean-cmake COMMAND ${CMAKE_COMMAND} -P
|
||||||
COMMAND ${CMAKE_COMMAND} -P ${g3log_SOURCE_DIR}/CleanAll.cmake
|
${g3log_SOURCE_DIR}/CleanAll.cmake)
|
||||||
)
|
endif()
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,10 +10,12 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|||||||
IF(NOT CPACK_PACKAGING_INSTALL_PREFIX)
|
IF(NOT CPACK_PACKAGING_INSTALL_PREFIX)
|
||||||
IF(NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
IF(NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||||
SET(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
|
SET(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
|
||||||
|
# set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX})
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(CPACK_PACKAGING_INSTALL_PREFIX /usr/local)
|
SET(CPACK_PACKAGING_INSTALL_PREFIX /usr/local)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
# message("Install rpath location: ${CMAKE_INSTALL_RPATH}")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
INCLUDE(CMakePackageConfigHelpers)
|
INCLUDE(CMakePackageConfigHelpers)
|
||||||
@ -32,8 +34,8 @@ SET(CPACK_RESOURCE_FILE_LICENSE ${g3log_SOURCE_DIR}/LICENSE)
|
|||||||
SET(CPACK_PACKAGE_VENDOR "KjellKod")
|
SET(CPACK_PACKAGE_VENDOR "KjellKod")
|
||||||
|
|
||||||
IF(INSTALL_G3LOG)
|
IF(INSTALL_G3LOG)
|
||||||
INSTALL( TARGETS g3logger
|
INSTALL( TARGETS g3log
|
||||||
EXPORT g3logger-targets
|
EXPORT g3log-targets
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries
|
||||||
@ -45,27 +47,27 @@ IF(INSTALL_G3LOG)
|
|||||||
COMPONENT headers)
|
COMPONENT headers)
|
||||||
|
|
||||||
INSTALL(
|
INSTALL(
|
||||||
EXPORT g3logger-targets
|
EXPORT g3log-targets
|
||||||
FILE g3loggerTargets.cmake
|
FILE g3logTargets.cmake
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/g3logger
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/g3log
|
||||||
)
|
)
|
||||||
|
|
||||||
CONFIGURE_PACKAGE_CONFIG_FILE(
|
CONFIGURE_PACKAGE_CONFIG_FILE(
|
||||||
${PROJECT_SOURCE_DIR}/cmake/g3loggerConfig.cmake
|
${PROJECT_SOURCE_DIR}/cmake/g3logConfig.cmake
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/g3loggerConfig.cmake
|
${CMAKE_CURRENT_BINARY_DIR}/g3logConfig.cmake
|
||||||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/g3logger
|
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/g3log
|
||||||
)
|
)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/g3loggerConfig.cmake
|
FILES ${CMAKE_CURRENT_BINARY_DIR}/g3logConfig.cmake
|
||||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/g3logger
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/g3log
|
||||||
)
|
)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
|
||||||
SET(CPACK_COMPONENTS_ALL libraries headers)
|
SET(CPACK_COMPONENTS_ALL libraries headers)
|
||||||
SET(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "G3Log libraries")
|
SET(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "g3log libraries")
|
||||||
SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "G3Log C++ headers")
|
SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "g3log C++ headers")
|
||||||
|
|
||||||
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
SET(CPACK_GENERATOR "DEB")
|
SET(CPACK_GENERATOR "DEB")
|
||||||
@ -97,7 +99,6 @@ ENDIF()
|
|||||||
# CPACK_OUTPUT_FILE_PREFIX
|
# CPACK_OUTPUT_FILE_PREFIX
|
||||||
# CMAKE_INSTALL_PREFIX
|
# CMAKE_INSTALL_PREFIX
|
||||||
|
|
||||||
|
|
||||||
INCLUDE(CPack)
|
INCLUDE(CPack)
|
||||||
|
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ IF (MSVC OR MINGW)
|
|||||||
ENDIF (MSVC OR MINGW)
|
ENDIF (MSVC OR MINGW)
|
||||||
message( STATUS "\n\n\n" )
|
message( STATUS "\n\n\n" )
|
||||||
|
|
||||||
option(INSTALL_G3LOG "Enable installation of g3logger. (Projects embedding g3logger may want to turn this OFF.)" ON)
|
option(INSTALL_G3LOG "Enable installation of g3log. (Projects embedding g3log may want to turn this OFF.)" ON)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -453,16 +453,14 @@ cd build;
|
|||||||
|
|
||||||
## <a name="cmake-module">CMake module</a>
|
## <a name="cmake-module">CMake module</a>
|
||||||
|
|
||||||
g3log comes with a CMake module. Once installed, it can be found under `${CMAKE_INSTALL_PREFIX}/lib/cmake/g3logger`. Users can use g3log in a CMake-based project this way:
|
g3log comes with a CMake module. Once installed, it can be found under `${CMAKE_INSTALL_PREFIX}/lib/cmake/g3log`. Users can use g3log in a CMake-based project this way:
|
||||||
|
|
||||||
```
|
```
|
||||||
find_package(g3logger CONFIG REQUIRED)
|
find_package(g3log CONFIG REQUIRED)
|
||||||
target_link_libraries(main PRIVATE g3logger)
|
target_link_libraries(main PRIVATE g3log)
|
||||||
```
|
```
|
||||||
|
|
||||||
*Note:* The CMake package name here is `g3logger`, not `g3log`.
|
To make sure that CMake can find g3log, you also need to tell CMake where to search for it:
|
||||||
|
|
||||||
To make sure that CMake can find g3log(or g3logger), you also need to tell CMake where to search for it:
|
|
||||||
```
|
```
|
||||||
cmake .. -DCMAKE_PREFIX_PATH=<g3log's install prefix>
|
cmake .. -DCMAKE_PREFIX_PATH=<g3log's install prefix>
|
||||||
```
|
```
|
||||||
|
@ -32,5 +32,6 @@ after_build:
|
|||||||
- cmd /c Release\g3log-FATAL-contract.exe || exit /B 0
|
- cmd /c Release\g3log-FATAL-contract.exe || exit /B 0
|
||||||
- tree /A /F c:\g3log
|
- tree /A /F c:\g3log
|
||||||
- cpack -G "NSIS;ZIP"
|
- cpack -G "NSIS;ZIP"
|
||||||
|
- cpack -C Release
|
||||||
- ctest -C Release --verbose
|
- ctest -C Release --verbose
|
||||||
|
|
||||||
|
@ -2,18 +2,18 @@
|
|||||||
# FindG3log
|
# FindG3log
|
||||||
# -------
|
# -------
|
||||||
#
|
#
|
||||||
# Find libg3logger, G3log is an asynchronous, "crash safe", logger that is easy to use with default logging sinks or you can add your own.
|
# Find libg3log, G3log is an asynchronous, "crash safe", logger that is easy to use with default logging sinks or you can add your own.
|
||||||
#
|
#
|
||||||
# This defines the cmake import target "g3logger" you can use like this
|
# This defines the cmake import target "g3log" you can use like this
|
||||||
#```
|
#```
|
||||||
# target_link_libraries(YourTarget PUBLIC g3logger)
|
# target_link_libraries(YourTarget PUBLIC g3log)
|
||||||
#```
|
#```
|
||||||
# Variables and features
|
# Variables and features
|
||||||
# ----------------------
|
# ----------------------
|
||||||
# * ``G3LOG`` -- if this environment variable is set, it'll be used as a hint as to where the g3logger files are.
|
# * ``G3LOG`` -- if this environment variable is set, it'll be used as a hint as to where the g3log files are.
|
||||||
# * ``G3LOG_INCLUDE_DIRS`` -- raw cmake variable with include path
|
# * ``G3LOG_INCLUDE_DIRS`` -- raw cmake variable with include path
|
||||||
# * ``G3LOG_LIBRARIES`` -- raw cmake variable with library link line
|
# * ``G3LOG_LIBRARIES`` -- raw cmake variable with library link line
|
||||||
# * ``G3LOG_FOUND`` -- check if the lib was found without using the newer ``if(TARGET g3logger)...``
|
# * ``G3LOG_FOUND`` -- check if the lib was found without using the newer ``if(TARGET g3log)...``
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
include(SelectLibraryConfigurations)
|
include(SelectLibraryConfigurations)
|
||||||
@ -22,19 +22,19 @@ include(SelectLibraryConfigurations)
|
|||||||
|
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
if (NOT TARGET g3logger)
|
if (NOT TARGET g3log)
|
||||||
include("${CMAKE_CURRENT_LIST_DIR}/g3loggerTargets.cmake")
|
include("${CMAKE_CURRENT_LIST_DIR}/g3logTargets.cmake")
|
||||||
|
|
||||||
get_target_property(G3LOG_INCLUDE_DIR g3logger INTERFACE_INCLUDE_DIRECTORIES)
|
get_target_property(G3LOG_INCLUDE_DIR g3log INTERFACE_INCLUDE_DIRECTORIES)
|
||||||
|
get_target_property(G3LOG_LIBRARY_DEBUG g3log IMPORTED_IMPLIB_DEBUG)
|
||||||
get_target_property(G3LOG_LIBRARY_DEBUG g3logger IMPORTED_IMPLIB_DEBUG)
|
|
||||||
if (G3LOG_LIBRARY_DEBUG MATCHES ".*-NOTFOUND")
|
if (G3LOG_LIBRARY_DEBUG MATCHES ".*-NOTFOUND")
|
||||||
get_target_property(G3LOG_LIBRARY_DEBUG g3logger IMPORTED_LOCATION_DEBUG)
|
get_target_property(G3LOG_LIBRARY_DEBUG g3log IMPORTED_LOCATION_DEBUG)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
get_target_property(G3LOG_LIBRARY_RELEASE g3logger IMPORTED_IMPLIB_RELEASE)
|
get_target_property(G3LOG_LIBRARY_RELEASE g3log IMPORTED_IMPLIB_RELEASE)
|
||||||
if (G3LOG_LIBRARY_RELEASE MATCHES ".*-NOTFOUND")
|
if (G3LOG_LIBRARY_RELEASE MATCHES ".*-NOTFOUND")
|
||||||
get_target_property(G3LOG_LIBRARY_RELEASE g3logger IMPORTED_LOCATION_RELEASE)
|
get_target_property(G3LOG_LIBRARY_RELEASE g3log IMPORTED_LOCATION_RELEASE)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
select_library_configurations(G3LOG)
|
select_library_configurations(G3LOG)
|
||||||
@ -47,8 +47,7 @@ if (NOT TARGET g3logger)
|
|||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
find_package_handle_standard_args(G3LOG
|
find_package_handle_standard_args(G3LOG REQUIRED_VARS G3LOG_INCLUDE_DIR G3LOG_LIBRARY)
|
||||||
REQUIRED_VARS G3LOG_INCLUDE_DIR G3LOG_LIBRARY)
|
|
||||||
mark_as_advanced(G3LOG_INCLUDE_DIR G3LOG_LIBRARY)
|
mark_as_advanced(G3LOG_INCLUDE_DIR G3LOG_LIBRARY)
|
||||||
set(G3LOG_INCLUDE_DIRS ${G3LOG_INCLUDE_DIR})
|
set(G3LOG_INCLUDE_DIRS ${G3LOG_INCLUDE_DIR})
|
||||||
set(G3LOG_LIBRARIES ${G3LOG_LIBRARY})
|
set(G3LOG_LIBRARIES ${G3LOG_LIBRARY})
|
@ -99,7 +99,7 @@ if(G3_IOS_LIB)
|
|||||||
VERBATIM
|
VERBATIM
|
||||||
)
|
)
|
||||||
|
|
||||||
set(LIB_G3 libg3logger.a)
|
set(LIB_G3 libg3log.a)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${LIB_G3}
|
OUTPUT ${LIB_G3}
|
||||||
COMMAND lipo -create
|
COMMAND lipo -create
|
||||||
@ -116,6 +116,6 @@ if(G3_IOS_LIB)
|
|||||||
"${ARM_BINARY_DIR}/Binaries/${CMAKE_BUILD_TYPE}/${LIB_G3}"
|
"${ARM_BINARY_DIR}/Binaries/${CMAKE_BUILD_TYPE}/${LIB_G3}"
|
||||||
VERBATIM
|
VERBATIM
|
||||||
)
|
)
|
||||||
add_custom_target(g3logger ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${LIB_G3})
|
add_custom_target(g3log ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${LIB_G3})
|
||||||
endif(G3_IOS_LIB)
|
endif(G3_IOS_LIB)
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ namespace g3 {
|
|||||||
// Only through the Sinkhandle can, and should, the real sink's specific API
|
// Only through the Sinkhandle can, and should, the real sink's specific API
|
||||||
// be called.
|
// be called.
|
||||||
//
|
//
|
||||||
// The real sink will be owned by the g3logger. If the real sink is deleted
|
// The real sink will be owned by g3log. If the real sink is deleted
|
||||||
// calls to sink's API through the SinkHandle will return an exception embedded
|
// calls to sink's API through the SinkHandle will return an exception embedded
|
||||||
// in the resulting future. Ref: SinkHandle::call
|
// in the resulting future. Ref: SinkHandle::call
|
||||||
template<class T>
|
template<class T>
|
||||||
|
@ -83,7 +83,7 @@
|
|||||||
IF( NOT(MSVC))
|
IF( NOT(MSVC))
|
||||||
set_target_properties(${test} PROPERTIES COMPILE_FLAGS "-isystem -pthread ")
|
set_target_properties(${test} PROPERTIES COMPILE_FLAGS "-isystem -pthread ")
|
||||||
ENDIF( NOT(MSVC))
|
ENDIF( NOT(MSVC))
|
||||||
target_link_libraries(${test} g3logger gtest_main)
|
target_link_libraries(${test} g3log gtest_main)
|
||||||
add_test( ${test} ${test} )
|
add_test( ${test} ${test} )
|
||||||
ENDFOREACH(test)
|
ENDFOREACH(test)
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ TEST(Initialization, No_Logger_Initialized___Expecting_LOG_calls_to_be_Still_OKi
|
|||||||
EXPECT_TRUE(g3::logLevel(FATAL));
|
EXPECT_TRUE(g3::logLevel(FATAL));
|
||||||
EXPECT_TRUE(g3::logLevel(G3LOG_DEBUG));
|
EXPECT_TRUE(g3::logLevel(G3LOG_DEBUG));
|
||||||
EXPECT_TRUE(g3::logLevel(WARNING));
|
EXPECT_TRUE(g3::logLevel(WARNING));
|
||||||
std::string err_msg1 = "Hey. I am not instantiated but I still should not crash. (I am g3logger)";
|
std::string err_msg1 = "Hey. I am not instantiated but I still should not crash. (I am g3log)";
|
||||||
std::string err_msg3_ignored = "This uninitialized message should be ignored";
|
std::string err_msg3_ignored = "This uninitialized message should be ignored";
|
||||||
try {
|
try {
|
||||||
LOG(INFO) << err_msg1; // nothing happened. level not ON
|
LOG(INFO) << err_msg1; // nothing happened. level not ON
|
||||||
@ -93,7 +93,7 @@ TEST(Initialization, No_Logger_Initialized___Expecting_LOG_calls_to_be_Still_OKi
|
|||||||
EXPECT_TRUE(g3::logLevel(FATAL));
|
EXPECT_TRUE(g3::logLevel(FATAL));
|
||||||
EXPECT_TRUE(g3::logLevel(G3LOG_DEBUG));
|
EXPECT_TRUE(g3::logLevel(G3LOG_DEBUG));
|
||||||
EXPECT_TRUE(g3::logLevel(WARNING));
|
EXPECT_TRUE(g3::logLevel(WARNING));
|
||||||
std::string err_msg1 = "Hey. I am not instantiated but I still should not crash. (I am g3logger)";
|
std::string err_msg1 = "Hey. I am not instantiated but I still should not crash. (I am g3log)";
|
||||||
std::string err_msg3_ignored = "This uninitialized message should be ignored";
|
std::string err_msg3_ignored = "This uninitialized message should be ignored";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user