]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
cmake : fixes
authorGeorgi Gerganov <redacted>
Fri, 7 Oct 2022 21:21:16 +0000 (00:21 +0300)
committerGeorgi Gerganov <redacted>
Sat, 8 Oct 2022 06:02:41 +0000 (09:02 +0300)
CMakeLists.txt

index e45c4c3955bf81b9e7d3a1a4e4de95ae815b45d8..7f238aca32a8d48dd2c28a8879ec2df8f6b16bd0 100644 (file)
@@ -101,39 +101,12 @@ else()
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx -mavx2 -mfma -mf16c")
 endif()
 
-# ggml
-
-set(TARGET ggml)
-
-add_library(${TARGET} STATIC
-    ggml.c
-    )
-
-target_include_directories(${TARGET} PUBLIC
-    .
-    )
-
-target_link_libraries(${TARGET} PRIVATE m ${CMAKE_THREAD_LIBS_INIT})
-
-if (BUILD_SHARED_LIBS)
-    target_link_libraries(${TARGET} PUBLIC
-        ${CMAKE_DL_LIBS}
-        )
-
-    target_compile_definitions(${TARGET} PUBLIC
-        WHISPER_SHARED
-        )
-endif()
-
-target_compile_definitions(${TARGET} PUBLIC
-    ${WHISPER_EXTRA_FLAGS}
-    )
-
 # whisper
 
 set(TARGET whisper)
 
 add_library(${TARGET} SHARED
+    ggml.c
     whisper.cpp
     )
 
@@ -141,7 +114,7 @@ target_include_directories(${TARGET} PUBLIC
     .
     )
 
-target_link_libraries(${TARGET} PRIVATE ggml ${CMALE_THREAD_LIBS_INIT})
+target_link_libraries(${TARGET} PRIVATE ${CMAKE_THREAD_LIBS_INIT})
 
 if (BUILD_SHARED_LIBS)
     target_link_libraries(${TARGET} PUBLIC
@@ -162,27 +135,22 @@ install(TARGETS ${TARGET}
     ARCHIVE DESTINATION lib/static
     )
 
-# main
-
-set(TARGET main)
-
-add_executable(${TARGET} main.cpp)
-
-target_link_libraries(${TARGET} PRIVATE whisper)
-
-# stream
-
-set(TARGET stream)
-
-add_executable(${TARGET} stream.cpp)
-
-target_include_directories(${TARGET} PRIVATE ${SDL2_INCLUDE_DIRS})
-
-target_link_libraries(${TARGET} PRIVATE whisper ${SDL2_LIBRARIES})
-
-# tests
-
-if (WHISPER_BUILD_TESTS)
-    enable_testing()
-    add_subdirectory(tests)
+if (WHISPER_STANDALONE)
+    # main
+    set(TARGET main)
+    add_executable(${TARGET} main.cpp)
+    target_link_libraries(${TARGET} PRIVATE whisper ${CMAKE_THREAD_LIBS_INIT})
+
+    if (WHISPER_SUPPORT_SDL2)
+        # stream
+        set(TARGET stream)
+        add_executable(${TARGET} stream.cpp)
+        target_include_directories(${TARGET} PRIVATE ${SDL2_INCLUDE_DIRS})
+        target_link_libraries(${TARGET} PRIVATE whisper ${SDL2_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
+    endif ()
+
+    if (WHISPER_BUILD_TESTS)
+        enable_testing()
+        add_subdirectory(tests)
+    endif ()
 endif ()