CMake template clenaups and script adaptations
This commit is contained in:
1 parent
3087fcea8a
commit
9248925b77
19 files changed
+361
-170
No files matched your search
+11
-2
@@ -2,10 +2,18 @@
|
||||
REM Configure (if needed) and build the project, preferably with Ninja.
|
||||
REM
|
||||
REM Usage (from the project root):
|
||||
REM scripts\build.bat [BUILD_TYPE]
|
||||
REM scripts\build.bat [BUILD_TYPE] [extra cmake -D args...]
|
||||
REM
|
||||
REM BUILD_TYPE Debug^|Release^|RelWithDebInfo^|MinSizeRel (default: Release)
|
||||
REM
|
||||
REM Anything after BUILD_TYPE is passed straight through to cmake's
|
||||
REM configure step (up to 8 extra arguments -- %2 through %9, batch's own
|
||||
REM positional-parameter limit), e.g.:
|
||||
REM scripts\build.bat Debug -DBUILD_EXAMPLES=ON -DBUILD_TESTS=ON
|
||||
REM CMake caches -D options across reconfigures, so passing them once and
|
||||
REM then calling scripts\build.bat plain afterward for incremental builds
|
||||
REM keeps them set -- no need to repeat them on every call.
|
||||
REM
|
||||
REM Set BUILD_DIR to build somewhere other than out\build (see Configuration.cmake).
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
@@ -15,6 +23,7 @@ if "%BUILD_DIR%"=="" set "BUILD_DIR=out\build"
|
||||
set "BUILD_TYPE=%~1"
|
||||
if "%BUILD_TYPE%"=="" set "BUILD_TYPE=Release"
|
||||
if "%TOOLCACHE_DIR%"=="" set "TOOLCACHE_DIR=.cache\tools"
|
||||
set "EXTRA_CMAKE_ARGS=%2 %3 %4 %5 %6 %7 %8 %9"
|
||||
|
||||
where cmake >nul 2>nul
|
||||
if errorlevel 1 (
|
||||
@@ -60,7 +69,7 @@ set "GENERATOR_ARGS="
|
||||
|
||||
:configure
|
||||
echo ==^> Configuring (%BUILD_TYPE%) into %BUILD_DIR%\
|
||||
cmake %GENERATOR_ARGS% -S . -B "%BUILD_DIR%" -DCMAKE_BUILD_TYPE=%BUILD_TYPE%
|
||||
cmake %GENERATOR_ARGS% -S . -B "%BUILD_DIR%" -DCMAKE_BUILD_TYPE=%BUILD_TYPE% %EXTRA_CMAKE_ARGS%
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
echo ==^> Building
|
||||
|
||||
+13
-2
@@ -2,10 +2,17 @@
|
||||
# Configure (if needed) and build the project, preferably with Ninja.
|
||||
#
|
||||
# Usage (from the project root):
|
||||
# scripts/build.sh [BUILD_TYPE]
|
||||
# scripts/build.sh [BUILD_TYPE] [extra cmake -D args...]
|
||||
#
|
||||
# BUILD_TYPE Debug|Release|RelWithDebInfo|MinSizeRel (default: Release)
|
||||
#
|
||||
# Anything after BUILD_TYPE is passed straight through to cmake's
|
||||
# configure step, e.g.:
|
||||
# scripts/build.sh Debug -DBUILD_EXAMPLES=ON -DBUILD_TESTS=ON
|
||||
# CMake caches -D options across reconfigures, so passing them once and
|
||||
# then calling `scripts/build.sh` plain afterward for incremental builds
|
||||
# keeps them set -- no need to repeat them on every call.
|
||||
#
|
||||
# Set BUILD_DIR to build somewhere other than out/build (see Configuration.cmake).
|
||||
set -euo pipefail
|
||||
shopt -s nullglob
|
||||
@@ -15,6 +22,10 @@ cd "$SCRIPT_DIR/.."
|
||||
|
||||
BUILD_DIR="${BUILD_DIR:-out/build}"
|
||||
BUILD_TYPE="${1:-Release}"
|
||||
if [ "$#" -gt 0 ]; then
|
||||
shift
|
||||
fi
|
||||
EXTRA_CMAKE_ARGS=("$@")
|
||||
|
||||
command -v cmake >/dev/null 2>&1 || { echo "error: cmake not found on PATH." >&2; exit 1; }
|
||||
|
||||
@@ -51,7 +62,7 @@ else
|
||||
fi
|
||||
|
||||
echo "==> Configuring (${BUILD_TYPE}) into ${BUILD_DIR}/"
|
||||
cmake "${GENERATOR_ARGS[@]}" -S . -B "${BUILD_DIR}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}"
|
||||
cmake "${GENERATOR_ARGS[@]}" -S . -B "${BUILD_DIR}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" "${EXTRA_CMAKE_ARGS[@]}"
|
||||
|
||||
echo "==> Building"
|
||||
cmake --build "${BUILD_DIR}"
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ REM place either way -- this only affects the message below).
|
||||
REM
|
||||
REM Usage (from the project root):
|
||||
REM scripts\docs.bat REM every module
|
||||
REM scripts\docs.bat core_lib REM just one module's docs (docs_<target>)
|
||||
REM scripts\docs.bat hotreload_lib REM just one module's docs (docs_<target>)
|
||||
setlocal
|
||||
|
||||
cd /d "%~dp0.."
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# Usage (from the project root):
|
||||
# scripts/docs.sh # every module
|
||||
# scripts/docs.sh core_lib # just one module's docs (docs_<target>)
|
||||
# scripts/docs.sh hotreload_lib # just one module's docs (docs_<target>)
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ cd /d "%~dp0.."
|
||||
if "%BUILD_DIR%"=="" set "BUILD_DIR=out\build"
|
||||
set "BUILD_TYPE=%~1"
|
||||
if "%BUILD_TYPE%"=="" set "BUILD_TYPE=Release"
|
||||
set "COMPONENT=demo"
|
||||
set "COMPONENT=hotreload"
|
||||
|
||||
if not exist "%BUILD_DIR%" (
|
||||
echo error: "%BUILD_DIR%" not found. Run scripts\build.bat first.
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ cd "$SCRIPT_DIR/.."
|
||||
|
||||
BUILD_DIR="${BUILD_DIR:-out/build}"
|
||||
BUILD_TYPE="${1:-Release}"
|
||||
COMPONENT="demo" # must match PROJECT_CODE_NAME in CMakeLists.txt
|
||||
COMPONENT="hotreload" # must match PROJECT_CODE_NAME in CMakeLists.txt
|
||||
|
||||
if [ ! -d "$BUILD_DIR" ]; then
|
||||
echo "error: '${BUILD_DIR}' not found. Run scripts/build.sh first." >&2
|
||||
|
||||
@@ -11,10 +11,10 @@ REM entire source tree the way scanning the whole repo from "." would.
|
||||
REM
|
||||
REM Usage, from the project root: scripts\refactor.bat [optional path]
|
||||
REM scripts\refactor.bat every file under source\ and c-api\
|
||||
REM scripts\refactor.bat source\Core just one file or directory -- taken
|
||||
REM as given, with no exclusion filter,
|
||||
REM so pick a path that doesn't overlap
|
||||
REM with out\/.cache\/vendor\/.git\
|
||||
REM scripts\refactor.bat source\HotReload just one file or directory --
|
||||
REM taken as given, with no exclusion
|
||||
REM filter, so pick a path that doesn't
|
||||
REM overlap with out\/.cache\/.git\
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
cd /d "%~dp0.."
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
#
|
||||
# Usage (from the project root):
|
||||
# scripts/refactor.sh # every file under source/ and c-api/
|
||||
# scripts/refactor.sh source/Core # just one file or directory
|
||||
# scripts/refactor.sh source/HotReload # just one file or directory
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@ REM Usage (from the project root):
|
||||
REM scripts\run.bat <target-name> [-- program-args...]
|
||||
REM
|
||||
REM Examples:
|
||||
REM scripts\run.bat hello_exe
|
||||
REM scripts\run.bat farewell_exe -- Ale
|
||||
REM scripts\run.bat hotreload_demo_host
|
||||
REM scripts\run.bat hotreload_live_demo_host
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
cd /d "%~dp0.."
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@
|
||||
# scripts/run.sh <target-name> [-- program-args...]
|
||||
#
|
||||
# Examples:
|
||||
# scripts/run.sh hello_exe
|
||||
# scripts/run.sh farewell_exe -- Ale
|
||||
# scripts/run.sh hotreload_demo_host
|
||||
# scripts/run.sh hotreload_live_demo_host
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
Reference in new issue
Block a user