-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
64 lines (56 loc) · 1.81 KB
/
CMakeLists.txt
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
57
58
59
60
61
62
63
64
cmake_minimum_required(VERSION 3.6...3.14)
project(domino)
if (WIN32)
cmake_policy(SET CMP0135 OLD)
endif(WIN32)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(MSVC)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
else(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -lpthread")
endif(MSVC)
# 依存ライブラリを追加
include(FetchContent)
if (WIN32)
FetchContent_Declare(onnxruntime URL https://github.com/microsoft/onnxruntime/releases/download/v1.16.3/onnxruntime-win-x64-1.16.3.zip)
elseif(APPLE)
FetchContent_Declare(onnxruntime URL https://github.com/microsoft/onnxruntime/releases/download/v1.16.3/onnxruntime-osx-universal2-1.16.3.tgz)
else()
FetchContent_Declare(onnxruntime URL https://github.com/microsoft/onnxruntime/releases/download/v1.16.3/onnxruntime-linux-x64-1.16.3.tgz)
endif()
FetchContent_MakeAvailable(onnxruntime)
add_subdirectory(pybind11)
include_directories(./eigen ./argparse/include ${FETCHCONTENT_BASE_DIR}/onnxruntime-src/include)
link_directories(${FETCHCONTENT_BASE_DIR}/onnxruntime-src/lib)
pybind11_add_module(
pydomino
src/lib.cpp
src/domino.cpp
src/viterbi.cpp
)
target_link_libraries(
pydomino
PRIVATE onnxruntime
)
add_executable(
domino
src/main.cpp
src/domino.cpp
src/viterbi.cpp
src/load_wav.cpp
)
target_link_libraries(
domino
PRIVATE onnxruntime
)
if(WIN32)
add_custom_command(
TARGET pydomino POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${FETCHCONTENT_BASE_DIR}/onnxruntime-src/lib/onnxruntime.dll $<TARGET_FILE_DIR:pydomino>
)
endif()