diff --git a/.gitignore b/.gitignore index cd047c92a..faf9a0519 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ build/ build-static/ debug/ +dist/ build.log data/* thirdparty/include/* diff --git a/build.bat b/build.bat index 6a85c9244..8ac7cd923 100644 --- a/build.bat +++ b/build.bat @@ -83,6 +83,7 @@ shift goto parse_cmdline_options :end_parsing_cmdline_options +set DIST_DIR=%RIME_ROOT%\dist set THIRDPARTY=%RIME_ROOT%\thirdparty rem set CURL=%THIRDPARTY%\bin\curl.exe @@ -197,7 +198,8 @@ set RIME_CMAKE_FLAGS=-G%CMAKE_GENERATOR%^ -DBUILD_TEST=%build_test%^ -DENABLE_LOGGING=%enable_logging%^ -DBOOST_USE_CXX11=ON^ - -DCMAKE_CONFIGURATION_TYPES="Release" + -DCMAKE_CONFIGURATION_TYPES="Release"^ + -DCMAKE_INSTALL_PREFIX:PATH="%DIST_DIR%" cd /d %RIME_ROOT% echo cmake %RIME_ROOT% -B%build% %RIME_CMAKE_FLAGS% @@ -206,12 +208,9 @@ if %ERRORLEVEL% NEQ 0 goto ERROR echo. echo building librime. -cmake --build build --config Release +cmake --build build --config Release --target INSTALL if %ERRORLEVEL% NEQ 0 goto ERROR -mkdir build\include -copy /y src\*.h build\include - echo. echo ready. echo. diff --git a/xcode.mk b/xcode.mk index 4831c1a67..5beeae52a 100644 --- a/xcode.mk +++ b/xcode.mk @@ -1,16 +1,19 @@ RIME_ROOT = $(CURDIR) +RIME_DIST_DIR = $(RIME_ROOT)/dist + RIME_COMPILER_OPTIONS = CC=clang CXX=clang++ \ CXXFLAGS="-stdlib=libc++" LDFLAGS="-stdlib=libc++" -.PHONY: all release debug clean test thirdparty +.PHONY: all release debug clean distclean test thirdparty all: release release: cmake . -Bbuild -GXcode \ -DBUILD_STATIC=ON \ - -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON + -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \ + -DCMAKE_INSTALL_PREFIX="$(RIME_DIST_DIR)" cmake --build build --config Release debug: @@ -26,6 +29,12 @@ clean: rm -f thirdparty/lib/* > /dev/null 2>&1 || true make -f thirdparty.mk clean-src +dist: release + cmake --build build --config Release --target install + +distclean: clean + rm -rf "$(RIME_DIST)" > /dev/null 2>&1 || true + test: release (cd build/test; LD_LIBRARY_PATH=../lib/Release Release/rime_test)