Debian Codegraph @

src/filter/kaleid0sc0pe/CMakeLists.txt

raw
1 include(CheckIncludeFileCXX)
2 include(CheckCSourceCompiles)
3 include(CheckCXXSourceCompiles)
4
5 cmake_policy(SET CMP0056 NEW)
6 cmake_policy(SET CMP0066 NEW)
7 cmake_policy(SET CMP0067 NEW)
8
9 set(CMAKE_CXX_STANDARD 11)
10 set(CMAKE_CXX_STANDARD_REQUIRED True)
11
12 set (SOURCES api.cpp ikaleid0sc0pe.h kaleid0sc0pe.cpp kaleid0sc0pe.h sse_mathfun_extension.h sse_mathfun.h)
13 set (TARGET kaleid0sc0pe)
14
15 if (MSVC)
16 set (SOURCES ${SOURCES} ${FREI0R_DEF})
17 endif (MSVC)
18
19 add_library (${TARGET} MODULE ${SOURCES})
20 set_target_properties (${TARGET} PROPERTIES PREFIX "")
21
22 if (NOT WIN32)
23 set(THREADS_PREFER_PTHREAD_FLAG ON)
24 find_package(Threads REQUIRED)
25 target_link_libraries(${TARGET} PRIVATE Threads::Threads)
26 endif()
27
28 if(NO_SSE2)
29 message(STATUS "SSE2 is disabled")
30 add_definitions(-DNO_SSE2)
31 else()
32 check_include_file_cxx(immintrin.h HAS_INTEL_INTRINSICS)
33 if (HAS_INTEL_INTRINSICS)
34 add_definitions(-DHAS_INTEL_INTRINSICS)
35 if (NOT WIN32)
36 target_compile_options(${TARGET} PRIVATE -msse2)
37 set(CMAKE_REQUIRED_FLAGS "-msse2")
38 endif()
39 check_c_source_compiles("
40 #include <emmintrin.h>
41 #include <immintrin.h>
42 int main(){ __m128 a = _mm_set1_ps(0.0f); a = _mm_sin_ps(a); return 0;}" HAS_SIN_INTRINSIC)
43 check_c_source_compiles("
44 #include <emmintrin.h>
45 #include <immintrin.h>
46 int main(){ __m128 a = _mm_set1_ps(0.0f); a = _mm_cos_ps(a); return 0;}" HAS_COS_INTRINSIC)
47 check_c_source_compiles("
48 #include <emmintrin.h>
49 #include <immintrin.h>
50 int main(){ __m128 a = _mm_set1_ps(0.0f); __m128 b = _mm_set1_ps(0.0f); a = _mm_atan2_ps(a,b); return 0;}" HAS_ATAN2_INTRINSIC)
51 if (HAS_SIN_INTRINSIC)
52 add_definitions(-DHAS_SIN_INTRINSIC)
53 endif()
54 if (HAS_COS_INTRINSIC)
55 add_definitions(-DHAS_COS_INTRINSIC)
56 endif()
57 if (HAS_ATAN2_INTRINSIC)
58 add_definitions(-DHAS_ATAN2_INTRINSIC)
59 endif()
60 endif()
61 endif()
62
63 check_cxx_source_compiles("
64 #include <future>
65 int main(){ std::future<void> f; return 0;}" HAS_WORKING_FUTURE)
66 if (NOT HAS_WORKING_FUTURE)
67 add_definitions(-DNO_FUTURE)
68 endif()
69 install (TARGETS ${TARGET} LIBRARY DESTINATION ${LIBDIR})