Lower correlation threshold in flush-finish tests again am: 6455e6f987 am: 2e18b48b04...
[platform/upstream/VK-GL-CTS.git] / framework / delibs / cmake / CFlags.cmake
1 #-------------------------------------------------------------------------
2 # drawElements CMake utilities
3 # ----------------------------
4 #
5 # Copyright 2014 The Android Open Source Project
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #      http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19 #-------------------------------------------------------------------------
20
21 set(DE_COVERAGE_BUILD "OFF" CACHE STRING "Build with coverage instrumentation with GCC (ON/OFF)")
22
23 if (NOT DE_DEFS)
24         message(FATAL_ERROR "Defs.cmake is not included")
25 endif ()
26
27 if (DE_COMPILER_IS_GCC OR DE_COMPILER_IS_CLANG)
28         # Compiler flags for GCC/Clang
29
30         set(TARGET_FLAGS "")
31
32         if (DE_COVERAGE_BUILD)
33                 if (not DE_COMPILER_IS_GCC)
34                         message(FATAL_ERROR "Coverage build requires GCC")
35                 endif ()
36
37                 add_definitions("-DDE_COVERAGE_BUILD")
38                 set(TARGET_FLAGS        "-fprofile-arcs -ftest-coverage")
39                 set(LINK_FLAGS          "${LINK_FLAGS} -lgcov")
40         endif ()
41
42         # For 3rd party sw disable all warnings
43         set(DE_3RD_PARTY_C_FLAGS        "${CMAKE_C_FLAGS} ${TARGET_FLAGS} -w")
44         set(DE_3RD_PARTY_CXX_FLAGS      "${CMAKE_CXX_FLAGS} ${TARGET_FLAGS} -w")
45
46         # \note Remove -Wno-sign-conversion for more warnings
47         set(WARNING_FLAGS                       "-Wall -Wextra -Wno-long-long -Wshadow -Wundef -Wconversion -Wno-sign-conversion")
48
49         set(CMAKE_C_FLAGS                       "${TARGET_FLAGS} ${WARNING_FLAGS} ${CMAKE_C_FLAGS} -std=c90 -pedantic ")
50         set(CMAKE_CXX_FLAGS                     "${TARGET_FLAGS} ${WARNING_FLAGS} ${CMAKE_CXX_FLAGS} -std=c++03 -Wno-delete-non-virtual-dtor")
51
52         # Force compiler to generate code where integers have well defined overflow
53         # Turn on -Wstrict-overflow=5 and check all warnings before removing
54         set(CMAKE_C_FLAGS                       "${CMAKE_C_FLAGS} -fwrapv")
55         set(CMAKE_CXX_FLAGS                     "${CMAKE_CXX_FLAGS} -fwrapv")
56 elseif (DE_COMPILER_IS_MSC)
57         # Compiler flags for msc
58
59         # \note Following unnecessary nagging warnings are disabled:
60         # 4820: automatic padding added after data
61         # 4255: no function prototype given (from system headers)
62         # 4668: undefined identifier in preprocessor expression (from system headers)
63         # 4738: storing 32-bit float result in memory
64         # 4711: automatic inline expansion
65         set(MSC_BASE_FLAGS "/DWIN32 /D_WINDOWS /D_CRT_SECURE_NO_WARNINGS")
66         set(MSC_WARNING_FLAGS "/W3 /wd4820 /wd4255 /wd4668 /wd4738 /wd4711")
67
68         # For 3rd party sw disable all warnings
69         set(DE_3RD_PARTY_C_FLAGS        "${CMAKE_C_FLAGS} ${MSC_BASE_FLAGS} /W0")
70         set(DE_3RD_PARTY_CXX_FLAGS      "${CMAKE_CXX_FLAGS} ${MSC_BASE_FLAGS} /EHsc /W0")
71
72         set(CMAKE_C_FLAGS                       "${CMAKE_C_FLAGS} ${MSC_BASE_FLAGS} ${MSC_WARNING_FLAGS}")
73         set(CMAKE_CXX_FLAGS                     "${CMAKE_CXX_FLAGS} ${MSC_BASE_FLAGS} /EHsc ${MSC_WARNING_FLAGS}")
74
75 else ()
76         message(FATAL_ERROR "DE_COMPILER is not valid")
77 endif ()