updte build system

This commit is contained in:
张壹 2021-08-02 21:46:49 +08:00
parent 8de1ea7075
commit 83c03e5231
3 changed files with 9 additions and 17 deletions

View File

@ -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})

View File

@ -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

View File

@ -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)