forked from KjellKod/g3log
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
143 lines (108 loc) · 4.93 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# ==========================================================================
# 2010 by KjellKod.cc. This is PUBLIC DOMAIN to use at your own risk and comes
# with no warranties. This code is yours to share, use and modify with no
# strings attached and no restrictions or obligations.
#
# 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
# === 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")
# (XXX is the Visual Studio version you are running)
# 4. 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)
#
#
#
# === 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"
#
# ============================================================================
cmake_minimum_required (VERSION 2.8)
ENABLE_LANGUAGE(CXX)
set(CMAKE_BUILD_TYPE Release)
project (g3log)
# Detect 64 or 32 bit
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
# 64-bit project
SET(64_BIT_OS TRUE)
MESSAGE("A 64-bit OS detected")
else()
SET(64_BIT_OS FALSE)
MESSAGE("A 32-bit OS detected")
endif()
# ============================================================================
# G3LOG OPTIONAL FEATURES
# ============================================================================
INCLUDE (${g3log_SOURCE_DIR}/Options.cmake)
# =========================================================================
# 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)
option (ADD_BUILD_WIN_SHARED "Build shared library on Windows" OFF)
# =========================================================================
# 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)
# ==========================================================================
# UNIT TEST OPTIONS:
# ============================================================================
# ENABLE WITH: -DADD_G3LOG_UNIT_TEST=ON
INCLUDE (${g3log_SOURCE_DIR}/test_unit/Test.cmake)
# ==========================================================================
# BETA : package manager for G3Log,. not yet reliable. Use at your own risk
# ==========================================================================
# Package handling is done AFTER all other CMake setup
#
# usage: make package
#
# Check the output result and install accordingly.
# ==========================================================================
# INCLUDE (${g3log_SOURCE_DIR}/CPackLists.txt)
IF (NOT MSVC)
MESSAGE("\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()