-
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
43 lines (35 loc) · 1.59 KB
/
Copy pathCMakeLists.txt
File metadata and controls
43 lines (35 loc) · 1.59 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
cmake_minimum_required (VERSION 2.6...4.0.0)
project(libc-shim LANGUAGES C CXX)
add_library(libc-shim src/common.cpp src/pthreads.cpp src/pthreads.h src/meta.h src/common.h src/semaphore.cpp src/semaphore.h src/network.cpp src/network.h src/dirent.cpp src/dirent.h src/cstdio.cpp src/cstdio.h src/errno.cpp src/errno.h src/ctype_data.h src/ctype_data.cpp src/bionic/strlcpy.cpp src/stat.cpp src/stat.h src/file_misc.cpp src/file_misc.h src/sysconf.cpp src/sysconf.h src/system_properties.cpp src/system_properties.h src/iorewrite.cpp src/iorewrite.h src/statvfs.h src/statvfs.cpp src/sched.h src/sched.cpp)
target_include_directories(libc-shim PUBLIC include/)
target_link_libraries(libc-shim PRIVATE logger)
if(APPLE OR FREEBSD)
target_link_libraries(libc-shim PRIVATE epoll-shim)
endif()
if(APPLE AND NOT IS_64BIT)
target_sources(libc-shim PUBLIC src/bionic/arch-x86/setjmp.S src/bionic/setjmp_cookie.c)
target_compile_definitions(libc-shim PRIVATE USE_BIONIC_SETJMP)
endif()
if(APPLE)
target_sources(libc-shim PUBLIC src/osx10_10_compat.c)
endif()
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("
#include <atomic>
struct A {
long long a;
void* wrapper;
long long b;
};
int main() {
std::atomic<A> a;
auto a2 = a.load();
auto a3 = a2;
a3.wrapper = &a;
return a.compare_exchange_strong(a2, a3, std::memory_order_relaxed, std::memory_order_relaxed) ? 0 : 1;
}
" HAVE_ATOMICS_WITHOUT_LIB)
# Link atomic library if needed
if(NOT HAVE_ATOMICS_WITHOUT_LIB)
target_link_libraries(libc-shim PRIVATE atomic)
endif()