feat: be compatible with macOS
This commit is contained in:
parent
d051a44eb6
commit
0b1d84013a
|
@ -68,7 +68,8 @@ endif ()
|
|||
|
||||
# Just treat `Release` and `MinSizeRel` as `RelWithDebInfo`
|
||||
if (NOT ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug"))
|
||||
set (CMAKE_BUILD_TYPE "RelWithDebInfo")
|
||||
# set (CMAKE_BUILD_TYPE "RelWithDebInfo")
|
||||
set (CMAKE_BUILD_TYPE "Release")
|
||||
endif ()
|
||||
|
||||
# NOTE(anjingyu):
|
||||
|
|
|
@ -84,9 +84,9 @@ RUN echo "deb [arch=amd64] ${BASE_URL} ${BRANCH} ${CATATORIES}\ndeb [arch=amd64]
|
|||
&& /conda/bin/conda config --set custom_channels.simpleitk 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud' \
|
||||
&& /conda/bin/conda config --set show_channel_urls True
|
||||
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LANGUAGE en_US:en
|
||||
ENV LC_ALL en_US.UTF-8
|
||||
ENV LANG=en_US.UTF-8
|
||||
ENV LANGUAGE=en_US:en
|
||||
ENV LC_ALL=en_US.UTF-8
|
||||
|
||||
EXPOSE 22
|
||||
|
||||
|
|
|
@ -88,9 +88,9 @@ RUN echo "deb [arch=amd64] ${BASE_URL} ${BRANCH} ${CATATORIES}\ndeb [arch=amd64]
|
|||
&& /conda/bin/conda config --set custom_channels.simpleitk 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud' \
|
||||
&& /conda/bin/conda config --set show_channel_urls True
|
||||
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LANGUAGE en_US:en
|
||||
ENV LC_ALL en_US.UTF-8
|
||||
ENV LANG=en_US.UTF-8
|
||||
ENV LANGUAGE=en_US:en
|
||||
ENV LC_ALL=en_US.UTF-8
|
||||
|
||||
EXPOSE 22
|
||||
|
||||
|
|
|
@ -86,9 +86,9 @@ RUN echo "deb [arch=amd64] ${BASE_URL} ${BRANCH} ${CATATORIES}\ndeb [arch=amd64]
|
|||
&& /conda/bin/conda config --set custom_channels.simpleitk 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud' \
|
||||
&& /conda/bin/conda config --set show_channel_urls True
|
||||
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LANGUAGE en_US:en
|
||||
ENV LC_ALL en_US.UTF-8
|
||||
ENV LANG=en_US.UTF-8
|
||||
ENV LANGUAGE=en_US:en
|
||||
ENV LC_ALL=en_US.UTF-8
|
||||
|
||||
EXPOSE 22
|
||||
|
||||
|
|
|
@ -60,19 +60,35 @@ function main()
|
|||
|
||||
echo -e "${cyan}-> Building ${yellow}admake-cross-linux-${_ARCH}:${_TAG}${cyan} ...${normal}"
|
||||
|
||||
local _DOCKERFILE1="Dockerfile.tmp1"
|
||||
local _DOCKERFILE2="Dockerfile.tmp2"
|
||||
|
||||
local _VER=""
|
||||
if [ "${_LOCAL_PKG}" = "true" ]; then
|
||||
# Get the version from source file
|
||||
while read line; do
|
||||
# Skip the empty lines and commented lines
|
||||
if [ -n "$line" ] && ! [[ "$line" = \#* ]]; then
|
||||
_VER=$(sed "s/.*__version__\s*=\s*\"\(.*\)\".*/\1/" <<< "$line")
|
||||
local _MATCHED_LINE=$(echo $line | grep "\s*__version__\s*=\s*\"[0-9]\+.[0-9]\+.[0-9]\+\"")
|
||||
if [ -z "$_MATCHED_LINE" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Be compatible with macOS
|
||||
_VER=$(echo "$_MATCHED_LINE" | sed "s/[ \t]*__version__[ \t]*=[ \t]*\"\(.*\)\".*/\1/")
|
||||
# The following command can only be effective for GNU sed
|
||||
# _VER=$(sed "s/.*__version__\s*=\s*\"\(.*\)\".*/\1/" <<< "$line")
|
||||
if [ -n "${_VER}" ]; then
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done < "${PROJ_DIR}/adtools/__init__.py"
|
||||
|
||||
if [ -z "$_VER" ]; then
|
||||
echo -e "[E] Can not retrieve the ${red}version information${normail} from ${yellow}${PROJ_DIR}/adtools/__init__.py${normal}"
|
||||
exit 128
|
||||
fi
|
||||
|
||||
local ADTOOLS_PKG="${PROJ_DIR}/dist/adtools-${_VER}-py3-none-any.whl"
|
||||
if [ ! -f "$ADTOOLS_PKG" ]; then
|
||||
echo -e "[W] ${yellow}Required package ${cyan}$ADTOOLS_PKG ${yellow}is missing, attempt to build it.${normal}"
|
||||
|
@ -92,15 +108,19 @@ function main()
|
|||
fi
|
||||
|
||||
# Remove the commands that install from remote server
|
||||
sed -i "/\s*curl -O \"\${ADTOOLS_URL}\".*/d" $dockerfile 1>/dev/null 2>&1
|
||||
sed -i "/\s*\/conda\/bin\/conda run python -m pip install \.\/\${ADTOOLS_NAME}.*/d" $dockerfile 1>/dev/null 2>&1
|
||||
# Be compatible with macOS, BSD sed do not support the -i option
|
||||
sed "/\s*curl -O \"\${ADTOOLS_URL}\".*/d" $dockerfile | tee $_DOCKERFILE1 1>/dev/null
|
||||
sed "/\s*\/conda\/bin\/conda run python -m pip install \.\/\${ADTOOLS_NAME}.*/d" $_DOCKERFILE1 | tee $_DOCKERFILE2 1>/dev/null
|
||||
# The following commands can only be effective for GNU sed
|
||||
# sed -i "/\s*curl -O \"\${ADTOOLS_URL}\".*/d" $dockerfile 1>/dev/null 2>&1
|
||||
# sed -i "/\s*\/conda\/bin\/conda run python -m pip install \.\/\${ADTOOLS_NAME}.*/d" $dockerfile 1>/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if docker buildx 1>/dev/null 2>&1; then
|
||||
# If the buildx plugin is installed
|
||||
docker buildx build -t admake-cross-linux-${_ARCH}:${_TAG} -f $dockerfile .
|
||||
docker buildx build -t admake-cross-linux-${_ARCH}:${_TAG} -f $_DOCKERFILE2 .
|
||||
else
|
||||
docker build -t admake-cross-linux-${_ARCH}:${_TAG} -f $dockerfile .
|
||||
docker build -t admake-cross-linux-${_ARCH}:${_TAG} -f $_DOCKERFILE2 .
|
||||
fi
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
|
@ -114,6 +134,14 @@ function main()
|
|||
docker container rm -f "build_${_SUFFIX}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f "$_DOCKERFILE1" ]; then
|
||||
rm $_DOCKERFILE1
|
||||
fi
|
||||
|
||||
if [ -f "$_DOCKERFILE2" ]; then
|
||||
rm $_DOCKERFILE2
|
||||
fi
|
||||
done
|
||||
popd 1>/dev/null 2>&1
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
cmake_minimum_required (VERSION 3.0)
|
||||
cmake_minimum_required (VERSION 3.15)
|
||||
|
||||
project (nds)
|
||||
|
||||
|
@ -7,7 +7,7 @@ set (CMAKE_CXX_STANDARD 14)
|
|||
set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set (CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
include (admake)
|
||||
include (CMakeListsPub)
|
||||
|
||||
include_directories ("${CMAKE_CURRENT_LIST_DIR}/source")
|
||||
|
||||
|
|
Loading…
Reference in New Issue