forked from edgardoh/darktable
-
-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathConfigureChecks.cmake
More file actions
110 lines (92 loc) · 2.63 KB
/
ConfigureChecks.cmake
File metadata and controls
110 lines (92 loc) · 2.63 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
include(CheckCSourceCompiles)
include(TestBigEndian)
include(CheckIncludeFile)
include(CheckSymbolExists)
include(CheckStructHasMember)
if (OpenMP_FOUND)
set(CMAKE_REQUIRED_FLAGS ${OpenMP_C_FLAGS})
set(CMAKE_REQUIRED_LIBRARIES ${OpenMP_C_LIBRARIES})
set(CMAKE_REQUIRED_INCLUDES ${OpenMP_C_INCLUDE_DIRS})
check_c_source_compiles("
#include <omp.h>
static void sink(const int x, int a[])
{
#pragma omp parallel for default(none) firstprivate(x) shared(a)
for(int i = 0; i < 3; i++) {
a[i] = x + i;
}
}
int main(void)
{
int x = 42;
int a[3] = {0};
sink(x, a);
return 0;
}" HAVE_OMP_FIRSTPRIVATE_WITH_CONST)
set(CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_LIBRARIES)
set(CMAKE_REQUIRED_INCLUDES)
endif()
if(APPLE)
check_c_source_compiles("
#if defined(__x86_64__)
__attribute__((target_clones(\"default\",\"arch=x86-64\",\"arch=x86-64-v2\",\"arch=x86-64-v3\",\"arch=x86-64-v4\")))
static int dt_target_clones_probe(void)
{
return 0;
}
#endif
int main(void)
{
#if defined(__x86_64__)
return dt_target_clones_probe();
#else
return 0;
#endif
}" HAVE_APPLE_X86_TARGET_CLONES)
endif()
#
# Check for pthread struct members
#
set(CMAKE_REQUIRED_FLAGS ${THREADS_PREFER_PTHREAD_FLAG})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
check_struct_has_member("struct __pthread_rwlock_arch_t"
"__readers"
"pthread.h"
HAVE_THREAD_RWLOCK_ARCH_T_READERS
LANGUAGE C)
check_struct_has_member("struct __pthread_rwlock_arch_t"
"__nr_readers"
"pthread.h"
HAVE_THREAD_RWLOCK_ARCH_T_NR_READERS
LANGUAGE C)
unset(CMAKE_REQUIRED_FLAGS)
unset(CMAKE_REQUIRED_LIBRARIES)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR})
check_c_source_compiles("#include <stdio.h>
int main() {
#include \"src/is_supported_platform.h\"
}" IS_SUPPORTED_PLATFORM)
if (IS_SUPPORTED_PLATFORM)
message(STATUS "Is the target platform supported: ${IS_SUPPORTED_PLATFORM}")
else()
message(FATAL_ERROR "The target platform is not supported!")
endif()
set(CMAKE_REQUIRED_INCLUDES)
test_big_endian(BIGENDIAN)
if(${BIGENDIAN})
# we do not really want those.
# besides, no one probably tried ansel on such systems
message(FATAL_ERROR "Found big endian system. Bad.")
else()
message(STATUS "Found little endian system. Good.")
endif(${BIGENDIAN})
check_c_source_compiles("
static __thread int tls;
int main(void)
{
return 0;
}" HAVE_TLS)
if(NOT HAVE_TLS)
MESSAGE(FATAL_ERROR "The compiler does not support Thread-local storage.")
endif()