forked from hyperledger-labs/private-data-objects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectVariables.cmake
More file actions
88 lines (75 loc) · 3.02 KB
/
ProjectVariables.cmake
File metadata and controls
88 lines (75 loc) · 3.02 KB
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
# Copyright 2023 Intel Corporation
#
# 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.
################################################################################
# Common variables
################################################################################
# These options apply to all PDO projects
ADD_COMPILE_OPTIONS(-m64 -fvisibility=hidden -fpie -fPIC -fstack-protector)
ADD_COMPILE_OPTIONS($<$<COMPILE_LANGUAGE:CXX>:-std=c++11>)
OPTION(PDO_DEBUG_BUILD "Build with debugging turned on" 1)
IF (DEFINED ENV{PDO_DEBUG_BUILD})
SET(PDO_DEBUG_BUILD $ENV{PDO_DEBUG_BUILD})
ENDIF()
IF (${PDO_DEBUG_BUILD})
ADD_COMPILE_OPTIONS(-Og -g)
ADD_COMPILE_DEFINITIONS(PDO_DEBUG_BUILD=1)
MESSAGE(STATUS "Compiling in debug mode without optimizations (-Og -g)")
ELSE()
ADD_COMPILE_OPTIONS(-O2)
ADD_COMPILE_DEFINITIONS(PDO_DEBUG_BUILD=0)
MESSAGE(STATUS "Compiling with optimizations (-O2). To use debug flags, set the DEBUG environment variable.")
ENDIF()
# The verbose build flag allows warning messages
# to be turned off. This removes a lot of the verbosity
# of the OpenSSL/SGXSSL deprecation warnings. In general
# we do not want to ignore those messages to verbose is
# set to true by default.
OPTION(PDO_VERBOSE_BUILD "Build with all warnings turned on" TRUE)
IF (DEFINED ENV{PDO_VERBOSE_BUILD})
SET(PDO_VERBOSE_BUILD $ENV{PDO_VERBOSE_BUILD})
ENDIF()
IF (${PDO_VERBOSE_BUILD})
ADD_COMPILE_OPTIONS(-Wall)
ELSE()
# this should not be necessary (no -Wall), but make
# sure we don't pick up the OpenSSL/SGXSSL deprecation warnings
ADD_COMPILE_OPTIONS(-Wno-deprecated)
ADD_COMPILE_OPTIONS(-Wno-deprecated-declarations)
ENDIF()
IF (NOT DEFINED ENV{PDO_INSTALL_ROOT})
MESSAGE(FATAL_ERROR "PDO_INSTALL_ROOT not defined")
ENDIF()
SET(PDO_INSTALL_ROOT $ENV{PDO_INSTALL_ROOT})
IF (NOT DEFINED ENV{PDO_SOURCE_ROOT})
MESSAGE(FATAL_ERROR "PDO_SOURCE_ROOT not defined")
ENDIF()
SET(PDO_SOURCE_ROOT $ENV{PDO_SOURCE_ROOT})
# Pull in the configuration for memory allocation across the entire
# project including the state cache and interpreter size in common and
# the enclave allocation in the eservice.
INCLUDE(Memory)
# Get the current version using the get_version
# utility; note that this will provide 0.0.0 as
# the version if something goes wrong (like running
# without any annotated version tags)
EXECUTE_PROCESS(
COMMAND ${PDO_SOURCE_ROOT}/bin/get_version
WORKING_DIRECTORY ${PDO_SOURCE_ROOT}
OUTPUT_VARIABLE PDO_VERSION
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
IF (NOT PDO_VERSION)
MESSAGE(FATAL_ERROR "Unable to compute PDO_VERSION")
ENDIF()