Skip to content

Commit df22522

Browse files
committed
cmake: fix cpu flags autodiscovery and terminal for raspberry
- we set cpu flags for CXX and C - raspberry "only" has lxterminal not xterm
1 parent a1c16a6 commit df22522

File tree

3 files changed

+130
-105
lines changed

3 files changed

+130
-105
lines changed

CMakeLists.txt

+9-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@ set(COPYRIGHT "Copyright (c) 2019 John Langner, WB2OSZ. All rights reserved.")
3434
add_definitions("-DCOPYRIGHT=\"${COPYRIGHT}\"")
3535
set(IDENTIFIER "com.${COMPANY}.${APPLICATION_NAME}")
3636
add_definitions("-DIDENTIFIER=\"${IDENTIFIER}\"")
37-
set(APPLICATION_DESKTOP_EXEC "xterm -e ${CMAKE_PROJECT_NAME}")
37+
# raspberry as only lxterminal not xterm
38+
if(NOT WIN32)
39+
find_program(BINARY_TERMINAL_BIN lxterminal)
40+
if(BINARY_TERMINAL_BIN)
41+
set(APPLICATION_DESKTOP_EXEC "${BINARY_TERMINAL_BIN} -e ${CMAKE_PROJECT_NAME}")
42+
else()
43+
set(APPLICATION_DESKTOP_EXEC "xterm -e ${CMAKE_PROJECT_NAME}")
44+
endif()
45+
endif()
3846

3947
find_package(Git)
4048
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git/")

cmake/modules/FindCPUflags.cmake

+120-103
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,14 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86" AND (FORCE_SSE OR FORCE_SSSE3 OR FORCE_
5353
if (FORCE_SSE)
5454
set(HAS_SSE ON CACHE BOOL "SSE SIMD enabled")
5555
if(C_GCC OR C_CLANG)
56+
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse" )
5657
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse" )
5758
message(STATUS "Use SSE SIMD instructions")
5859
add_definitions(-DUSE_SSE)
5960
elseif(C_MSVC)
60-
#set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE" )
61-
#set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE" )
61+
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:SSE" )
62+
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE" )
63+
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
6264
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
6365
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
6466
message(STATUS "Use MSVC SSSE3 SIMD instructions")
@@ -68,101 +70,109 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86" AND (FORCE_SSE OR FORCE_SSSE3 OR FORCE_
6870
elseif (FORCE_SSSE3)
6971
set(HAS_SSSE3 ON CACHE BOOL "SSSE3 SIMD enabled")
7072
if(C_GCC OR C_CLANG)
71-
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3" )
72-
message(STATUS "Use SSSE3 SIMD instructions")
73-
add_definitions(-DUSE_SSSE3)
74-
elseif(C_MSVC)
75-
#set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSSE3" )
76-
#set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSSE3" )
77-
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
78-
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
79-
message(STATUS "Use MSVC SSSE3 SIMD instructions")
80-
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
81-
add_definitions(-DUSE_SSSE3)
82-
endif()
83-
elseif (FORCE_SSE41)
84-
set(HAS_SSSE3 ON CACHE BOOL "SSSE3 SIMD enabled")
85-
set(HAS_SSE4_1 ON CACHE BOOL "Architecture has SSE 4.1 SIMD enabled")
86-
if(C_GCC OR C_CLANG)
87-
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse4.1" )
88-
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -msse4.1" )
89-
message(STATUS "Use SSE 4.1 SIMD instructions")
90-
add_definitions(-DUSE_SSSE3)
91-
add_definitions(-DUSE_SSE4_1)
92-
elseif(C_MSVC)
93-
# seems that from MSVC 2015 comiler doesn't support those flags
94-
#set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE4_1" )
95-
#set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE4_1" )
96-
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
97-
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
98-
message(STATUS "Use SSE 4.1 SIMD instructions")
99-
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
100-
add_definitions(-DUSE_SSSE3)
101-
add_definitions(-DUSE_SSE4_1)
102-
endif()
73+
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mssse3" )
74+
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3" )
75+
message(STATUS "Use SSSE3 SIMD instructions")
76+
add_definitions(-DUSE_SSSE3)
77+
elseif(C_MSVC)
78+
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:SSSE3" )
79+
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSSE3" )
80+
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
81+
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
82+
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
83+
message(STATUS "Use MSVC SSSE3 SIMD instructions")
84+
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
85+
add_definitions(-DUSE_SSSE3)
86+
endif()
87+
elseif (FORCE_SSE41)
88+
set(HAS_SSSE3 ON CACHE BOOL "SSSE3 SIMD enabled")
89+
set(HAS_SSE4_1 ON CACHE BOOL "Architecture has SSE 4.1 SIMD enabled")
90+
if(C_GCC OR C_CLANG)
91+
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1" )
92+
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1" )
93+
message(STATUS "Use SSE 4.1 SIMD instructions")
94+
add_definitions(-DUSE_SSSE3)
95+
add_definitions(-DUSE_SSE4_1)
96+
elseif(C_MSVC)
97+
# seems that from MSVC 2015 comiler doesn't support those flags
98+
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:SSE4_1" )
99+
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE4_1" )
100+
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
101+
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
102+
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
103+
message(STATUS "Use SSE 4.1 SIMD instructions")
104+
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
105+
add_definitions(-DUSE_SSSE3)
106+
add_definitions(-DUSE_SSE4_1)
103107
endif()
108+
endif()
104109
else ()
105-
if (${ARCHITECTURE} MATCHES "x86_64|x86")
110+
if (${ARCHITECTURE} MATCHES "x86_64|x86")
106111
if(C_MSVC)
107-
try_run(RUN_SSE2 COMPILE_SSE2 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse2.cxx" COMPILE_DEFINITIONS /O0)
112+
try_run(RUN_SSE2 COMPILE_SSE2 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse2.cxx" COMPILE_DEFINITIONS /O0)
108113
else()
109-
try_run(RUN_SSE2 COMPILE_SSE2 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse2.cxx" COMPILE_DEFINITIONS -msse2 -O0)
114+
try_run(RUN_SSE2 COMPILE_SSE2 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse2.cxx" COMPILE_DEFINITIONS -msse2 -O0)
110115
endif()
111116
if(COMPILE_SSE2 AND RUN_SSE2 EQUAL 0)
112-
set(HAS_SSE2 ON CACHE BOOL "Architecture has SSSE2 SIMD enabled")
113-
message(STATUS "Use SSE2 SIMD instructions")
114-
if(C_GCC OR C_CLANG)
115-
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2" )
116-
add_definitions(-DUSE_SSE2)
117-
elseif(C_MSVC)
118-
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE2" )
119-
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE2" )
120-
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
121-
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
122-
add_definitions(-DUSE_SSE2)
123-
endif()
117+
set(HAS_SSE2 ON CACHE BOOL "Architecture has SSSE2 SIMD enabled")
118+
message(STATUS "Use SSE2 SIMD instructions")
119+
if(C_GCC OR C_CLANG)
120+
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2" )
121+
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2" )
122+
add_definitions(-DUSE_SSE2)
123+
elseif(C_MSVC)
124+
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:SSE2" )
125+
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE2" )
126+
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE2" )
127+
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE2" )
128+
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
129+
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
130+
add_definitions(-DUSE_SSE2)
131+
endif()
124132
else()
125-
set(HAS_SSE2 OFF CACHE BOOL "Architecture does not have SSSE2 SIMD enabled")
133+
set(HAS_SSE2 OFF CACHE BOOL "Architecture does not have SSSE2 SIMD enabled")
126134
endif()
127135
if(C_MSVC)
128-
try_run(RUN_SSSE3 COMPILE_SSSE3 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_ssse3.cxx" COMPILE_DEFINITIONS /O0)
136+
try_run(RUN_SSSE3 COMPILE_SSSE3 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_ssse3.cxx" COMPILE_DEFINITIONS /O0)
129137
else()
130-
try_run(RUN_SSSE3 COMPILE_SSSE3 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_ssse3.cxx" COMPILE_DEFINITIONS -mssse3 -O0)
138+
try_run(RUN_SSSE3 COMPILE_SSSE3 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_ssse3.cxx" COMPILE_DEFINITIONS -mssse3 -O0)
131139
endif()
132140
if(COMPILE_SSSE3 AND RUN_SSSE3 EQUAL 0)
133-
set(HAS_SSSE3 ON CACHE BOOL "Architecture has SSSE3 SIMD enabled")
134-
message(STATUS "Use SSSE3 SIMD instructions")
135-
if(C_GCC OR C_CLANG)
136-
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3" )
137-
add_definitions(-DUSE_SSSE3)
141+
set(HAS_SSSE3 ON CACHE BOOL "Architecture has SSSE3 SIMD enabled")
142+
message(STATUS "Use SSSE3 SIMD instructions")
143+
if(C_GCC OR C_CLANG)
144+
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mssse3" )
145+
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3" )
146+
add_definitions(-DUSE_SSSE3)
138147
elseif(C_MSVC)
139-
# seems not present on MSVC 2017
140-
#set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSSE3" )
141-
#set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSSE3" )
142-
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
143-
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
144-
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
145-
add_definitions(-DUSE_SSSE3)
148+
# seems not present on MSVC 2017
149+
#set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSSE3" )
150+
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
151+
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
152+
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
153+
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
154+
add_definitions(-DUSE_SSSE3)
155+
endif()
156+
else()
157+
set(HAS_SSSE3 OFF CACHE BOOL "Architecture does not have SSSE3 SIMD enabled")
146158
endif()
147-
else()
148-
set(HAS_SSSE3 OFF CACHE BOOL "Architecture does not have SSSE3 SIMD enabled")
149-
endif()
150-
if(C_MSVC)
151-
try_run(RUN_SSE4_1 COMPILE_SSE4_1 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse41.cxx" COMPILE_DEFINITIONS /O0)
152-
else()
159+
if(C_MSVC)
160+
try_run(RUN_SSE4_1 COMPILE_SSE4_1 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse41.cxx" COMPILE_DEFINITIONS /O0)
161+
else()
153162
try_run(RUN_SSE4_1 COMPILE_SSE4_1 "${CMAKE_BINARY_DIR}/tmp" "${TEST_DIR}/test_x86_sse41.cxx" COMPILE_DEFINITIONS -msse4.1 -O0)
154163
endif()
155164
if(COMPILE_SSE4_1 AND RUN_SSE4_1 EQUAL 0)
156-
set(HAS_SSE4_1 ON CACHE BOOL "Architecture has SSE 4.1 SIMD enabled")
157-
message(STATUS "Use SSE 4.1 SIMD instructions")
158-
if(C_GCC OR C_CLANG)
159-
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse4.1" )
160-
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -msse4.1" )
161-
add_definitions(-DUSE_SSE4_1)
165+
set(HAS_SSE4_1 ON CACHE BOOL "Architecture has SSE 4.1 SIMD enabled")
166+
message(STATUS "Use SSE 4.1 SIMD instructions")
167+
if(C_GCC OR C_CLANG)
168+
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1" )
169+
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1" )
170+
add_definitions(-DUSE_SSE4_1)
162171
elseif(C_MSVC)
163172
# seems not present on MSVC 2017
164173
#set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE4_1" )
165174
#set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE4_1" )
175+
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
166176
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
167177
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
168178
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
@@ -180,14 +190,15 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86")
180190
set(HAS_SSE4_2 ON CACHE BOOL "Architecture has SSE 4.2 SIMD enabled")
181191
message(STATUS "Use SSE 4.2 SIMD instructions")
182192
if(C_GCC OR C_CLANG)
183-
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -msse4.2" )
184-
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -msse4.2" )
193+
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.2" )
194+
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2" )
185195
add_definitions(-DUSE_SSE4_2)
186196
elseif(C_MSVC)
187197
# seems not present on MSVC 2017
188198
#set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:SSE4_2" )
189199
#set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:SSE4_2" )
190-
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
200+
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
201+
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox" )
191202
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
192203
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
193204
add_definitions(-DUSE_SSE4_2)
@@ -204,15 +215,17 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86")
204215
set(HAS_AVX ON CACHE BOOL "Architecture has AVX SIMD enabled")
205216
message(STATUS "Use AVX SIMD instructions")
206217
if(C_GCC OR C_CLANG)
207-
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mavx" )
208-
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mavx" )
218+
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx" )
219+
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx" )
209220
add_definitions(-DUSE_AVX)
210221
elseif(C_MSVC)
211-
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX" )
212-
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX" )
213-
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
214-
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
215-
add_definitions(-DUSE_AVX)
222+
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:AVX" )
223+
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX" )
224+
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX" )
225+
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX" )
226+
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
227+
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
228+
add_definitions(-DUSE_AVX)
216229
endif()
217230
else()
218231
set(HAS_AVX OFF CACHE BOOL "Architecture does not have AVX SIMD enabled")
@@ -226,15 +239,17 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86")
226239
set(HAS_AVX2 ON CACHE BOOL "Architecture has AVX2 SIMD enabled")
227240
message(STATUS "Use AVX2 SIMD instructions")
228241
if(C_GCC OR C_CLANG)
229-
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mavx2" )
230-
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mavx2" )
231-
add_definitions(-DUSE_AVX2)
232-
elseif(C_MSVC)
233-
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX2" )
234-
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX2" )
235-
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
236-
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
242+
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx2" )
243+
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2" )
237244
add_definitions(-DUSE_AVX2)
245+
elseif(C_MSVC)
246+
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:AVX2" )
247+
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX2" )
248+
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX2" )
249+
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX2" )
250+
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
251+
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
252+
add_definitions(-DUSE_AVX2)
238253
endif()
239254
else()
240255
set(HAS_AVX2 OFF CACHE BOOL "Architecture does not have AVX2 SIMD enabled")
@@ -248,15 +263,17 @@ if (${ARCHITECTURE} MATCHES "x86_64|x86")
248263
set(HAS_AVX512 ON CACHE BOOL "Architecture has AVX512 SIMD enabled")
249264
message(STATUS "Use AVX512 SIMD instructions")
250265
if(C_GCC OR C_CLANG)
251-
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mavx512f" )
252-
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mavx512f" )
266+
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx512f" )
267+
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512f" )
253268
add_definitions(-DUSE_AVX512)
254269
elseif(C_MSVC)
255-
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX512" )
256-
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX512" )
257-
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
258-
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
259-
add_definitions(-DUSE_AVX512)
270+
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:AVX512" )
271+
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX512" )
272+
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX512" )
273+
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL /Ot /Ox /arch:AVX512" )
274+
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG" )
275+
add_definitions (/D "_CRT_SECURE_NO_WARNINGS")
276+
add_definitions(-DUSE_AVX512)
260277
endif()
261278
else()
262279
set(HAS_AVX512 OFF CACHE BOOL "Architecture does not have AVX512 SIMD enabled")
@@ -271,8 +288,8 @@ elseif(ARCHITECTURE_ARM)
271288
set(HAS_NEON ON CACHE BOOL "Architecture has NEON SIMD enabled")
272289
message(STATUS "Use NEON SIMD instructions")
273290
if(C_GCC OR C_CLANG)
274-
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mfpu=neon" )
275-
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -mfpu=neon" )
291+
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon" )
292+
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon" )
276293
add_definitions(-DUSE_NEON)
277294
endif()
278295
else()

conf/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ add_custom_target(install-conf-conf
4242
COMMAND ${CMAKE_COMMAND} -E copy "${CUSTOM_CONF_DIR}/sdr.conf" ~
4343
)
4444

45-
if(LINUX)
45+
if(NOT WIN32)
4646
add_custom_target(install-conf)
4747
add_dependencies(install-conf install-conf-conf install-conf-scripts install-conf-telemetry)
4848
endif()

0 commit comments

Comments
 (0)