updte build system
This commit is contained in:
parent
8de1ea7075
commit
83c03e5231
@ -2,21 +2,12 @@ cmake_minimum_required(VERSION 3.15.2)
|
||||
# 设置项目名称与语言
|
||||
project(LIBMAGTESS VERSION 1.0)
|
||||
# 设置安装地址
|
||||
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
|
||||
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
|
||||
set(CMAKE_INSTALL_PREFIX /opt/stow/magnetic-tesseroids)
|
||||
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
|
||||
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
|
||||
set(CMAKE_INSTALL_PREFIX /opt/stow/magnetic-tesseroids)
|
||||
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
|
||||
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
|
||||
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
|
||||
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
|
||||
# 使用MinGW GCC编译时需取消注释
|
||||
#set(CMAKE_C_COMPILER gcc)
|
||||
#set(CMAKE_CXX_COMPILER g++)
|
||||
set(CMAKE_INSTALL_PREFIX D:/Library)
|
||||
else()
|
||||
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
|
||||
set(CMAKE_INSTALL_PREFIX /opt/stow/magnetic-tesseroids)
|
||||
endif()
|
||||
message(STATUS "Install prefix: " ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
|
@ -2,15 +2,16 @@
|
||||
|
||||
cmd=${1}
|
||||
package=magnetic-tesseroids
|
||||
address=/opt
|
||||
address=/opt/stow
|
||||
targetdir=/usr/local
|
||||
|
||||
if [[ ${cmd} == "configure" && ! -d "build/" ]]; then
|
||||
mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=${address}/stow/${package} -DCMAKE_BUILD_TYPE=Release
|
||||
mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=${address}/${package} -DCMAKE_BUILD_TYPE=Release
|
||||
elif [[ ${cmd} == "configure" ]]; then
|
||||
cd build && rm -rf * && cmake .. -DCMAKE_INSTALL_PREFIX=${address}/stow/${package} -DCMAKE_BUILD_TYPE=Release
|
||||
cd build && rm -rf * && cmake .. -DCMAKE_INSTALL_PREFIX=${address}/${package} -DCMAKE_BUILD_TYPE=Release
|
||||
elif [[ ${cmd} == "build" ]]; then
|
||||
cd build && make
|
||||
elif [[ ${cmd} == "install" ]]; then
|
||||
cd build && sudo make install
|
||||
sudo stow --dir=${address}/stow --target=${address} ${package}
|
||||
sudo stow --dir=${address} --target=${targetdir} ${package}
|
||||
fi
|
@ -26,7 +26,7 @@ macro(add_tools name)
|
||||
# 链接动态库
|
||||
target_link_libraries(${name} PUBLIC magtess)
|
||||
# 将可执行程序安装到bin
|
||||
install(TARGETS ${name} RUNTIME DESTINATION bin)
|
||||
install(TARGETS ${name} RUNTIME DESTINATION sbin)
|
||||
endmacro()
|
||||
|
||||
# 添加tools
|
||||
@ -44,4 +44,4 @@ set_target_properties(tessutil_magnetize_model PROPERTIES INSTALL_RPATH ${CMAKE_
|
||||
# 链接动态库
|
||||
target_link_libraries(tessutil_magnetize_model PUBLIC magtess)
|
||||
# 将可执行程序安装到bin
|
||||
install(TARGETS tessutil_magnetize_model RUNTIME DESTINATION bin)
|
||||
install(TARGETS tessutil_magnetize_model RUNTIME DESTINATION sbin)
|
Loading…
Reference in New Issue
Block a user