-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
56 lines (44 loc) · 1.64 KB
/
Copy pathCMakeLists.txt
File metadata and controls
56 lines (44 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
cmake_minimum_required(VERSION 3.14)
project("pocket_tts" C CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(MSVC)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(POCKET_TTS_STANDALONE ON)
# configure project version
# TODO
else()
set(POCKET_TTS_STANDALONE OFF)
endif()
include_directories(include)
function(setup_rpath target)
if (APPLE)
# On macOS, set RPATH to look in the same directory as the executable
set_target_properties(${target} PROPERTIES
INSTALL_RPATH "@executable_path"
BUILD_WITH_INSTALL_RPATH TRUE
)
else()
# On Linux, set RPATH to look in the same directory as the executable
set_target_properties(${target} PROPERTIES
INSTALL_RPATH "$ORIGIN"
BUILD_WITH_INSTALL_RPATH TRUE
)
endif()
endfunction()
find_package(Threads REQUIRED)
find_package(GGML REQUIRED)
find_package(SentencePiece REQUIRED)
option(POCKET_TTS_BUILD_DEMOS "pocket-tts: build demos" ${POCKET_TTS_STANDALONE})
add_library(pocket_tts SHARED src/pocket_tts.cpp src/json.cpp src/safetensor.cpp)
target_link_libraries(pocket_tts PRIVATE ${GGML_LIBRARIES} ${SentencePiece_LIBRARIES})
target_include_directories(pocket_tts PRIVATE ${GGML_INCLUDE_DIRS} ${SentencePiece_INCLUDE_DIRS})
setup_rpath(pocket_tts)
if (POCKET_TTS_BUILD_DEMOS)
add_subdirectory(demos)
endif ()