Repository navigation
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
97 lines (80 loc) · 2.99 KB
/
Copy pathCMakeLists.txt
File metadata and controls
97 lines (80 loc) · 2.99 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
A45C
div>
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
cmake_minimum_required(VERSION 3.0.0)
project(libcolortwist VERSION 0.1.0)
INCLUDE(CheckIncludeFiles)
#include(CTest)
#enable_testing()
#FIND_PACKAGE (IPP REQUIRED )
set (LIBCOLORTWIST_SOURCES colortwist.h
colortwist.cpp
colortwist_c.h
colortwist_c.cpp
colortwist_ipp.h
colortwist_ipp.cpp
colortwist_avx.h
colortwist_avx.cpp
colortwist_neon.h
colortwist_neon.cpp
utils.h
utils.cpp)
#[[
add_library(libcolortwist
colortwist.h
colortwist.cpp
colortwist_ipp.cpp
colortwist_avx.cpp)
]]
add_library(libcolortwist
${LIBCOLORTWIST_SOURCES})
if(IPP_FOUND)
set(COLORTWIST_HAS_IPP 1)
target_include_directories(libcolortwist PRIVATE ${IPP_INCLUDE_DIRS})
else()
set(COLORTWIST_HAS_IPP 0)
endif()
# check whether we can use AVX2-instructions -> we check for the presence of the file
CHECK_INCLUDE_FILES(immintrin.h IMMINTRINFOUND)
if (IMMINTRINFOUND)
set(COLORTWISE_HAS_AVX 1)
else()
set(COLORTWISE_HAS_AVX 0)
endif()
# check whether we can use ARM-Neon-instructions -> we check for the presence of the file
CHECK_INCLUDE_FILES(arm_neon.h ARMNEONFOUND)
if (ARMNEONFOUND)
set(COLORTWIST_HAS_NEON 1)
else()
set(COLORTWIST_HAS_NEON 0)
endif()
set(COLORTWIST_HAS_SYS_AUXV_H 0)
if (ARMNEONFOUND)
CHECK_INCLUDE_FILES("sys/auxv.h" SYSAUXHFOUND)
if (SYSAUXHFOUND)
set(COLORTWIST_HAS_SYS_AUXV_H 1)
endif()
endif()
configure_file (
"${CMAKE_CURRENT_SOURCE_DIR}/colortwist_config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/colortwist_config.h"
ESCAPE_QUOTES @ONLY)
#set(CPACK_PROJECT_NAME ${PROJECT_NAME})
#set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
#include(CPack)
# Make sure the compiler can find include files for our Hello library
# when other libraries or executables link to Hello
target_include_directories (libcolortwist PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
# this is necessary so that we can find "colortwist_config.h" which we created above
target_include_directories(libcolortwist PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
message(STATUS ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "AMD64" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
if (MSVC)
set_source_files_properties(colortwist_avx.cpp PROPERTIES COMPILE_FLAGS /arch:AVX2)
endif()
if (CMAKE_COMPILER_IS_GNUCXX)
set_source_files_properties(colortwist_avx.cpp PROPERTIES COMPILE_FLAGS "-mfma -mavx2")
endif()
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv7l")
set_target_properties(libcolortwist PROPERTIES COMPILE_FLAGS -mfpu=neon)
#set_source_files_properties(colortwist_neon.cpp PROPERTIES COMPILE_FLAGS -mfpu=neon)
#set_source_files_properties(colortwist_neon.cpp PROPERTIES COMPILE_FLAGS -march=armv7-a)
endif()