tiny-voca-hindi / cpp /CMakeLists.txt
RL10x's picture
Add inference code (Python + C++ engine + web page)
ab1b068 verified
Raw History Blame Contribute Delete
1.96 kB
cmake_minimum_required(VERSION 3.14)
project(tiny_voca_hindi C CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
# ggml v0.29.0 (the version the engine was written and checked against): static, CPU only, tuned for this machine
include(FetchContent)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
set(GGML_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GGML_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(GGML_NATIVE ON CACHE BOOL "" FORCE)
FetchContent_Declare(ggml GIT_REPOSITORY https://github.com/ggml-org/ggml.git GIT_TAG v0.29.0 GIT_SHALLOW TRUE)
FetchContent_MakeAvailable(ggml)
add_library(tts_engine STATIC src/tts.cpp src/synth.cpp src/g2p.cpp)
target_include_directories(tts_engine PUBLIC src)
target_link_libraries(tts_engine PUBLIC ggml)
# tts_hi: command line (--text) and a small web server (--serve) for the page in ../web
add_executable(tts_hi src/main.cpp)
target_include_directories(tts_hi PRIVATE third_party)
target_link_libraries(tts_hi PRIVATE tts_engine)
# tts_check: compare the engine with PyTorch reference dumps (../scripts/reference.py)
add_executable(tts_check tools/check.cpp)
target_link_libraries(tts_check PRIVATE tts_engine)
# tts_g2p_dump: the engine's phonemizer output, for comparing with the Python one
add_executable(tts_g2p_dump tools/g2p_dump.cpp)
target_link_libraries(tts_g2p_dump PRIVATE tts_engine)
if (WIN32)
target_compile_definitions(tts_hi PRIVATE _WIN32_WINNT=0x0A00 NOMINMAX)
target_link_libraries(tts_hi PRIVATE ws2_32 psapi shell32)
target_link_libraries(tts_check PRIVATE psapi)
else()
find_package(Threads REQUIRED)
target_link_libraries(tts_hi PRIVATE Threads::Threads)
endif()
if (MSVC)
target_compile_options(tts_hi PRIVATE /utf-8 /bigobj)
target_compile_options(tts_engine PRIVATE /utf-8 /W3)
target_compile_options(tts_check PRIVATE /utf-8)
target_compile_options(tts_g2p_dump PRIVATE /utf-8)
endif()