Skip to content

Commit

Permalink
play/tryout: It is confusing to name the target g3logger. KISS --> g3…
Browse files Browse the repository at this point in the history
…log (KjellKod#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
  • Loading branch information
Kjell Hedström : Available for new Engineering Leadership and Engineering Opportunities authored Jul 9, 2020
1 parent 8e79dd6 commit 69a0be4
Show file tree
Hide file tree
Showing 11 changed files with 161 additions and 185 deletions.
16 changes: 14 additions & 2 deletions Build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,19 @@
set(SRC_FILES ${SRC_FILES} ${SRC_PLATFORM_SPECIFIC})

# 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( WIN32 )
Expand Down Expand Up @@ -62,7 +74,7 @@

SET_TARGET_PROPERTIES(${G3LOG_LIBRARY} PROPERTIES
LINKER_LANGUAGE CXX
OUTPUT_NAME g3logger
OUTPUT_NAME g3log
CLEAN_DIRECT_OUTPUT 1
SOVERSION ${VERSION}
)
Expand Down
249 changes: 107 additions & 142 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,80 +6,70 @@
# 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 example g3log binary is created
# the performance and unit tests creation can be enabled by switching their
# OPTIONs from OFF to ON --- See below at around line 110
# Below are details for compiling on Windows and Linux by default only an
# example g3log binary is created the performance and unit tests creation can be
# enabled by switching their OPTIONs from OFF to ON --- See below at around line
# 110

# === WINDOWS ===
# Example for: Visual Studio 2013 (earlier should work too)
# 1. please use the "Visual Studio Command Prompt 12 (2013)"
# 2. from the g3log folder
# mkdir build
# cd build;
# 3. cmake -DCMAKE_BUILD_TYPE=Release -G "Visual Studio XXX" ..
# (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 ..)
# Example for: Visual Studio 2013 (earlier should work too) 1. please use the
# "Visual Studio Command Prompt 12 (2013)" 2. from the g3log folder mkdir build
# cd build; 3. cmake -DCMAKE_BUILD_TYPE=Release -G "Visual Studio XXX" .. (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.
#
# 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:
# 5. Release\g3log-FATAL-contract.exe
# 1. msbuild g3log.sln /p:Configuration=Release
#
# Try to run an example, such as: 5. Release\g3log-FATAL-contract.exe
#

# === LINUX: === To try this out from folder g3log:
# mkdir build
# cd build
# >> create makefiles in g3log/build directory
# cmake -DCMAKE_BUILD_TYPE=Release ..
# make -jN (where N stands for number of cores you want to utilize)
#
#
# === LINUX: === To try this out from folder g3log: mkdir build cd build >>
# 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 ===
# From g3log
# mkdir build && cd build
# cmake -DCMAKE_CXX_COMPILER=clang++ ..
# if you want to double-check settings: "VERBOSE=1 make"
# otherwise just run: "make -j"
# From g3log mkdir build && cd build cmake -DCMAKE_CXX_COMPILER=clang++ .. 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_REQUIRED ON)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

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()


message( STATUS "Build type: ${CMAKE_BUILD_TYPE}" )
message( STATUS "Configuration types: ${CMAKE_CONFIGURATION_TYPES}" )
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "Configuration types: ${CMAKE_CONFIGURATION_TYPES}")

# Detect 64 or 32 bit
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
# 64-bit project
SET(64_BIT_OS TRUE)
message( STATUS "A 64-bit OS detected" )
else()
SET(64_BIT_OS FALSE)
message( STATUS "A 32-bit OS detected" )
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
# 64-bit project
set(64_BIT_OS TRUE)
message(STATUS "A 64-bit OS detected")
else()
set(64_BIT_OS FALSE)
message(STATUS "A 32-bit OS detected")
endif()


SET(MAJOR_VERSION 1)
# Calculate the version number
SET(MAJOR_VERSION 2)
SET(MINOR_VERSION 1)

IF ( NOT VERSION )
IF ( "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows" )
message("windows: Extracting git software version")
Expand All @@ -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})
ENDIF()

SET(MINOR_VERSION 3)
math(EXPR VERSION-BASE ${GIT_VERSION}/255)
math(EXPR VERSION-REMAINDER ${GIT_VERSION}%255)
message( STATUS "git build version: ${GIT_VERSION}" )
message( STATUS "version base: ${VERSION-BASE}" )
message( STATUS "version remainder: ${VERSION-REMAINDER}" )
# SET(BUILD_NUMBER ${GIT_VERSION})
SET(BUILD_NUMBER ${VERSION-BASE})
SET(VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${BUILD_NUMBER}-${VERSION-REMAINDER})
#SET(BUILD_NUMBER ${VERSION-BASE})
#SET(VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${BUILD_NUMBER}-${VERSION-REMAINDER})
SET(VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${GIT_VERSION})
ENDIF()
message( STATUS "Software Version: ${VERSION}" )

# ============================================================================
# G3LOG OPTIONAL FEATURES
# ============================================================================
include(${g3log_SOURCE_DIR}/Options.cmake)

# ============================================================================
# G3LOG iOS BUILD SUPPORT
# ============================================================================
include(${g3log_SOURCE_DIR}/iOSBuild.cmake)

# ============================================================================
# G3LOG OPTIONAL FEATURES
# ============================================================================
INCLUDE (${g3log_SOURCE_DIR}/Options.cmake)



# ============================================================================
# G3LOG iOS BUILD SUPPORT
# ============================================================================
INCLUDE (${g3log_SOURCE_DIR}/iOSBuild.cmake)

if(G3_IOS_LIB)
# 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 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)



# ============================================================================
# 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)

if(G3_IOS_LIB)
# 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
# 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)

# ==========================================================================
# UNIT TEST OPTIONS:
# ============================================================================
# ENABLE WITH: -DADD_G3LOG_UNIT_TEST=ON
INCLUDE (${g3log_SOURCE_DIR}/test_unit/Test.cmake)
# =========================================================================
# G3LOG BUILD
# ==========================================================================
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)

# ==========================================================================
# 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)
# ==========================================================================
# 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(MINGW)
# this enables strerror_s
add_definitions(-DMINGW_HAS_SECURE_API)
endif()

IF (NOT MSVC)
message( STATUS "\n\n
if(NOT MSVC)
message(
STATUS
"\n\n
*******************************************************************
Please do 'make clean-cmake' before next cmake generation.
It is a good idea to purge your build directory of CMake
generated cache files
*******************************************************************
" )
add_custom_target(clean-cmake
COMMAND ${CMAKE_COMMAND} -P ${g3log_SOURCE_DIR}/CleanAll.cmake
)
ENDIF()





")
add_custom_target(clean-cmake COMMAND ${CMAKE_COMMAND} -P
${g3log_SOURCE_DIR}/CleanAll.cmake)
endif()
Loading

0 comments on commit 69a0be4

Please sign in to comment.