Skip to content

Commit

Permalink
Test passing
Browse files Browse the repository at this point in the history
  • Loading branch information
synesthesiam committed Sep 10, 2023
1 parent def047a commit 9f3f906
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 45 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ htmlcov
/dist/
/lib/
/install/
/download/
*.so

.venv/
Expand Down
67 changes: 35 additions & 32 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ elseif(NOT APPLE)
endif()

add_executable(piper src/cpp/main.cpp src/cpp/piper.cpp)
add_executable(test_piper src/cpp/test.cpp src/cpp/piper.cpp)

# NOTE: external project prefix are shortened because of path length restrictions on Windows
# NOTE: onnxruntime is pulled from piper-phonemize

# ---- fmt ---
Expand All @@ -36,6 +38,7 @@ if(NOT DEFINED FMT_DIR)
CMAKE_ARGS -DFMT_TEST:BOOL=OFF # Don't build all the tests
)
add_dependencies(piper fmt_external)
add_dependencies(test_piper fmt_external)
endif()

# ---- spdlog ---
Expand All @@ -50,6 +53,7 @@ if(NOT DEFINED SPDLOG_DIR)
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${SPDLOG_DIR}
)
add_dependencies(piper spdlog_external)
add_dependencies(test_piper spdlog_external)
endif()

# ---- piper-phonemize ---
Expand All @@ -59,10 +63,11 @@ if(NOT DEFINED PIPER_PHONEMIZE_DIR)
ExternalProject_Add(
piper_phonemize_external
PREFIX "${CMAKE_CURRENT_BINARY_DIR}/p"
URL "https://github.com/rhasspy/piper-phonemize/archive/refs/heads/workflow.zip"
URL "https://github.com/rhasspy/piper-phonemize/archive/refs/heads/master.zip"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${PIPER_PHONEMIZE_DIR}
)
add_dependencies(piper piper_phonemize_external)
add_dependencies(test_piper piper_phonemize_external)
endif()

# ---- Declare executable ----
Expand Down Expand Up @@ -100,38 +105,36 @@ target_include_directories(piper PUBLIC
target_compile_definitions(piper PUBLIC _PIPER_VERSION=${piper_version})

# ---- Declare test ----
include(CTest)
enable_testing()
add_test(
NAME test_piper
COMMAND test_piper "${CMAKE_SOURCE_DIR}/etc/test_voice.onnx" "${PIPER_PHONEMIZE_DIR}/share/espeak-ng-data" "${CMAKE_CURRENT_BINARY_DIR}/test.wav"
)

target_compile_features(test_piper PUBLIC cxx_std_17)

target_include_directories(
test_piper PUBLIC
${FMT_DIR}/include
${SPDLOG_DIR}/include
${PIPER_PHONEMIZE_DIR}/include
)

target_link_directories(
test_piper PUBLIC
${FMT_DIR}/lib
${SPDLOG_DIR}/lib
${PIPER_PHONEMIZE_DIR}/lib
)

# include(CTest)
# enable_testing()
# add_executable(test_piper src/cpp/test.cpp src/cpp/piper.cpp)
# add_test(
# NAME test_piper
# COMMAND test_piper "${CMAKE_SOURCE_DIR}/etc/test_voice.onnx" "${PIPER_PHONEMIZE_DIR}/share/espeak-ng-data" "${CMAKE_CURRENT_BINARY_DIR}/test.wav"

# )
# target_compile_features(test_piper PUBLIC cxx_std_17)

# target_include_directories(
# test_piper PUBLIC
# ${FMT_DIR}/include
# ${SPDLOG_DIR}/include
# ${PIPER_PHONEMIZE_DIR}/include
# )

# target_link_directories(
# test_piper PUBLIC
# ${FMT_DIR}/lib
# ${SPDLOG_DIR}/lib
# ${PIPER_PHONEMIZE_DIR}/lib
# )

# target_link_libraries(test_piper PUBLIC
# fmt
# spdlog
# espeak-ng
# piper_phonemize
# onnxruntime
# )
target_link_libraries(test_piper PUBLIC
fmt
spdlog
espeak-ng
piper_phonemize
onnxruntime
)

# ---- Declare install targets ----

Expand Down
20 changes: 7 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
.PHONY: piper clean
.PHONY: clean

LIB_DIR := lib/Linux-$(shell uname -m)
VERSION := $(cat VERSION)
DOCKER_PLATFORM ?= linux/amd64,linux/arm64,linux/arm/v7

piper:
mkdir -p build
cd build && cmake ../src/cpp -DCMAKE_BUILD_TYPE=Release && make
cp -aR $(LIB_DIR)/piper_phonemize/lib/espeak-ng-data $(LIB_DIR)/piper_phonemize/lib/*.so* $(LIB_DIR)/piper_phonemize/etc/* build/
all:
cmake -Bbuild -DCMAKE_INSTALL_PREFIX=install
cmake --build build --config Release
cd build && ctest --config Release
cmake --install build

clean:
rm -rf build/ dist/

docker:
docker buildx build . --platform '$(DOCKER_PLATFORM)' --output 'type=local,dest=dist'
rm -rf build install

0 comments on commit 9f3f906

Please sign in to comment.