forked from rdkcentral/Thunder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
119 lines (96 loc) · 3.87 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
# If not stated otherwise in this file or this component's license file the
# following copyright and licenses apply:
#
# Copyright 2020 Metrological
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.3)
project(WPEFramework)
set(VERSION_MAJOR 1)
set(VERSION_MINOR 0)
set(VERSION_PATCH 0)
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
message(STATUS "Setting up ${PROJECT_NAME} v${VERSION}")
if (BUILD_REFERENCE)
add_definitions (-DBUILD_REFERENCE=${BUILD_REFERENCE})
endif()
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/cmake"
"${CMAKE_SOURCE_DIR}/cmake/common"
"${CMAKE_SOURCE_DIR}/cmake/modules")
include(platform)
include(CmakeHelperFunctions)
set(PLATFORM "PC_UNIX" CACHE STRING
"Defines on what platform the application will run")
set(NAMESPACE ${PROJECT_NAME} CACHE STRING "Namespace of the project")
find_package(ProxyStubGenerator REQUIRED)
find_package(JsonGenerator REQUIRED)
#
# Build type specific options
#
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE MinSizeRel)
message(AUTHOR_WARNING "CMAKE_BUILD_TYPE not set, assuming '${CMAKE_BUILD_TYPE}'")
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR
"${CMAKE_BUILD_TYPE}" STREQUAL "DebugOptimized" OR
"${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo" OR
"${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR
"${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel")
message(STATUS "CMAKE_BUILD_TYPE: '${CMAKE_BUILD_TYPE}'")
else()
message(FATAL_ERROR "Invalid CMAKE_BUILD_TYPE: '${CMAKE_BUILD_TYPE}'")
endif()
# Remove optimization flags added by the build system
string(REGEX REPLACE "(-O([0123gs]|fast))" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "(-O([0123gs]|fast))" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REGEX REPLACE "(-g[0123])" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "(-g[0123])" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REGEX REPLACE "\\-\\g$" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "\\-\\g$" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
# make sure others can make use of the JSON creation tools as well!!!
configure_file( "${CMAKE_SOURCE_DIR}/cmake/project.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${NAMESPACE}.cmake"
@ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${NAMESPACE}.cmake"
RENAME "${NAMESPACE}Config.cmake"
DESTINATION lib/cmake/${NAMESPACE})
install(DIRECTORY
"${CMAKE_SOURCE_DIR}/cmake/common"
"${CMAKE_SOURCE_DIR}/cmake/config"
"${CMAKE_SOURCE_DIR}/cmake/templates"
DESTINATION lib/cmake/${NAMESPACE})
if(APPLE)
# Mac needed variables
# http://www.cmake.org/Wiki/CMake_RPATH_handling#Mac_OS_X_and_the_RPATH)
set(CMAKE_MACOSX_RPATH ON)
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()
if (ENABLE_CODE_COVERAGE)
include (CodeCoverage)
append_coverage_compiler_flags()
set(COVERAGE_EXCLUDES
"${CMAKE_CURRENT_BINARY_DIR}/Tests/unit*"
"${CMAKE_CURRENT_BINARY_DIR}/Tests/unit/core/*")
setup_target_for_coverage_gcovr_html(NAME "coverage")
setup_target_for_coverage_gcovr_xml(NAME "coverage-report")
add_definitions(-DWITH_CODE_COVERAGE=1)
endif()
if(BUILD_TESTS)
enable_testing()
endif()
add_subdirectory(Tests)
add_subdirectory(Source)