ulatekh commited on
Commit
2616a7c
·
unverified ·
1 Parent(s): 3cef7d5

cmake : create solution folders (#2004)

Browse files

* Create solution folders in the CMake build.

* Fixed non-SDL2 build.

* Fixed emscripten build.

CMakeLists.txt CHANGED
@@ -1,5 +1,8 @@
1
  cmake_minimum_required (VERSION 3.5)
2
 
 
 
 
3
  project(whisper.cpp VERSION 1.5.4)
4
  set(SOVERSION 1)
5
 
@@ -561,6 +564,7 @@ if (WHISPER_COREML)
561
  set_target_properties(${TARGET} PROPERTIES
562
  COMPILE_FLAGS "-fobjc-arc"
563
  )
 
564
  endif()
565
 
566
  if (WHISPER_OPENVINO)
@@ -579,6 +583,7 @@ if (WHISPER_OPENVINO)
579
  set(WHISPER_EXTRA_FLAGS ${WHISPER_EXTRA_FLAGS} -DWHISPER_USE_OPENVINO)
580
 
581
  target_link_libraries(${TARGET} PRIVATE openvino::runtime)
 
582
  endif()
583
 
584
  #
@@ -677,6 +682,7 @@ target_compile_definitions(${TARGET} PUBLIC
677
  )
678
 
679
  set_target_properties(${TARGET} PROPERTIES PUBLIC_HEADER "ggml.h;whisper.h")
 
680
 
681
  include(GNUInstallDirs)
682
 
 
1
  cmake_minimum_required (VERSION 3.5)
2
 
3
+ # Allow for the creation of solution folders.
4
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
5
+
6
  project(whisper.cpp VERSION 1.5.4)
7
  set(SOVERSION 1)
8
 
 
564
  set_target_properties(${TARGET} PROPERTIES
565
  COMPILE_FLAGS "-fobjc-arc"
566
  )
567
+ set_target_properties(${TARGET} PROPERTIES FOLDER "libs")
568
  endif()
569
 
570
  if (WHISPER_OPENVINO)
 
583
  set(WHISPER_EXTRA_FLAGS ${WHISPER_EXTRA_FLAGS} -DWHISPER_USE_OPENVINO)
584
 
585
  target_link_libraries(${TARGET} PRIVATE openvino::runtime)
586
+ set_target_properties(${TARGET} PROPERTIES FOLDER "libs")
587
  endif()
588
 
589
  #
 
682
  )
683
 
684
  set_target_properties(${TARGET} PROPERTIES PUBLIC_HEADER "ggml.h;whisper.h")
685
+ set_target_properties(${TARGET} PROPERTIES FOLDER "libs")
686
 
687
  include(GNUInstallDirs)
688
 
examples/CMakeLists.txt CHANGED
@@ -36,6 +36,7 @@ include(DefaultTargetOptions)
36
  target_link_libraries(${TARGET} PRIVATE whisper)
37
 
38
  set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON)
 
39
 
40
  if (WHISPER_SDL2)
41
  # common-sdl
@@ -53,10 +54,12 @@ if (WHISPER_SDL2)
53
  target_link_libraries(${TARGET} PRIVATE ${SDL2_LIBRARIES})
54
 
55
  set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON)
 
56
  endif()
57
 
58
  # add json lib
59
  add_library(json_cpp INTERFACE json.hpp)
 
60
 
61
  # examples
62
 
@@ -64,25 +67,50 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
64
 
65
  if (EMSCRIPTEN)
66
  add_subdirectory(whisper.wasm)
 
67
  add_subdirectory(stream.wasm)
 
68
  add_subdirectory(command.wasm)
 
69
  add_subdirectory(talk.wasm)
 
70
  add_subdirectory(bench.wasm)
 
71
  elseif(CMAKE_JS_VERSION)
72
  add_subdirectory(addon.node)
 
73
  else()
74
  add_subdirectory(main)
 
 
75
  add_subdirectory(stream)
 
 
76
  add_subdirectory(server)
 
 
77
  add_subdirectory(command)
 
 
78
  add_subdirectory(bench)
 
79
  add_subdirectory(quantize)
 
 
80
  add_subdirectory(talk)
 
81
  add_subdirectory(talk-llama)
 
82
  add_subdirectory(lsp)
 
83
  if (LLAMA_SYCL)
84
  add_subdirectory(sycl)
 
85
  endif()
 
86
  endif()
87
 
88
- add_subdirectory(wchess)
 
 
 
 
36
  target_link_libraries(${TARGET} PRIVATE whisper)
37
 
38
  set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON)
39
+ set_target_properties(${TARGET} PROPERTIES FOLDER "libs")
40
 
41
  if (WHISPER_SDL2)
42
  # common-sdl
 
54
  target_link_libraries(${TARGET} PRIVATE ${SDL2_LIBRARIES})
55
 
56
  set_target_properties(${TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON)
57
+ set_target_properties(${TARGET} PROPERTIES FOLDER "libs")
58
  endif()
59
 
60
  # add json lib
61
  add_library(json_cpp INTERFACE json.hpp)
62
+ set_target_properties(json_cpp PROPERTIES FOLDER "libs")
63
 
64
  # examples
65
 
 
67
 
68
  if (EMSCRIPTEN)
69
  add_subdirectory(whisper.wasm)
70
+ set_target_properties(libmain PROPERTIES FOLDER "libs")
71
  add_subdirectory(stream.wasm)
72
+ set_target_properties(libstream PROPERTIES FOLDER "libs")
73
  add_subdirectory(command.wasm)
74
+ set_target_properties(libcommand PROPERTIES FOLDER "libs")
75
  add_subdirectory(talk.wasm)
76
+ set_target_properties(libtalk PROPERTIES FOLDER "libs")
77
  add_subdirectory(bench.wasm)
78
+ set_target_properties(libbench PROPERTIES FOLDER "libs")
79
  elseif(CMAKE_JS_VERSION)
80
  add_subdirectory(addon.node)
81
+ set_target_properties(addon.node PROPERTIES FOLDER "examples")
82
  else()
83
  add_subdirectory(main)
84
+ set_target_properties(main PROPERTIES FOLDER "examples")
85
+ if (WHISPER_SDL2)
86
  add_subdirectory(stream)
87
+ set_target_properties(stream PROPERTIES FOLDER "examples")
88
+ endif (WHISPER_SDL2)
89
  add_subdirectory(server)
90
+ set_target_properties(server PROPERTIES FOLDER "examples")
91
+ if (WHISPER_SDL2)
92
  add_subdirectory(command)
93
+ set_target_properties(command PROPERTIES FOLDER "examples")
94
+ endif (WHISPER_SDL2)
95
  add_subdirectory(bench)
96
+ set_target_properties(bench PROPERTIES FOLDER "examples")
97
  add_subdirectory(quantize)
98
+ set_target_properties(quantize PROPERTIES FOLDER "examples")
99
+ if (WHISPER_SDL2)
100
  add_subdirectory(talk)
101
+ set_target_properties(talk PROPERTIES FOLDER "examples")
102
  add_subdirectory(talk-llama)
103
+ set_target_properties(talk-llama PROPERTIES FOLDER "examples")
104
  add_subdirectory(lsp)
105
+ set_target_properties(lsp PROPERTIES FOLDER "examples")
106
  if (LLAMA_SYCL)
107
  add_subdirectory(sycl)
108
+ set_target_properties(sycl PROPERTIES FOLDER "examples")
109
  endif()
110
+ endif (WHISPER_SDL2)
111
  endif()
112
 
113
+ if (WHISPER_SDL2)
114
+ add_subdirectory(wchess)
115
+ set_target_properties(wchess PROPERTIES FOLDER "examples")
116
+ endif (WHISPER_SDL2)
examples/wchess/CMakeLists.txt CHANGED
@@ -1,7 +1,10 @@
1
  add_subdirectory(libwchess)
 
2
 
3
  if (EMSCRIPTEN)
4
  add_subdirectory(wchess.wasm)
 
5
  else()
6
  add_subdirectory(wchess.cmd)
 
7
  endif()
 
1
  add_subdirectory(libwchess)
2
+ set_target_properties(wchess-core PROPERTIES FOLDER "libs")
3
 
4
  if (EMSCRIPTEN)
5
  add_subdirectory(wchess.wasm)
6
+ set_target_properties(wchess.wasm PROPERTIES FOLDER "libs")
7
  else()
8
  add_subdirectory(wchess.cmd)
9
+ set_target_properties(wchess PROPERTIES FOLDER "libs")
10
  endif()