aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt18
-rw-r--r--lib/CMakeLists.txt10
2 files changed, 25 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e68a0cf1..dc0b6149 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -50,6 +50,24 @@ if(${CAN_VECTORIZE})
#set(CMAKE_C_FLAGS "-Rpass=loop-vectorize ${CMAKE_C_FLAGS}") # CLANG
endif()
+# atomic operations
+include(CheckCSourceCompiles)
+CHECK_C_SOURCE_COMPILES("
+ #include <stdlib.h>
+ #include <stdatomic.h>
+ int main(int argc, char **argv)
+ {
+ _Atomic size_t head;
+ atomic_init(&head, 0);
+ size_t chead = atomic_load_explicit(&head, memory_order_acquire);
+ chead += 1;
+ atomic_store_explicit(&head, chead, memory_order_release);
+ return 0;
+ }" HAS_ATOMIC)
+if(NOT ${HAS_ATOMIC})
+ message(FATAL_ERROR "compiler has no support for C11 atomic operations")
+endif()
+
# eina
pkg_search_module(EINA REQUIRED eina>=1.8)
include_directories(${EINA_INCLUDE_DIRS})
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 2ff38424..e56fda34 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -8,9 +8,13 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/cjson)
add_definitions("-D_GNU_SOURCE=1") # asprintf
include(CheckCSourceCompiles)
-CHECK_C_SOURCE_COMPILES("int main(int argc, char **argv)
- {void *src; void *dst = __builtin_assume_aligned(src, 16); return 0;}"
- HAS_BUILTIN_ASSUME_ALIGNED)
+CHECK_C_SOURCE_COMPILES("
+ int main(int argc, char **argv)
+ {
+ void *src;
+ void *dst = __builtin_assume_aligned(src, 16);
+ return 0;
+ }" HAS_BUILTIN_ASSUME_ALIGNED)
if(${HAS_BUILTIN_ASSUME_ALIGNED})
add_definitions("-DHAS_BUILTIN_ASSUME_ALIGNED")
endif()