Mikhail Grigorev commited on
Commit
8a29c9d
·
1 Parent(s): b1dfc60

Fixed compile definitions and link libraries for MSVC

Browse files
Files changed (1) hide show
  1. CMakeLists.txt +11 -2
CMakeLists.txt CHANGED
@@ -121,7 +121,8 @@ if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES
121
  else()
122
  message(STATUS "x86 detected")
123
  if (MSVC)
124
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:AVX2 /D_CRT_SECURE_NO_WARNINGS=1")
 
125
  else()
126
  if (EMSCRIPTEN)
127
  # we require support for WASM SIMD 128-bit
@@ -148,7 +149,11 @@ target_include_directories(${TARGET} PUBLIC
148
  .
149
  )
150
 
151
- target_link_libraries(${TARGET} PRIVATE m ${WHISPER_EXTRA_LIBS} ${CMAKE_THREAD_LIBS_INIT})
 
 
 
 
152
 
153
  if (BUILD_SHARED_LIBS)
154
  target_link_libraries(${TARGET} PUBLIC
@@ -158,6 +163,10 @@ if (BUILD_SHARED_LIBS)
158
  target_compile_definitions(${TARGET} PUBLIC
159
  WHISPER_SHARED
160
  )
 
 
 
 
161
  endif()
162
 
163
  target_compile_definitions(${TARGET} PUBLIC
 
121
  else()
122
  message(STATUS "x86 detected")
123
  if (MSVC)
124
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:AVX2")
125
+ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /arch:AVX2")
126
  else()
127
  if (EMSCRIPTEN)
128
  # we require support for WASM SIMD 128-bit
 
149
  .
150
  )
151
 
152
+ if (MSVC)
153
+ target_link_libraries(${TARGET} PRIVATE ${WHISPER_EXTRA_LIBS} ${CMAKE_THREAD_LIBS_INIT})
154
+ else()
155
+ target_link_libraries(${TARGET} PRIVATE m ${WHISPER_EXTRA_LIBS} ${CMAKE_THREAD_LIBS_INIT})
156
+ endif()
157
 
158
  if (BUILD_SHARED_LIBS)
159
  target_link_libraries(${TARGET} PUBLIC
 
163
  target_compile_definitions(${TARGET} PUBLIC
164
  WHISPER_SHARED
165
  )
166
+
167
+ if (MSVC)
168
+ target_compile_definitions(${TARGET} PUBLIC __AVX2__ _CRT_SECURE_NO_WARNINGS)
169
+ endif()
170
  endif()
171
 
172
  target_compile_definitions(${TARGET} PUBLIC