Skip to content

Commit

Permalink
Pick up env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
jmfrank63 committed Feb 4, 2024
1 parent 516f965 commit e52d607
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
23 changes: 20 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.13)
cmake_policy(SET CMP0135 NEW)

project(piper C CXX)

Expand All @@ -23,7 +24,13 @@ 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 ---
set (FMT_REPO $ENV{FMT_REPO})

if (NOT DEFINED FMT_REPO)
set(FMT_REPO "https://github.com/fmtlib/fmt")
endif()

if(NOT DEFINED FMT_DIR)
set(FMT_VERSION "10.0.0")
Expand All @@ -33,7 +40,7 @@ if(NOT DEFINED FMT_DIR)
ExternalProject_Add(
fmt_external
PREFIX "${CMAKE_CURRENT_BINARY_DIR}/f"
URL "https://github.com/fmtlib/fmt/archive/refs/tags/${FMT_VERSION}.zip"
URL "${FMT_REPO}/archive/refs/tags/${FMT_VERSION}.zip"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${FMT_DIR}
CMAKE_ARGS -DFMT_TEST:BOOL=OFF # Don't build all the tests
)
Expand All @@ -42,28 +49,38 @@ if(NOT DEFINED FMT_DIR)
endif()

# ---- spdlog ---
set(SPDLOG_REPO $ENV{SPDLOG_REPO})

if (NOT DEFINED SPDLOG_REPO)
set(SPDLOG_REPO "https://github.com/gabime/spdlog")
endif()

if(NOT DEFINED SPDLOG_DIR)
set(SPDLOG_DIR "${CMAKE_CURRENT_BINARY_DIR}/si")
set(SPDLOG_VERSION "1.12.0")
ExternalProject_Add(
spdlog_external
PREFIX "${CMAKE_CURRENT_BINARY_DIR}/s"
URL "https://github.com/gabime/spdlog/archive/refs/tags/v${SPDLOG_VERSION}.zip"
URL "${SPDLOG_REPO}/archive/refs/tags/v${SPDLOG_VERSION}.zip"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${SPDLOG_DIR}
)
add_dependencies(piper spdlog_external)
add_dependencies(test_piper spdlog_external)
endif()

# ---- piper-phonemize ---
set(PIPER_PHONEMIZE_REPO $ENV{PIPER_PHONEMIZE_REPO})

if (NOT DEFINED PIPER_PHONEMIZE_REPO)
set(PIPER_PHONEMIZE_REPO "https://github.com/rhasspy/piper-phonemize")
endif()

if(NOT DEFINED PIPER_PHONEMIZE_DIR)
set(PIPER_PHONEMIZE_DIR "${CMAKE_CURRENT_BINARY_DIR}/pi")
ExternalProject_Add(
piper_phonemize_external
PREFIX "${CMAKE_CURRENT_BINARY_DIR}/p"
URL "https://github.com/rhasspy/piper-phonemize/archive/refs/heads/master.zip"
URL "${PIPER_PHONEMIZE_REPO}/archive/refs/heads/master.zip"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${PIPER_PHONEMIZE_DIR}
)
add_dependencies(piper piper_phonemize_external)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ clean:
rm -rf src/python_run/piper_tts.egg.info src/python_run/build; \
rm -rf src/python/build src/python/piper_train.egg.info; \
else \
powershell -Command "if (Test-Path build) { Remove-Item -Recurse -Force build }; \
pwsh -Command "if (Test-Path build) { Remove-Item -Recurse -Force build }; \
if (Test-Path install) { Remove-Item -Recurse -Force install }; \
if (Test-Path src/python/build) { Remove-Item -Recurse -Force src/python/build }; \
if (Test-Path src/python/piper_train.egg-info) { Remove-Item -Recurse -Force src/python/piper_train.egg-info }; \
Expand Down

0 comments on commit e52d607

Please sign in to comment.