|
|
@ -6,9 +6,9 @@
|
|
|
|
# Thomas Moulard <thomas dot moulard at gmail dot com>
|
|
|
|
# Thomas Moulard <thomas dot moulard at gmail dot com>
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
# Get the install prefix or use the default.
|
|
|
|
# Get the install prefix.
|
|
|
|
zstyle -s ':prezto:module:cmake' install-prefix '_cmake_install_prefix' \
|
|
|
|
zstyle -s ':prezto:module:cmake' install-prefix '_cmake_install_prefix' \
|
|
|
|
|| _cmake_install_prefix='/usr'
|
|
|
|
|| _cmake_install_prefix=
|
|
|
|
|
|
|
|
|
|
|
|
# Get the build prefix.
|
|
|
|
# Get the build prefix.
|
|
|
|
zstyle -s ':prezto:module:cmake' build-prefix '_cmake_build_prefix' \
|
|
|
|
zstyle -s ':prezto:module:cmake' build-prefix '_cmake_build_prefix' \
|
|
|
@ -18,11 +18,15 @@ zstyle -s ':prezto:module:cmake' build-prefix '_cmake_build_prefix' \
|
|
|
|
zstyle -a ':prezto:module:cmake' profiles '_cmake_profiles' \
|
|
|
|
zstyle -a ':prezto:module:cmake' profiles '_cmake_profiles' \
|
|
|
|
|| _cmake_profiles=(Debug Release)
|
|
|
|
|| _cmake_profiles=(Debug Release)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Get the generator to use.
|
|
|
|
|
|
|
|
zstyle -s ':prezto:module:cmake' generator '_cmake_generator' \
|
|
|
|
|
|
|
|
|| _cmake_generator=
|
|
|
|
|
|
|
|
|
|
|
|
# Whether to look for clang as well.
|
|
|
|
# Whether to look for clang as well.
|
|
|
|
zstyle -b ':prezto:module:cmake' support-clang '_cmake_support_clang' \
|
|
|
|
zstyle -b ':prezto:module:cmake' support-clang '_cmake_support_clang' \
|
|
|
|
|| _cmake_support_clang=true
|
|
|
|
|| _cmake_support_clang=true
|
|
|
|
|
|
|
|
|
|
|
|
# Check for clang
|
|
|
|
# Check for clang.
|
|
|
|
_cmake_has_clang=false
|
|
|
|
_cmake_has_clang=false
|
|
|
|
if (( ${_cmake_support_clang} && $+commands[clang] )); then
|
|
|
|
if (( ${_cmake_support_clang} && $+commands[clang] )); then
|
|
|
|
_cmake_has_clang=true
|
|
|
|
_cmake_has_clang=true
|
|
|
@ -38,16 +42,25 @@ function makeBuildDirectory
|
|
|
|
return 1
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
local common_flags="-DCMAKE_INSTALL_PREFIX=${_cmake_install_prefix}"
|
|
|
|
local common_flags=""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# If an install prefix was provided.
|
|
|
|
|
|
|
|
if [[ ! -z "${_cmake_install_prefix}" ]]; then
|
|
|
|
|
|
|
|
common_flags+=" -DCMAKE_INSTALL_PREFIX=\"${_cmake_install_prefix}\""
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# If a generator was provided.
|
|
|
|
|
|
|
|
if [[ ! -z "${_cmake_generator}" ]]; then
|
|
|
|
|
|
|
|
common_flags+=" -G\"${_cmake_generator}\""
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Create default GCC profiles.
|
|
|
|
# Create default GCC profiles.
|
|
|
|
for p in "${_cmake_profiles[@]}"; do
|
|
|
|
for p in "${_cmake_profiles[@]}"; do
|
|
|
|
echo "*** Creating ${p:l} profile..."
|
|
|
|
echo "*** Creating ${p:l} profile..."
|
|
|
|
local build_dir="${d}/${_cmake_build_prefix}/${p:l}"
|
|
|
|
local build_dir="${d}/${_cmake_build_prefix}/${p:l}"
|
|
|
|
|
|
|
|
local cmake_cmd="cmake ${common_flags} ${extra_flags} -DCMAKE_BUILD_TYPE=${p} \"${d}\""
|
|
|
|
mkdir -p "${build_dir}"
|
|
|
|
mkdir -p "${build_dir}"
|
|
|
|
(cd "${build_dir}" && \
|
|
|
|
(cd "${build_dir}" && eval ${cmake_cmd})
|
|
|
|
cmake ${common_flags} ${extra_flags} -DCMAKE_BUILD_TYPE=${p} \
|
|
|
|
|
|
|
|
"${d}")
|
|
|
|
|
|
|
|
echo "*** ...done!"
|
|
|
|
echo "*** ...done!"
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
@ -56,11 +69,9 @@ function makeBuildDirectory
|
|
|
|
for p in "${_cmake_profiles[@]}"; do
|
|
|
|
for p in "${_cmake_profiles[@]}"; do
|
|
|
|
echo "*** Creating ${p:l} profile (clang)..."
|
|
|
|
echo "*** Creating ${p:l} profile (clang)..."
|
|
|
|
local build_dir="${d}/${_cmake_build_prefix}/clang+${p:l}"
|
|
|
|
local build_dir="${d}/${_cmake_build_prefix}/clang+${p:l}"
|
|
|
|
|
|
|
|
local cmake_cmd="cmake ${common_flags} ${extra_flags} -DCMAKE_BUILD_TYPE=${p} \"${d}\""
|
|
|
|
mkdir -p "${build_dir}"
|
|
|
|
mkdir -p "${build_dir}"
|
|
|
|
(cd "${build_dir}" && \
|
|
|
|
(cd "${build_dir}" && CC=clang CXX=clang++ eval ${cmake_cmd})
|
|
|
|
CC=clang CXX=clang++ \
|
|
|
|
|
|
|
|
cmake ${common_flags} ${extra_flags} -DCMAKE_BUILD_TYPE=${p} \
|
|
|
|
|
|
|
|
"${d}")
|
|
|
|
|
|
|
|
echo "*** ...done!"
|
|
|
|
echo "*** ...done!"
|
|
|
|
done
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|