update config.sh
This commit is contained in:
parent
0c6e4bdad7
commit
2414cfe885
@ -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/)
|
69
config.sh
69
config.sh
@ -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
|
@ -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安装后的动态库与静态库的地址不一样 需要手动在cmake生成的VS工程内添加下面的库地址
|
||||
# 方法如下:gctl->属性->链接器->附件库目录(选择编辑,并选择netcdf的可执行文件地址)
|
||||
#set(LIB_NETCDF_BIN C:/Program\ Files/netCDF\ 4.8.0/bin)
|
||||
|
Loading…
Reference in New Issue
Block a user