Release v4.18994 - Backdoor
[RRG-proxmark3.git] / client / deps / hardnested.cmake
blob468ee4ef2d36e183d8c66206bafef939e79d8c6a
1 add_library(pm3rrg_rdv4_hardnested_nosimd OBJECT
2         hardnested/hardnested_bf_core.c
3         hardnested/hardnested_bitarray_core.c)
5 target_compile_options(pm3rrg_rdv4_hardnested_nosimd PRIVATE -Wall -O3)
6 set_property(TARGET pm3rrg_rdv4_hardnested_nosimd PROPERTY POSITION_INDEPENDENT_CODE ON)
8 target_include_directories(pm3rrg_rdv4_hardnested_nosimd PRIVATE
9         ../../common
10         ../../include
11         ../src)
13 target_compile_definitions(pm3rrg_rdv4_hardnested_nosimd PRIVATE NOSIMD_BUILD)
15 ## CPU-specific code
16 ## These are mostly for x86-based architectures, which is not useful for many Android devices.
17 ## Mingw platforms: AMD64
18 set(X86_CPUS x86 x86_64 i686 AMD64)
19 set(ARM64_CPUS arm64 aarch64)
20 set(ARM32_CPUS armel armhf armv7-a)
22 message(STATUS "CMAKE_SYSTEM_PROCESSOR := ${CMAKE_SYSTEM_PROCESSOR}")
24 if ("${CMAKE_SYSTEM_PROCESSOR}" IN_LIST X86_CPUS)
25     message(STATUS "Building optimised x86/x86_64 binaries")
27     target_compile_options(pm3rrg_rdv4_hardnested_nosimd BEFORE PRIVATE
28             -mno-mmx -mno-sse2 -mno-avx -mno-avx2 -mno-avx512f)
30     ## x86 / MMX
31     add_library(pm3rrg_rdv4_hardnested_mmx OBJECT
32             hardnested/hardnested_bf_core.c
33             hardnested/hardnested_bitarray_core.c)
35     target_compile_options(pm3rrg_rdv4_hardnested_mmx PRIVATE -Wall -O3)
36     target_compile_options(pm3rrg_rdv4_hardnested_mmx BEFORE PRIVATE
37             -mmmx -mno-sse2 -mno-avx -mno-avx2 -mno-avx512f)
38     set_property(TARGET pm3rrg_rdv4_hardnested_mmx PROPERTY POSITION_INDEPENDENT_CODE ON)
40     target_include_directories(pm3rrg_rdv4_hardnested_mmx PRIVATE
41             ../../common
42             ../../include
43             ../src)
45     ## x86 / SSE2
46     add_library(pm3rrg_rdv4_hardnested_sse2 OBJECT
47             hardnested/hardnested_bf_core.c
48             hardnested/hardnested_bitarray_core.c)
50     target_compile_options(pm3rrg_rdv4_hardnested_sse2 PRIVATE -Wall -O3)
51     target_compile_options(pm3rrg_rdv4_hardnested_sse2 BEFORE PRIVATE
52             -mmmx -msse2 -mno-avx -mno-avx2 -mno-avx512f)
53     set_property(TARGET pm3rrg_rdv4_hardnested_sse2 PROPERTY POSITION_INDEPENDENT_CODE ON)
55     target_include_directories(pm3rrg_rdv4_hardnested_sse2 PRIVATE
56             ../../common
57             ../../include
58             ../src)
60     ## x86 / AVX
61     add_library(pm3rrg_rdv4_hardnested_avx OBJECT
62             hardnested/hardnested_bf_core.c
63             hardnested/hardnested_bitarray_core.c)
65     target_compile_options(pm3rrg_rdv4_hardnested_avx PRIVATE -Wall -O3)
66     target_compile_options(pm3rrg_rdv4_hardnested_avx BEFORE PRIVATE
67             -mmmx -msse2 -mavx -mno-avx2 -mno-avx512f)
68     set_property(TARGET pm3rrg_rdv4_hardnested_avx PROPERTY POSITION_INDEPENDENT_CODE ON)
70     target_include_directories(pm3rrg_rdv4_hardnested_avx PRIVATE
71             ../../common
72             ../../include
73             ../src)
75     ## x86 / AVX2
76     add_library(pm3rrg_rdv4_hardnested_avx2 OBJECT
77             hardnested/hardnested_bf_core.c
78             hardnested/hardnested_bitarray_core.c)
80     target_compile_options(pm3rrg_rdv4_hardnested_avx2 PRIVATE -Wall -O3)
81     target_compile_options(pm3rrg_rdv4_hardnested_avx2 BEFORE PRIVATE
82             -mmmx -msse2 -mavx -mavx2 -mno-avx512f)
83     set_property(TARGET pm3rrg_rdv4_hardnested_avx2 PROPERTY POSITION_INDEPENDENT_CODE ON)
85     target_include_directories(pm3rrg_rdv4_hardnested_avx2 PRIVATE
86             ../../common
87             ../../include
88             ../src)
90     ## x86 / AVX512
91     add_library(pm3rrg_rdv4_hardnested_avx512 OBJECT
92             hardnested/hardnested_bf_core.c
93             hardnested/hardnested_bitarray_core.c)
95     target_compile_options(pm3rrg_rdv4_hardnested_avx512 PRIVATE -Wall -O3)
96     target_compile_options(pm3rrg_rdv4_hardnested_avx512 BEFORE PRIVATE
97             -mmmx -msse2 -mavx -mavx2 -mavx512f)
98     set_property(TARGET pm3rrg_rdv4_hardnested_avx512 PROPERTY POSITION_INDEPENDENT_CODE ON)
100     target_include_directories(pm3rrg_rdv4_hardnested_avx512 PRIVATE
101             ../../common
102             ../../include
103             ../src)
105     set(SIMD_TARGETS
106             $<TARGET_OBJECTS:pm3rrg_rdv4_hardnested_mmx>
107             $<TARGET_OBJECTS:pm3rrg_rdv4_hardnested_sse2>
108             $<TARGET_OBJECTS:pm3rrg_rdv4_hardnested_avx>
109             $<TARGET_OBJECTS:pm3rrg_rdv4_hardnested_avx2>
110             $<TARGET_OBJECTS:pm3rrg_rdv4_hardnested_avx512>)
111 elseif ("${CMAKE_SYSTEM_PROCESSOR}" IN_LIST ARM64_CPUS)
112     message(STATUS "Building optimised arm64 binaries")
114     ## arm64 / NEON
115     add_library(pm3rrg_rdv4_hardnested_neon OBJECT
116             hardnested/hardnested_bf_core.c
117             hardnested/hardnested_bitarray_core.c)
119     target_compile_options(pm3rrg_rdv4_hardnested_neon PRIVATE -Wall -O3)
120     set_property(TARGET pm3rrg_rdv4_hardnested_neon PROPERTY POSITION_INDEPENDENT_CODE ON)
122     target_include_directories(pm3rrg_rdv4_hardnested_neon PRIVATE
123             ../../common
124             ../../include
125             ../src)
127     set(SIMD_TARGETS
128             $<TARGET_OBJECTS:pm3rrg_rdv4_hardnested_neon>)
129 elseif ("${CMAKE_SYSTEM_PROCESSOR}" IN_LIST ARM32_CPUS)
130     message(STATUS "Building optimised arm binaries")
132     ## arm64 / NEON
133     add_library(pm3rrg_rdv4_hardnested_neon OBJECT
134             hardnested/hardnested_bf_core.c
135             hardnested/hardnested_bitarray_core.c)
137     target_compile_options(pm3rrg_rdv4_hardnested_neon PRIVATE -Wall -O3)
138     target_compile_options(pm3rrg_rdv4_hardnested_neon BEFORE PRIVATE
139             -mfpu=neon)
140     set_property(TARGET pm3rrg_rdv4_hardnested_neon PROPERTY POSITION_INDEPENDENT_CODE ON)
142     target_include_directories(pm3rrg_rdv4_hardnested_neon PRIVATE
143             ../../common
144             ../../include
145             ../src)
147     set(SIMD_TARGETS
148             $<TARGET_OBJECTS:pm3rrg_rdv4_hardnested_neon>)
149 else ()
150     message(STATUS "Not building optimised targets")
151     set(SIMD_TARGETS)
152 endif ()
154 add_library(pm3rrg_rdv4_hardnested STATIC
155         hardnested/hardnested_bruteforce.c
156         $<TARGET_OBJECTS:pm3rrg_rdv4_hardnested_nosimd>
157         ${SIMD_TARGETS})
158 target_compile_options(pm3rrg_rdv4_hardnested PRIVATE -Wall -O3)
159 set_property(TARGET pm3rrg_rdv4_hardnested PROPERTY POSITION_INDEPENDENT_CODE ON)
160 target_include_directories(pm3rrg_rdv4_hardnested PRIVATE
161         ../../common
162         ../../include
163         ../include
164         ../src
165         jansson)
166 target_include_directories(pm3rrg_rdv4_hardnested INTERFACE hardnested)