update build system

This commit is contained in:
张壹 2021-08-01 08:29:16 +08:00
parent e59ec89fed
commit 065edf8dfd
4 changed files with 24 additions and 7 deletions

View File

@ -4,11 +4,12 @@ project(LIBTESS VERSION 1.6)
#
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
set(CMAKE_INSTALL_PREFIX /usr/local)
# stow
set(CMAKE_INSTALL_PREFIX /opt/stow/tesseroids)
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
#
set(CMAKE_INSTALL_PREFIX /opt)
# stow
set(CMAKE_INSTALL_PREFIX /opt/stow/tesseroids)
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
# 使MinGW GCC
@ -17,7 +18,7 @@ elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
set(CMAKE_INSTALL_PREFIX D:/Library)
else()
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
set(CMAKE_INSTALL_PREFIX /usr/local)
set(CMAKE_INSTALL_PREFIX /opt/stow/tesseroids)
endif()
message(STATUS "Install prefix: " ${CMAKE_INSTALL_PREFIX})

16
config.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
cmd=${1}
package=tesseroids
address=/opt
if [[ ${cmd} == "configure" && ! -d "build/" ]]; then
mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=${address}/stow/${package} -DCMAKE_BUILD_TYPE=Release
elif [[ ${cmd} == "configure" ]]; then
cd build && rm -rf * && cmake .. -DCMAKE_INSTALL_PREFIX=${address}/stow/${package} -DCMAKE_BUILD_TYPE=Release
elif [[ ${cmd} == "build" ]]; then
cd build && make
elif [[ ${cmd} == "install" ]]; then
cd build && sudo make install
stow --dir=${address}/stow --target=${address} ${package}
fi

View File

@ -50,5 +50,5 @@ endif()
#
file(GLOB LIBTESS_HEAD *.h)
# /opt/include/tess
# include/tess
install(FILES ${LIBTESS_HEAD} DESTINATION include/tess)

View File

@ -22,8 +22,8 @@ macro(add_tools name)
set_target_properties(${name} PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
#
target_link_libraries(${name} PUBLIC tess)
# /opt/bin/tess
install(TARGETS ${name} RUNTIME DESTINATION bin/tess)
# bin
install(TARGETS ${name} RUNTIME DESTINATION bin)
endmacro()
# tools