46 lines
1.7 KiB
CMake
46 lines
1.7 KiB
CMake
cmake_minimum_required(VERSION 3.15)
|
|
project(sherpa_server LANGUAGES CXX)
|
|
|
|
# 64-bit helper. Must match sherpa-onnx DLL bitness (shipped x64). Runs as a
|
|
# separate process from the 32-bit FNV plugin, so mismatched bitness is fine.
|
|
if(MSVC AND NOT DEFINED CMAKE_GENERATOR_PLATFORM)
|
|
message(FATAL_ERROR
|
|
"Configure with -A x64 — sherpa_server must be 64-bit "
|
|
"to match the shipped sherpa-onnx DLLs.")
|
|
endif()
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
get_filename_component(_default_sherpa_dir
|
|
"${CMAKE_CURRENT_LIST_DIR}/../../third-party/sherpa-onnx" ABSOLUTE)
|
|
set(SHERPA_DIR
|
|
"${_default_sherpa_dir}"
|
|
CACHE PATH "Path to the sherpa-onnx SDK (must have include/ and lib/)")
|
|
|
|
if(NOT EXISTS "${SHERPA_DIR}/include/sherpa-onnx/c-api/c-api.h")
|
|
message(FATAL_ERROR
|
|
"sherpa-onnx headers not found under ${SHERPA_DIR}. "
|
|
"Run 'bash mod/install-sherpa-onnx.sh' to stage the SDK, or "
|
|
"point -DSHERPA_DIR at the folder containing include/ and lib/.")
|
|
endif()
|
|
|
|
add_executable(sherpa_server main.cpp tray_icon_win32.cpp)
|
|
|
|
target_include_directories(sherpa_server PRIVATE "${SHERPA_DIR}/include")
|
|
target_link_directories(sherpa_server PRIVATE "${SHERPA_DIR}/lib")
|
|
target_link_libraries(sherpa_server PRIVATE sherpa-onnx-c-api)
|
|
|
|
if(MSVC)
|
|
target_compile_options(sherpa_server PRIVATE /O2 /W3 /D_CRT_SECURE_NO_WARNINGS)
|
|
set_property(TARGET sherpa_server PROPERTY
|
|
MSVC_RUNTIME_LIBRARY "MultiThreaded")
|
|
set_target_properties(sherpa_server PROPERTIES
|
|
LINK_FLAGS "/SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup")
|
|
endif()
|
|
|
|
set_target_properties(sherpa_server PROPERTIES
|
|
OUTPUT_NAME "sherpa_server"
|
|
SUFFIX ".exe"
|
|
)
|