Skip to content

Commit 55f8ff4

Browse files
committed
chore(Makefile): make test; build rime_test in release configuration
1 parent fcb80ee commit 55f8ff4

File tree

4 files changed

+24
-31
lines changed

4 files changed

+24
-31
lines changed

CMakeLists.txt

+3-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ add_definitions(-DRIME_VERSION="${LIBRIME_VERSION}")
1212
option(BUILD_SHARED_LIBS "Build Rime as shared library" ON)
1313
option(BUILD_STATIC "Build with dependencies as static libraries" OFF)
1414
option(BUILD_DATA "Build data for Rime" OFF)
15-
option(BUILD_TEST "Build and run tests" OFF)
15+
option(BUILD_TEST "Build and run tests" ON)
1616
option(BUILD_SEPARATE_LIBS "Build a separate rime-gears library" OFF)
1717
option(ENABLE_LOGGING "Enable logging with google-glog library" ON)
1818
option(BOOST_USE_CXX11 "Boost has been built with C++11 support" OFF)
@@ -161,13 +161,8 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
161161
install(FILES ${PROJECT_BINARY_DIR}/rime.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
162162
install(FILES cmake/RimeConfig.cmake DESTINATION share/cmake/rime)
163163
if(BUILD_DATA)
164-
install(FILES ${PROJECT_SOURCE_DIR}/data/default.yaml DESTINATION ${pkgdatadir})
165-
install(FILES ${PROJECT_SOURCE_DIR}/data/symbols.yaml DESTINATION ${pkgdatadir})
166-
install(FILES ${PROJECT_SOURCE_DIR}/data/essay.txt DESTINATION ${pkgdatadir})
167-
file(GLOB preset_schema ${PROJECT_SOURCE_DIR}/data/preset/*.yaml)
168-
install(FILES ${preset_schema} DESTINATION ${pkgdatadir})
169-
file(GLOB supplement_schema ${PROJECT_SOURCE_DIR}/data/supplement/*.yaml)
170-
install(FILES ${supplement_schema} DESTINATION ${pkgdatadir})
164+
file(GLOB preset_data_files ${PROJECT_SOURCE_DIR}/data/preset/*.yaml)
165+
install(FILES ${preset_data_files} DESTINATION ${pkgdatadir})
171166
endif(BUILD_DATA)
172167
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
173168

Makefile

+14-13
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,9 @@ RIME_ROOT = $(CURDIR)
33
sharedir = $(DESTDIR)/usr/share
44
bindir = $(DESTDIR)/usr/bin
55

6-
.PHONY: all install uninstall thirdparty clean librime-static librime debug
6+
.PHONY: all thirdparty clean librime librime-static install-librime uninstall-librime release install uninstall debug install-debug uninstall-debug test
77

8-
all: librime
9-
@echo ':)'
10-
11-
install: install-librime
12-
@echo ':)'
13-
14-
uninstall: uninstall-librime
15-
@echo ':)'
8+
all: release
169

1710
thirdparty:
1811
make -f Makefile.thirdparty
@@ -23,26 +16,34 @@ thirdparty/%:
2316
clean:
2417
rm -Rf build build-static debug-build
2518

19+
librime: release
20+
install-librime: install
21+
uninstall-librime: uninstall
22+
2623
librime-static:
2724
cmake . -Bbuild-static -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC=ON -DBUILD_SHARED_LIBS=OFF
2825
cmake --build build-static
2926

30-
librime:
27+
release:
3128
cmake . -Bbuild -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
3229
cmake --build build
3330

34-
install-librime:
31+
install:
3532
cmake --build build --target install
3633

37-
uninstall-librime:
34+
uninstall:
3835
cmake --build build --target uninstall
3936

4037
debug:
41-
cmake . -Bdebug-build -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug -DBUILD_TEST=ON
38+
cmake . -Bdebug-build -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug
4239
cmake --build debug-build
4340

4441
install-debug:
4542
cmake --build debug-build --target install
4643

4744
uninstall-debug:
4845
cmake --build debug-build --target uninstall
46+
47+
test: release
48+
(cd build/test; ./rime_test)
49+

Makefile.xcode

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
RIME_ROOT = $(CURDIR)
22
RIME_COMPILER_OPTIONS = CC=clang CXX=clang++ CXXFLAGS="-stdlib=libc++" LDFLAGS="-stdlib=libc++"
33

4-
.PHONY: all release debug clean thirdparty
4+
.PHONY: all release debug clean test thirdparty
55

66
all: release
77

@@ -10,7 +10,7 @@ release:
1010
cmake --build xbuild --config Release | grep -v setenv | tee build.log
1111

1212
debug:
13-
cmake . -Bxdebug -GXcode -DBUILD_STATIC=ON -DBUILD_TEST=ON -DBUILD_SEPARATE_LIBS=ON
13+
cmake . -Bxdebug -GXcode -DBUILD_STATIC=ON -DBUILD_SEPARATE_LIBS=ON
1414
cmake --build xdebug --config Debug | grep -v setenv | tee build.log
1515

1616
clean:
@@ -20,6 +20,9 @@ clean:
2020
rm -f thirdparty/lib/* > /dev/null 2>&1 || true
2121
make -f Makefile.thirdparty clean-src
2222

23+
test: release
24+
(cd xbuild/test; LD_LIBRARY_PATH=../lib/Release Release/rime_test)
25+
2326
thirdparty:
2427
$(RIME_COMPILER_OPTIONS) make -f Makefile.thirdparty
2528

travis-script.sh

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
#!/bin/bash
22

33
if [[ "$TRAVIS_OS_NAME" == linux ]]; then
4-
make debug
5-
pushd debug-build/test
6-
./rime_test
7-
popd
4+
make test
85
elif [[ "$TRAVIS_OS_NAME" == osx ]]; then
9-
make -f Makefile.xcode debug
10-
pushd xdebug/test
11-
./Debug/rime_test
12-
popd
6+
make -f Makefile.xcode test
137
fi

0 commit comments

Comments
 (0)