update config.sh

This commit is contained in:
张壹 2021-08-01 19:22:30 +08:00
parent 0c6e4bdad7
commit 2414cfe885
3 changed files with 64 additions and 13 deletions

View File

@ -11,5 +11,10 @@ if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
endif()
message(STATUS "Install prefix: " ${CMAKE_INSTALL_PREFIX})
# netcdf c
set(LIB_NETCDF_INC ${LIB_NETCDF}/include)
set(LIB_NETCDF_LIB ${LIB_NETCDF}/lib)
message(STATUS "netCDF directory: " ${LIB_NETCDF})
#
add_subdirectory(src/)

View File

@ -1,16 +1,65 @@
#!/bin/bash
cmd=${1}
package=netcdfcxx_legacy
address=/opt
package=NULL
runtype=configure
buildtype=Release
netcdflib=/usr/local
prefixdir=/opt/stow
targetdir=/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
while getopts "hr:p:b:n:d:t:" arg
do
case $arg in
h)
echo "Install and manage packages with the Stow software."
echo "-r running type: configure (default), build or install."
echo "-p package name."
echo "-b build type: Release (default) or Debug."
echo "-n netCDF library address: /usr/local (default)."
echo "-d install prefix: /opt/stow (default)."
echo "-t target prefix: /opt (default)."
exit 0;;
r)
runtype=${OPTARG};;
p)
package=${OPTARG};;
b)
buildtype=${OPTARG};;
n)
netcdflib=${OPTARG};;
d)
prefixdir=${OPTARG};;
t)
targetdir=${OPTARG};;
?)
echo "Error: unknow argument."
echo "Use -h option to see help information."
exit 1;;
esac
done
if [[ ${runtype} == "configure" && ! -d "build/" ]]; then
if [[ ${package} == "NULL" ]]; then
echo "Error: no package name."
echo "Use -h option to see help information."
exit 1
fi
mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=${prefixdir}/${package} -DCMAKE_BUILD_TYPE=${buildtype} -DLIB_NETCDF=${netcdflib}
elif [[ ${runtype} == "configure" ]]; then
if [[ ${package} == "NULL" ]]; then
echo "Error: no package name."
echo "Use -h option to see help information."
exit 1
fi
cd build && rm -rf * && cmake .. -DCMAKE_INSTALL_PREFIX=${prefixdir}/${package} -DCMAKE_BUILD_TYPE=${buildtype} -DLIB_NETCDF=${netcdflib}
elif [[ ${runtype} == "build" ]]; then
cd build && make
elif [[ ${cmd} == "install" ]]; then
elif [[ ${runtype} == "install" ]]; then
if [[ ${package} == "NULL" ]]; then
echo "Error: no package name."
echo "Use -h option to see help information."
exit 1
fi
cd build && sudo make install
sudo stow --dir=${address}/stow --target=${address} ${package}
sudo stow --dir=${prefixdir} --target=${targetdir} ${package}
fi

View File

@ -1,8 +1,5 @@
#
aux_source_directory(lib/ NETCDF_SRC)
# netcdf c
set(LIB_NETCDF_INC /opt/homebrew/include)
set(LIB_NETCDF_LIB /opt/homebrew/lib)
# netcdf cmakeVS
# gctl->->->netcdf
#set(LIB_NETCDF_BIN C:/Program\ Files/netCDF\ 4.8.0/bin)