Add install target for CMake
This commit is contained in:
parent
e5c9f313cb
commit
cc16547e4d
@ -188,3 +188,5 @@ target_link_options(${EXE_NAME} PUBLIC ${LINK_FLAGS} ${CXX_EXTRA_LINK_FLAGS})
|
|||||||
if (COMMAND setup_target)
|
if (COMMAND setup_target)
|
||||||
setup_target(${EXE_NAME})
|
setup_target(${EXE_NAME})
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
install (TARGETS ${EXE_NAME} DESTINATION bin)
|
||||||
@ -44,21 +44,26 @@ run_build() {
|
|||||||
|
|
||||||
rm -rf "$build"
|
rm -rf "$build"
|
||||||
set +e
|
set +e
|
||||||
|
local install_dir="$build/install"
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
"$CMAKE_BIN" -B"$build" -H. \
|
"$CMAKE_BIN" -B"$build" -H. \
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
||||||
|
-DCMAKE_INSTALL_PREFIX="$install_dir" \
|
||||||
-DMODEL="$model" $flags &>>"$log"
|
-DMODEL="$model" $flags &>>"$log"
|
||||||
local model_lower=$(echo "$model" | awk '{print tolower($0)}')
|
local model_lower=$(echo "$model" | awk '{print tolower($0)}')
|
||||||
|
|
||||||
local cmake_code=$?
|
local cmake_code=$?
|
||||||
|
|
||||||
"$CMAKE_BIN" --build "$build" -j "$(nproc)" &>>"$log"
|
"$CMAKE_BIN" --build "$build" -j "$(nproc)" &>>"$log"
|
||||||
|
"$CMAKE_BIN" --build "$build" --target install -j "$(nproc)" &>>"$log"
|
||||||
local cmake_code=$?
|
local cmake_code=$?
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
local bin="./$build/$model_lower-stream"
|
local bin="./$build/$model_lower-stream"
|
||||||
|
local installed_bin="./$install_dir/bin/$model_lower-stream"
|
||||||
|
|
||||||
echo "Checking for final executable: $bin"
|
echo "Checking for final executable: $bin"
|
||||||
if [[ -f "$bin" ]]; then
|
if [[ -f "$bin" ]]; then
|
||||||
echo "$(tput setaf 2)[PASS!]($model->$build)$(tput sgr0): -DMODEL=$model $flags"
|
echo "$(tput setaf 2)[PASS!]($model->$build)$(tput sgr0): -DMODEL=$model $flags"
|
||||||
@ -66,6 +71,11 @@ run_build() {
|
|||||||
cat "$log" | sed '/^--/d' | grep -i "/bin/nvcc" | sed 's/^/ /'
|
cat "$log" | sed '/^--/d' | grep -i "/bin/nvcc" | sed 's/^/ /'
|
||||||
cat "$log" | sed '/^--/d' | grep -i "$grep_kw" | sed 's/^/ /'
|
cat "$log" | sed '/^--/d' | grep -i "$grep_kw" | sed 's/^/ /'
|
||||||
cat "$log" | sed '/^--/d' | grep -i "warning" | sed "s/.*/ $(tput setaf 3)&$(tput sgr0)/"
|
cat "$log" | sed '/^--/d' | grep -i "warning" | sed "s/.*/ $(tput setaf 3)&$(tput sgr0)/"
|
||||||
|
if [[ ! -f "$installed_bin" ]]; then
|
||||||
|
echo "$(tput setaf 1)[ERR!] looking for $installed_bin from --target install but it's not there!$(tput sgr0)"
|
||||||
|
cat "$log"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "$(tput setaf 1)[FAIL!]($model->$build)$(tput sgr0): -DMODEL=$model $flags"
|
echo "$(tput setaf 1)[FAIL!]($model->$build)$(tput sgr0): -DMODEL=$model $flags"
|
||||||
echo " $(tput setaf 1)CMake exited with code $cmake_code, see full build log at $log, reproduced below:$(tput sgr0)"
|
echo " $(tput setaf 1)CMake exited with code $cmake_code, see full build log at $log, reproduced below:$(tput sgr0)"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user