mirror of
https://github.com/KjellKod/g3log.git
synced 2024-12-13 10:42:56 +01:00
Improve CMake module file (#312)
* Improve CMake module file * Fix packaging on Win32 * appveyor: Test install and package target * Travis-CI: Test install and package target * Update documentation for working with CMake * Simplify g3loggerConfig.cmake * Add Doc Prerequisites section
This commit is contained in:
parent
9aecd55051
commit
376c417ad1
@ -77,8 +77,12 @@
|
||||
# require here some proxy for c++14 standard to avoid problems TARGET_PROPERTY CXX_STANDARD
|
||||
TARGET_COMPILE_FEATURES(${G3LOG_LIBRARY} PUBLIC cxx_variable_templates)
|
||||
|
||||
|
||||
TARGET_INCLUDE_DIRECTORIES(${G3LOG_LIBRARY} PUBLIC ${LOG_SRC} "${CMAKE_CURRENT_BINARY_DIR}/include")
|
||||
TARGET_INCLUDE_DIRECTORIES(${G3LOG_LIBRARY}
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${LOG_SRC}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
|
||||
)
|
||||
|
||||
SET(ACTIVE_CPP0xx_DIR "Release")
|
||||
|
||||
# find corresponding thread lib (e.g. whether -lpthread is needed or not)
|
||||
|
@ -166,12 +166,8 @@ message( STATUS "Software Version: ${VERSION}" )
|
||||
|
||||
|
||||
|
||||
|
||||
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
# ==========================================================================
|
||||
# Only tested on Ubuntu, CentOS and OSX.
|
||||
# For OSX you can also install an older version using 'brew install'
|
||||
#
|
||||
# CMAKE INSTALL AND CPACK OPTIONS:
|
||||
# ==========================================================================
|
||||
#
|
||||
# Alternative 1:
|
||||
@ -182,18 +178,13 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin"
|
||||
# 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)
|
||||
ENDIF()
|
||||
|
||||
|
||||
IF(MINGW)
|
||||
# ==========================================================================
|
||||
#
|
||||
# usage: make; make install
|
||||
#
|
||||
# ==========================================================================
|
||||
INCLUDE (${g3log_SOURCE_DIR}/CPackLists.txt)
|
||||
|
||||
# this enables strerror_s
|
||||
ADD_DEFINITIONS(-DMINGW_HAS_SECURE_API)
|
||||
ENDIF()
|
||||
|
@ -6,25 +6,18 @@
|
||||
# For more information see g3log/LICENSE or refer refer to http://unlicense.org
|
||||
# ============================================================================*/
|
||||
|
||||
# INSTALL( TARGETS g3logger_shared
|
||||
# ARCHIVE
|
||||
# LIBRARY DESTINATION lib/g3log
|
||||
# COMPONENT libraries)
|
||||
|
||||
# INSTALL( FILES ${HEADER_FILES}
|
||||
# DESTINATION include
|
||||
# COMPONENT headers)
|
||||
|
||||
IF(NOT MINGW)
|
||||
IF(NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
SET(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
|
||||
ELSEIF(NOT CPACK_PACKAGING_INSTALL_PREFIX)
|
||||
SET(CPACK_PACKAGING_INSTALL_PREFIX /usr/local)
|
||||
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
IF(NOT CPACK_PACKAGING_INSTALL_PREFIX)
|
||||
IF(NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
SET(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
|
||||
ELSE()
|
||||
SET(CPACK_PACKAGING_INSTALL_PREFIX /usr/local)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
SET(CMAKE_INSTALL_LIBDIR lib CACHE PATH "Output dir for libraries")
|
||||
SET(CMAKE_INSTALL_HEADERDIR include CACHE PATH "Output dir for headers")
|
||||
INCLUDE(CMakePackageConfigHelpers)
|
||||
INCLUDE(GNUInstallDirs)
|
||||
|
||||
SET(CPACK_PACKAGE_NAME g3log)
|
||||
SET(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION})
|
||||
@ -37,33 +30,35 @@ SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${CPACK_PACKAGE_DESCRIPTION})
|
||||
SET(CPACK_PACKAGE_CONTACT "Kjell Hedstrom hedstrom@kjellkoc.cc")
|
||||
SET(CPACK_RESOURCE_FILE_LICENSE ${g3log_SOURCE_DIR}/LICENSE)
|
||||
SET(CPACK_PACKAGE_VENDOR "KjellKod")
|
||||
SET(CMAKE_INSTALL_HEADERDIR ${CMAKE_INSTALL_HEADERDIR}/g3log)
|
||||
|
||||
IF(NOT MINGW)
|
||||
INSTALL( TARGETS g3logger
|
||||
ARCHIVE DESTINATION ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
|
||||
COMPONENT libraries)
|
||||
INSTALL( TARGETS g3logger
|
||||
EXPORT g3logger-targets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
COMPONENT libraries)
|
||||
|
||||
INSTALL( FILES ${HEADER_FILES}
|
||||
DESTINATION ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_HEADERDIR}
|
||||
COMPONENT headers)
|
||||
INSTALL( FILES ${HEADER_FILES}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/g3log
|
||||
COMPONENT headers)
|
||||
|
||||
INSTALL( FILES ${PROJECT_SOURCE_DIR}/cmake/g3loggerConfig.cmake
|
||||
DESTINATION ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/cmake/g3logger)
|
||||
ELSE()
|
||||
INSTALL( TARGETS g3logger
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
COMPONENT libraries)
|
||||
INSTALL(
|
||||
EXPORT g3logger-targets
|
||||
FILE g3loggerTargets.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/g3logger
|
||||
)
|
||||
|
||||
INSTALL( FILES ${HEADER_FILES}
|
||||
DESTINATION ${CMAKE_INSTALL_HEADERDIR}
|
||||
COMPONENT headers)
|
||||
CONFIGURE_PACKAGE_CONFIG_FILE(
|
||||
${PROJECT_SOURCE_DIR}/cmake/g3loggerConfig.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/g3loggerConfig.cmake
|
||||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/g3logger
|
||||
)
|
||||
|
||||
INSTALL( FILES ${PROJECT_SOURCE_DIR}/cmake/g3loggerConfig.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/g3logger)
|
||||
ENDIF()
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/g3loggerConfig.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/g3logger
|
||||
)
|
||||
|
||||
SET(CPACK_COMPONENTS_ALL libraries headers)
|
||||
SET(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "G3Log libraries")
|
||||
@ -72,6 +67,8 @@ SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "G3Log C++ headers")
|
||||
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
SET(CPACK_GENERATOR "DEB")
|
||||
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "KjellKod - Kjell Hedstrom")
|
||||
ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
SET(CPACK_GENERATOR "ZIP") # Otherwise, NSIS is needed.
|
||||
ENDIF()
|
||||
|
||||
message( STATUS "\nTo create installation package: " )
|
||||
@ -80,7 +77,7 @@ message( STATUS "make package" )
|
||||
message( STATUS "\nOption to install using 'make install'" )
|
||||
message( STATUS "Installation locations: " )
|
||||
message( STATUS "====================" )
|
||||
message( STATUS "Headers: ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_HEADERDIR}" )
|
||||
message( STATUS "Headers: ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/g3log" )
|
||||
message( STATUS "Library installation directory: ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" )
|
||||
|
||||
message( STATUS "For more information please see g3log/CPackLists.txt\n\n" )
|
||||
@ -96,8 +93,6 @@ ENDIF()
|
||||
# CPACK_PACKAGING_INSTALL_PREFIX
|
||||
# CPACK_OUTPUT_FILE_PREFIX
|
||||
# CMAKE_INSTALL_PREFIX
|
||||
# CMAKE_INSTALL_HEADERDIR
|
||||
# CMAKE_INSTALL_LIBDIR
|
||||
|
||||
|
||||
INCLUDE(CPack)
|
||||
|
240
README.markdown
240
README.markdown
@ -194,79 +194,233 @@ int main(int argc, char**argv) {
|
||||
|
||||
|
||||
|
||||
# BUILDING g3log:
|
||||
-----------
|
||||
The default is to build an example binary 'g3log-FATAL-contract' and 'g3log-FATAL-sigsegv'. I suggest you start with that, run it and view the created log also.
|
||||
# BUILDING g3log
|
||||
|
||||
If you are interested in the performance or unit tests then you can
|
||||
enable the creation of them in the g3log/CMakeLists.txt file. See that file for
|
||||
more details
|
||||
|
||||
## Building requires Version Information
|
||||
When building g3log it uses git to calculate the software version. If you don't want that, or your setup does not have access to git you can instead pass in the version as part of the CMake build arguments. See this [_issue_](https://github.com/KjellKod/g3log/issues/311#issuecomment-488829282) for more information.
|
||||
```
|
||||
cmake -DVERSION=1.3.2 ..
|
||||
```
|
||||
|
||||
## Building
|
||||
```
|
||||
git clone https://github.com/KjellKod/g3log
|
||||
cd g3log
|
||||
cd 3rdParty/gtest
|
||||
unzip gtest-1.7.0.zip
|
||||
cd ../../
|
||||
mkdir build
|
||||
cd build
|
||||
```
|
||||
## Configuring for installing on nix (OSX, Linux, MinGW)
|
||||
Default install prefix on Linux is `/usr/local`
|
||||
To change it please set `CPACK_PACKAGING_INSTALL_PREFIX `
|
||||
|
||||
## Prerequisites
|
||||
Assume you have got your shiny C++14 compiler installed, you also need these tools to build g3log from source:
|
||||
- CMake (*Required*)
|
||||
|
||||
g3log uses CMake as a one-stop solution for configuring, building, installing, packaging and testing on Windows, Linux and OSX.
|
||||
|
||||
- Git (*Optional but Recommended*)
|
||||
|
||||
When building g3log it uses git to calculate the software version from the commit history of this repository. If you don't want that, or your setup does not have access to git, or you download g3log source archive from the GitHub Releases page so that you do not have the commit history downloaded, you can instead pass in the version as part of the CMake build arguments. See this [_issue_](https://github.com/KjellKod/g3log/issues/311#issuecomment-488829282) for more information.
|
||||
```
|
||||
cmake -DVERSION=1.3.2 ..
|
||||
```
|
||||
|
||||
## Configuring
|
||||
g3log provides following CMake options (and default values):
|
||||
```
|
||||
cmake -DCPACK_PACKAGING_INSTALL_PREFIX= ...
|
||||
$ cmake -LAH # List non-advanced cached variables. See `cmake --help` for more details.
|
||||
|
||||
...
|
||||
|
||||
// Fatal (fatal-crashes/contract) examples
|
||||
ADD_FATAL_EXAMPLE:BOOL=ON
|
||||
|
||||
// g3log performance test
|
||||
ADD_G3LOG_BENCH_PERFORMANCE:BOOL=OFF
|
||||
|
||||
// g3log unit tests
|
||||
ADD_G3LOG_UNIT_TEST:BOOL=OFF
|
||||
|
||||
// Use DBUG logging level instead of DEBUG.
|
||||
// By default DEBUG is the debugging level
|
||||
CHANGE_G3LOG_DEBUG_TO_DBUG:BOOL=OFF
|
||||
|
||||
// Specifies the build type on single-configuration generators.
|
||||
// Possible values are empty, Debug, Release, RelWithDebInfo, MinSizeRel, …
|
||||
CMAKE_BUILD_TYPE:STRING=
|
||||
|
||||
// Install path prefix, prepended onto install directories.
|
||||
// This variable defaults to /usr/local on UNIX
|
||||
// and c:/Program Files/${PROJECT_NAME} on Windows.
|
||||
CMAKE_INSTALL_PREFIX:PATH=
|
||||
|
||||
// The prefix used in the built package.
|
||||
// On Linux, if this option is not set:
|
||||
// 1) If CMAKE_INSTALL_PREFIX is given, then it will be
|
||||
// set with the value of CMAKE_INSTALL_PREFIX by g3log.
|
||||
// 2) Otherwise, it will be set as /usr/local by g3log.
|
||||
CPACK_PACKAGING_INSTALL_PREFIX:PATH=
|
||||
|
||||
// Enable Visual Studio break point when receiving a fatal exception.
|
||||
// In __DEBUG mode only
|
||||
DEBUG_BREAK_AT_FATAL_SIGNAL:BOOL=OFF
|
||||
|
||||
// Vectored exception / crash handling with improved stack trace
|
||||
ENABLE_FATAL_SIGNALHANDLING:BOOL=ON
|
||||
|
||||
// Vectored exception / crash handling with improved stack trace
|
||||
ENABLE_VECTORED_EXCEPTIONHANDLING:BOOL=ON
|
||||
|
||||
// iOS version of library.
|
||||
G3_IOS_LIB:BOOL=OFF
|
||||
|
||||
// Log full filename
|
||||
G3_LOG_FULL_FILENAME:BOOL=OFF
|
||||
|
||||
// Build shared library
|
||||
G3_SHARED_LIB:BOOL=ON
|
||||
|
||||
// Build shared runtime library MSVC
|
||||
G3_SHARED_RUNTIME:BOOL=ON
|
||||
|
||||
// Turn ON/OFF log levels.
|
||||
// An disabled level will not push logs of that level to the sink.
|
||||
// By default dynamic logging is disabled
|
||||
USE_DYNAMIC_LOGGING_LEVELS:BOOL=OFF
|
||||
|
||||
// Use dynamic memory for message buffer during log capturing
|
||||
USE_G3_DYNAMIC_MAX_MESSAGE_SIZE:BOOL=OFF
|
||||
|
||||
...
|
||||
```
|
||||
For additional option context and comments please also see [Options.cmake](https://github.com/KjellKod/g3log/blob/master/Options.cmake)
|
||||
|
||||
If you want to leave everything as it was, then you should:
|
||||
```
|
||||
cmake ..
|
||||
```
|
||||
You may also specify one or more of those options listed above from the command line.
|
||||
For example, on Windows:
|
||||
```
|
||||
cmake .. -G "Visual Studio 15 2017"
|
||||
-DG3_SHARED_LIB=OFF
|
||||
-DCMAKE_INSTALL_PREFIX=C:/g3log
|
||||
-DADD_G3LOG_UNIT_TEST=ON
|
||||
-DADD_FATAL_EXAMPLE=OFF
|
||||
```
|
||||
will use a Visual Studio 2017 solution generator, build g3log as a static library, headers and libraries will be installed to `C:\g3log` when installed from source, enable unit testing, but do not build fatal example.
|
||||
|
||||
*Note*: To build the tests, you should uncompress `g3log/3rdParty/gtest/gtest-1.7.0.zip` first. On Linux, you may:
|
||||
```
|
||||
# Suppose you are still in `g3log/build`
|
||||
pushd ../3rdParty/gtest
|
||||
unzip gtest-1.7.0.zip
|
||||
popd
|
||||
```
|
||||
|
||||
MinGW users on Windows may find they should use a different generator:
|
||||
```
|
||||
cmake .. -G "MinGW Makefiles"
|
||||
```
|
||||
|
||||
## Building on Linux
|
||||
By default, headers and libraries will be installed to `/usr/local` on Linux when installed from build tree via `make install`. You may overwrite it by:
|
||||
```
|
||||
cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
make
|
||||
cmake .. -DCMAKE_INSTALL_PREFIX=/usr
|
||||
```
|
||||
## Installing On Linux
|
||||
This will install g3log to `/usr` instead of `/usr/local`.
|
||||
|
||||
Linux/OSX package maintainers may be interested in the `CPACK_PACKAGING_INSTALL_PREFIX`. For example:
|
||||
```
|
||||
cmake .. -DCPACK_PACKAGING_INSTALL_PREFIX=/usr/local
|
||||
```
|
||||
|
||||
## Building
|
||||
Once the configuration is done, you may build g3log with:
|
||||
```
|
||||
# Suppose you are still in the `build` directory. I won't repeat it anymore!
|
||||
cmake --build . --config Release
|
||||
```
|
||||
You may also build it with a system-specific way.
|
||||
|
||||
On Linux, OSX and MinGW:
|
||||
```
|
||||
make
|
||||
```
|
||||
On Windows:
|
||||
```
|
||||
msbuild g3log.sln /p:Configuration=Release
|
||||
```
|
||||
Windows users can also open the generated Visual Studio solution file and build it happily.
|
||||
|
||||
## Installing
|
||||
Install from source in a CMake way:
|
||||
```
|
||||
cmake --build . --target install
|
||||
```
|
||||
Linux users may also use:
|
||||
```
|
||||
sudo make install
|
||||
```
|
||||
Alternative on Debian
|
||||
You may also create a package first and install g3log with it. See the next section.
|
||||
|
||||
## Packaging
|
||||
A CMake way:
|
||||
```
|
||||
cmake --build . --config Release --target package
|
||||
```
|
||||
or
|
||||
```
|
||||
cpack -C Release
|
||||
```
|
||||
if the whole library has been built in the previous step.
|
||||
It will generate a ZIP package on Windows, and a DEB package on Linux.
|
||||
|
||||
Linux users may also use a Linux way:
|
||||
```
|
||||
make package
|
||||
```
|
||||
|
||||
If you want to use a different package generator, you should specify a `-G` option.
|
||||
|
||||
On Windows:
|
||||
```
|
||||
cpack -C Release -G NSIS;7Z
|
||||
```
|
||||
this will create a installable NSIS package and a 7z package.
|
||||
|
||||
*Note:* To use the NSIS generator, you should install [```NSIS```](https://nsis.sourceforge.io/Download) first.
|
||||
|
||||
On Linux:
|
||||
```
|
||||
cpack -C Release -G TGZ
|
||||
```
|
||||
this will create a .tar.gz archive for you.
|
||||
|
||||
Once done, you may install or uncompress the package file to the target machine. For example, on Debian or Ubuntu:
|
||||
```
|
||||
sudo dpkg -i g3log-<version>-Linux.deb
|
||||
```
|
||||
will install the g3log library to `CPACK_PACKAGING_INSTALL_PREFIX`.
|
||||
|
||||
## Building on MinGW
|
||||
## Testing
|
||||
|
||||
By default, tests will not be built. To enable unit testing, you should turn on `ADD_G3LOG_UNIT_TEST`. Besides, you should uncompress `g3log/3rdParty/gtest/gtest-1.7.0.zip`(We talked about it in the `Configuring` section).
|
||||
|
||||
Suppose the build process has completed, then you can run the tests with:
|
||||
```
|
||||
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ..
|
||||
make
|
||||
ctest . -C Release
|
||||
```
|
||||
## Installing on MinGW
|
||||
or:
|
||||
```
|
||||
make install
|
||||
make test
|
||||
```
|
||||
Alternative using NSIS
|
||||
for Linux users.
|
||||
|
||||
## CMake module
|
||||
|
||||
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:
|
||||
|
||||
```
|
||||
make package
|
||||
g3log-<version>-win32.exe
|
||||
find_package(g3logger CONFIG REQUIRED)
|
||||
target_link_libraries(main PRIVATE g3logger)
|
||||
```
|
||||
|
||||
## Building on Windows
|
||||
Please use the Visual Studio 12 (2013) command prompt "Developer command prompt"
|
||||
```
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 12" ..
|
||||
msbuild g3log.sln /p:Configuration=Release
|
||||
```
|
||||
*Note:* The CMake package name here is `g3logger`, not `g3log`.
|
||||
|
||||
## Building on *nix with Clang
|
||||
To make sure that CMake can find g3log(or g3logger), you also need to tell CMake where to search for it:
|
||||
```
|
||||
cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release ..
|
||||
make
|
||||
cmake .. -DCMAKE_PREFIX_PATH=<g3log's install prefix>
|
||||
```
|
||||
|
||||
# API description
|
||||
|
12
appveyor.yml
12
appveyor.yml
@ -17,22 +17,22 @@ configuration: Release
|
||||
install:
|
||||
# by default, all script lines are interpreted as batch
|
||||
|
||||
build:
|
||||
project: c:\projects\g3log\build\g3log.sln
|
||||
|
||||
# scripts to run before build
|
||||
before_build:
|
||||
- echo Running cmake...
|
||||
- cd c:\projects\g3log\3rdParty\gtest
|
||||
- 7z x gtest-1.7.0.zip
|
||||
- cd c:\projects\g3log\
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake -G "Visual Studio 14 2015 Win64" -DADD_G3LOG_UNIT_TEST=ON -DUSE_DYNAMIC_LOGGING_LEVELS=ON -DCHANGE_G3LOG_DEBUG_TO_DBUG=ON ..
|
||||
- msbuild g3log.sln /p:Configuration=Release
|
||||
|
||||
build_script:
|
||||
- cmake -G "Visual Studio 14 2015 Win64" -DADD_G3LOG_UNIT_TEST=ON -DUSE_DYNAMIC_LOGGING_LEVELS=ON -DCHANGE_G3LOG_DEBUG_TO_DBUG=ON -DCMAKE_INSTALL_PREFIX=c:\g3log ..
|
||||
- cmake --build . --config Release --target install
|
||||
|
||||
# scripts to run after build
|
||||
after_build:
|
||||
- cmd /c Release\g3log-FATAL-contract.exe || exit /B 0
|
||||
- tree /A /F c:\g3log
|
||||
- cpack -G "NSIS;ZIP"
|
||||
- ctest -C Release --verbose
|
||||
|
||||
|
@ -16,42 +16,39 @@
|
||||
# * ``G3LOG_FOUND`` -- check if the lib was found without using the newer ``if(TARGET g3logger)...``
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_path(G3LOG_INCLUDE_DIR
|
||||
NAMES
|
||||
g3log/active.hpp
|
||||
g3log/atomicbool.hpp
|
||||
g3log/crashhandler.hpp
|
||||
g3log/filesink.hpp
|
||||
g3log/future.hpp
|
||||
g3log/g3log.hpp
|
||||
g3log/generated_definitions.hpp
|
||||
g3log/logcapture.hpp
|
||||
g3log/loglevels.hpp
|
||||
g3log/logmessage.hpp
|
||||
g3log/logworker.hpp
|
||||
g3log/moveoncopy.hpp
|
||||
g3log/shared_queue.hpp
|
||||
g3log/sinkhandle.hpp
|
||||
g3log/sink.hpp
|
||||
g3log/sinkwrapper.hpp
|
||||
g3log/stacktrace_windows.hpp
|
||||
g3log/stlpatch_future.hpp
|
||||
g3log/time.hpp
|
||||
PATHS
|
||||
ENV G3LOG
|
||||
)
|
||||
find_library(G3LOG_LIBRARY
|
||||
NAMES libg3logger g3logger )
|
||||
find_package_handle_standard_args(g3logger
|
||||
include(SelectLibraryConfigurations)
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
if (NOT TARGET g3logger)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/g3loggerTargets.cmake")
|
||||
|
||||
get_target_property(G3LOG_INCLUDE_DIR g3logger INTERFACE_INCLUDE_DIRECTORIES)
|
||||
|
||||
get_target_property(G3LOG_LIBRARY_DEBUG g3logger IMPORTED_IMPLIB_DEBUG)
|
||||
if (G3LOG_LIBRARY_DEBUG MATCHES ".*-NOTFOUND")
|
||||
get_target_property(G3LOG_LIBRARY_DEBUG g3logger IMPORTED_LOCATION_DEBUG)
|
||||
endif ()
|
||||
|
||||
get_target_property(G3LOG_LIBRARY_RELEASE g3logger IMPORTED_IMPLIB_RELEASE)
|
||||
if (G3LOG_LIBRARY_RELEASE MATCHES ".*-NOTFOUND")
|
||||
get_target_property(G3LOG_LIBRARY_RELEASE g3logger IMPORTED_LOCATION_RELEASE)
|
||||
endif ()
|
||||
|
||||
select_library_configurations(G3LOG)
|
||||
|
||||
if (G3LOG_LIBRARY)
|
||||
list(APPEND G3LOG_LIBRARY Threads::Threads)
|
||||
if (WIN32)
|
||||
list(APPEND G3LOG_LIBRARY DbgHelp.lib)
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
find_package_handle_standard_args(G3LOG
|
||||
REQUIRED_VARS G3LOG_INCLUDE_DIR G3LOG_LIBRARY)
|
||||
mark_as_advanced(G3LOG_INCLUDE_DIR G3LOG_LIBRARY)
|
||||
set(G3LOG_LIBRARIES ${G3LOG_LIBRARY})
|
||||
set(G3LOG_INCLUDE_DIRS ${G3LOG_INCLUDE_DIR})
|
||||
|
||||
add_library(g3logger SHARED IMPORTED)
|
||||
find_package(Threads REQUIRED)
|
||||
set_target_properties(g3logger PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${G3LOG_INCLUDE_DIRS}"
|
||||
IMPORTED_LOCATION "${G3LOG_LIBRARY}"
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES Threads::Threads
|
||||
)
|
||||
set(G3LOG_LIBRARIES ${G3LOG_LIBRARY})
|
||||
|
@ -7,7 +7,18 @@ unzip -o 3rdParty/gtest/gtest-1.7.0.zip -d 3rdParty/gtest
|
||||
|
||||
mkdir -p build_travis
|
||||
cd build_travis
|
||||
cmake -DCMAKE_CXX_FLAGS=-std=c++14 -DADD_G3LOG_BENCH_PERFORMANCE=ON -DADD_G3LOG_UNIT_TEST=ON ..
|
||||
cmake -DCMAKE_CXX_FLAGS=-std=c++14 -DADD_G3LOG_BENCH_PERFORMANCE=ON -DADD_G3LOG_UNIT_TEST=ON -DCMAKE_INSTALL_PREFIX=./install -DCPACK_PACKAGING_INSTALL_PREFIX=/opt/g3log ..
|
||||
cmake --build . --target install
|
||||
|
||||
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
|
||||
cpack -G "ZIP"
|
||||
unzip g3log-*-Darwin.zip
|
||||
fi
|
||||
|
||||
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
|
||||
cpack -G "DEB;TGZ"
|
||||
tar zxvf g3log-*-Linux.tar.gz
|
||||
fi
|
||||
|
||||
#makeArg=`grep -c ^processor /proc/cpuinfo`
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user