ggerganov commited on
Commit
53613f1
·
unverified ·
1 Parent(s): 84b7b50

CMake support for Accelerate framework

Browse files
Files changed (1) hide show
  1. CMakeLists.txt +20 -4
CMakeLists.txt CHANGED
@@ -13,17 +13,20 @@ endif()
13
 
14
  # options
15
 
16
- option(WHISPER_ALL_WARNINGS "whisper: enable all compiler warnings" ON)
17
  option(WHISPER_ALL_WARNINGS_3RD_PARTY "whisper: enable all compiler warnings in 3rd party libs" OFF)
18
 
19
- option(WHISPER_SANITIZE_THREAD "whisper: enable thread sanitizer" OFF)
20
- option(WHISPER_SANITIZE_ADDRESS "whisper: enable address sanitizer" OFF)
21
  option(WHISPER_SANITIZE_UNDEFINED "whisper: enable undefined sanitizer" OFF)
22
 
23
  option(WHISPER_BUILD_TESTS "whisper: build tests" ${WHISPER_STANDALONE})
24
 
25
  option(WHISPER_SUPPORT_SDL2 "whisper: support for libSDL2" OFF)
26
 
 
 
 
27
  # sanitizers
28
 
29
  if (NOT MSVC)
@@ -53,6 +56,19 @@ set(CMAKE_CXX_STANDARD 20)
53
 
54
  find_package(Threads REQUIRED)
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  if (WHISPER_SUPPORT_SDL2)
57
  # SDL2
58
  find_package(SDL2 REQUIRED)
@@ -117,7 +133,7 @@ target_include_directories(${TARGET} PUBLIC
117
  .
118
  )
119
 
120
- target_link_libraries(${TARGET} PRIVATE ${CMAKE_THREAD_LIBS_INIT})
121
 
122
  if (BUILD_SHARED_LIBS)
123
  target_link_libraries(${TARGET} PUBLIC
 
13
 
14
  # options
15
 
16
+ option(WHISPER_ALL_WARNINGS "whisper: enable all compiler warnings" ON)
17
  option(WHISPER_ALL_WARNINGS_3RD_PARTY "whisper: enable all compiler warnings in 3rd party libs" OFF)
18
 
19
+ option(WHISPER_SANITIZE_THREAD "whisper: enable thread sanitizer" OFF)
20
+ option(WHISPER_SANITIZE_ADDRESS "whisper: enable address sanitizer" OFF)
21
  option(WHISPER_SANITIZE_UNDEFINED "whisper: enable undefined sanitizer" OFF)
22
 
23
  option(WHISPER_BUILD_TESTS "whisper: build tests" ${WHISPER_STANDALONE})
24
 
25
  option(WHISPER_SUPPORT_SDL2 "whisper: support for libSDL2" OFF)
26
 
27
+ option(WHISPER_PERF "whisper: enable perf timings" OFF)
28
+ option(WHISPER_NO_ACCELERATE "whisper: disable Accelerate framework" OFF)
29
+
30
  # sanitizers
31
 
32
  if (NOT MSVC)
 
56
 
57
  find_package(Threads REQUIRED)
58
 
59
+ # on APPLE - include Accelerate framework
60
+ if (APPLE AND NOT WHISPER_NO_ACCELERATE)
61
+ find_library(ACCELERATE_FRAMEWORK Accelerate)
62
+ if (ACCELERATE_FRAMEWORK)
63
+ message(STATUS "Accelerate framework found")
64
+
65
+ set(WHISPER_EXTRA_LIBS ${WHISPER_EXTRA_LIBS} ${ACCELERATE_FRAMEWORK})
66
+ set(WHISPER_EXTRA_FLAGS ${WHISPER_EXTRA_FLAGS} -DGGML_USE_ACCELERATE)
67
+ else()
68
+ message(WARNING "Accelerate framework not found")
69
+ endif()
70
+ endif()
71
+
72
  if (WHISPER_SUPPORT_SDL2)
73
  # SDL2
74
  find_package(SDL2 REQUIRED)
 
133
  .
134
  )
135
 
136
+ target_link_libraries(${TARGET} PRIVATE m ${WHISPER_EXTRA_LIBS} ${CMAKE_THREAD_LIBS_INIT})
137
 
138
  if (BUILD_SHARED_LIBS)
139
  target_link_libraries(${TARGET} PUBLIC