Skip to content

Commit

Permalink
chore(Makefile): make test; build rime_test in release configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
lotem committed Jan 11, 2017
1 parent fcb80ee commit 55f8ff4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 31 deletions.
11 changes: 3 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ add_definitions(-DRIME_VERSION="${LIBRIME_VERSION}")
option(BUILD_SHARED_LIBS "Build Rime as shared library" ON)
option(BUILD_STATIC "Build with dependencies as static libraries" OFF)
option(BUILD_DATA "Build data for Rime" OFF)
option(BUILD_TEST "Build and run tests" OFF)
option(BUILD_TEST "Build and run tests" ON)
option(BUILD_SEPARATE_LIBS "Build a separate rime-gears library" OFF)
option(ENABLE_LOGGING "Enable logging with google-glog library" ON)
option(BOOST_USE_CXX11 "Boost has been built with C++11 support" OFF)
Expand Down Expand Up @@ -161,13 +161,8 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install(FILES ${PROJECT_BINARY_DIR}/rime.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
install(FILES cmake/RimeConfig.cmake DESTINATION share/cmake/rime)
if(BUILD_DATA)
install(FILES ${PROJECT_SOURCE_DIR}/data/default.yaml DESTINATION ${pkgdatadir})
install(FILES ${PROJECT_SOURCE_DIR}/data/symbols.yaml DESTINATION ${pkgdatadir})
install(FILES ${PROJECT_SOURCE_DIR}/data/essay.txt DESTINATION ${pkgdatadir})
file(GLOB preset_schema ${PROJECT_SOURCE_DIR}/data/preset/*.yaml)
install(FILES ${preset_schema} DESTINATION ${pkgdatadir})
file(GLOB supplement_schema ${PROJECT_SOURCE_DIR}/data/supplement/*.yaml)
install(FILES ${supplement_schema} DESTINATION ${pkgdatadir})
file(GLOB preset_data_files ${PROJECT_SOURCE_DIR}/data/preset/*.yaml)
install(FILES ${preset_data_files} DESTINATION ${pkgdatadir})
endif(BUILD_DATA)
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")

Expand Down
27 changes: 14 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,9 @@ RIME_ROOT = $(CURDIR)
sharedir = $(DESTDIR)/usr/share
bindir = $(DESTDIR)/usr/bin

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

all: librime
@echo ':)'

install: install-librime
@echo ':)'

uninstall: uninstall-librime
@echo ':)'
all: release

thirdparty:
make -f Makefile.thirdparty
Expand All @@ -23,26 +16,34 @@ thirdparty/%:
clean:
rm -Rf build build-static debug-build

librime: release
install-librime: install
uninstall-librime: uninstall

librime-static:
cmake . -Bbuild-static -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC=ON -DBUILD_SHARED_LIBS=OFF
cmake --build build-static

librime:
release:
cmake . -Bbuild -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
cmake --build build

install-librime:
install:
cmake --build build --target install

uninstall-librime:
uninstall:
cmake --build build --target uninstall

debug:
cmake . -Bdebug-build -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug -DBUILD_TEST=ON
cmake . -Bdebug-build -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug
cmake --build debug-build

install-debug:
cmake --build debug-build --target install

uninstall-debug:
cmake --build debug-build --target uninstall

test: release
(cd build/test; ./rime_test)

7 changes: 5 additions & 2 deletions Makefile.xcode
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RIME_ROOT = $(CURDIR)
RIME_COMPILER_OPTIONS = CC=clang CXX=clang++ CXXFLAGS="-stdlib=libc++" LDFLAGS="-stdlib=libc++"

.PHONY: all release debug clean thirdparty
.PHONY: all release debug clean test thirdparty

all: release

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

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

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

test: release
(cd xbuild/test; LD_LIBRARY_PATH=../lib/Release Release/rime_test)

thirdparty:
$(RIME_COMPILER_OPTIONS) make -f Makefile.thirdparty

Expand Down
10 changes: 2 additions & 8 deletions travis-script.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
#!/bin/bash

if [[ "$TRAVIS_OS_NAME" == linux ]]; then
make debug
pushd debug-build/test
./rime_test
popd
make test
elif [[ "$TRAVIS_OS_NAME" == osx ]]; then
make -f Makefile.xcode debug
pushd xdebug/test
./Debug/rime_test
popd
make -f Makefile.xcode test
fi

0 comments on commit 55f8ff4

Please sign in to comment.