Skip to content

Commit 150126b

Browse files
authored
Configuration for GitHub Actions (r9y9#4)
1 parent 2221314 commit 150126b

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

.github/workflows/ccpp.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: C/C++ CI
2+
3+
on:
4+
push:
5+
branches: [ '1.10' ]
6+
pull_request:
7+
branches: [ '1.10' ]
8+
9+
jobs:
10+
build:
11+
strategy:
12+
matrix:
13+
build_type: [ Release ]
14+
config:
15+
- os: ubuntu-latest
16+
cc: gcc
17+
cxx: g++
18+
config_generator_type: single
19+
- os: ubuntu-latest
20+
cc: clang
21+
cxx: clang++
22+
config_generator_type: single
23+
- os: macos-latest
24+
cc: gcc
25+
cxx: g++
26+
config_generator_type: single
27+
- os: macos-latest
28+
cc: clang
29+
cxx: clang++
30+
config_generator_type: single
31+
- os: windows-latest
32+
cc: cl
33+
cxx: cl
34+
config_generator_type: multiple
35+
36+
runs-on: ${{ matrix.config.os }}
37+
38+
env:
39+
CC: ${{ matrix.config.cc }}
40+
CXX: ${{ matrix.config.cxx }}
41+
42+
steps:
43+
- uses: actions/checkout@v2
44+
with:
45+
repository: r9y9/hts_engine_API
46+
path: hts_engine_API
47+
- name: Build hts_engine_API
48+
working-directory: ./hts_engine_API/src
49+
run: |
50+
cmake -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -D BUILD_SHARED_LIBS=ON -S . -B build
51+
cmake --build build --config ${{ matrix.build_type }}
52+
- name: Library Path
53+
id: library_path
54+
uses: haya14busa/action-cond@v1
55+
with:
56+
cond: ${{ matrix.config.config_generator_type == 'multiple' }}
57+
if_true: ../../hts_engine_API/src/build/lib/${{ matrix.build_type }}
58+
if_false: ../../hts_engine_API/src/build/lib
59+
- uses: actions/checkout@v2
60+
with:
61+
path: open_jtalk
62+
- name: Build open_jtalk
63+
working-directory: ./open_jtalk/src
64+
run: |
65+
cmake -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -D BUILD_SHARED_LIBS=ON -D CMAKE_INCLUDE_PATH=../../hts_engine_API/src/include -D CMAKE_LIBRARY_PATH=${{ steps.library_path.outputs.value }} -S . -B build
66+
cmake --build build --config ${{ matrix.build_type }}

src/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ check_include_files(sys/stat.h HAVE_SYS_STAT_H)
6161
check_include_files(sys/times.h HAVE_SYS_TIMES_H)
6262
check_include_files(sys/types.h HAVE_SYS_TYPES_H)
6363
check_include_files(unistd.h HAVE_UNISTD_H)
64+
check_include_files(windows.h HAVE_WINDOWS_H)
6465
check_function_exists(getenv HAVE_GETENV)
6566
check_function_exists(getpagesize HAVE_GETPAGESIZE)
6667
check_function_exists(mmap HAVE_MMAP)
@@ -116,13 +117,22 @@ if(${CHARSET} STREQUAL "sjis")
116117
foreach(flag CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
117118
set(${flag} "${${flag}} -finput-charset=cp932 -fexec-charset=cp932")
118119
endforeach()
120+
target_compile_options(openjtalk
121+
PRIVATE $<$<C_COMPILER_ID:MSVC>:/source-charset:.932;/execution-charset:.932>
122+
)
119123
elseif(${CHARSET} STREQUAL "eucjp")
120124
add_definitions(-DCHARSET_EUC_JP -DMECAB_CHARSET=euc-jp)
125+
target_compile_options(openjtalk
126+
PRIVATE $<$<C_COMPILER_ID:MSVC>:/source-charset:euc-jp;/execution-charset:euc-jp>
127+
)
121128
elseif(${CHARSET} STREQUAL "utf8")
122129
add_definitions(-DCHARSET_UTF_8 -DMECAB_CHARSET=utf-8 -DMECAB_UTF8_USE_ONLY)
123130
foreach(flag CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
124131
set(${flag} "${${flag}} -finput-charset=UTF-8 -fexec-charset=UTF-8")
125132
endforeach()
133+
target_compile_options(openjtalk
134+
PRIVATE $<$<C_COMPILER_ID:MSVC>:/source-charset:UTF-8;/execution-charset:UTF-8>
135+
)
126136
else()
127137
message(FATAL_ERROR "Encoding ${CHARSET} not recognized. You can set sjis/eucjp/utf8")
128138
endif()

0 commit comments

Comments
 (0)