Skip to content

Instantly share code, notes, and snippets.

@brianbruggeman
Created August 30, 2015 02:45
Show Gist options
  • Save brianbruggeman/4b297eff861d17575965 to your computer and use it in GitHub Desktop.
Save brianbruggeman/4b297eff861d17575965 to your computer and use it in GitHub Desktop.
build scripts
@ECHO OFF && PUSHD "%~dp0" && SETLOCAL
set interactive=1
echo %cmdcmdline% | find /i "%~0" >nul
if not errorlevel 1 set interactive=0
REM ====================================================================
REM Build: Clean
REM ====================================================================
IF "%~1"=="clean" (
RMDIR build /S /Q && (
REM Do nothing
) || (
if _%interactive%_==_0_ pause
if _%interactive%_==_0_ exit
)
shift
) ELSE IF _%interactive%_==_0_ (
RMDIR build /S /Q && (
REM Do nothing
) || (
if _%interactive%_==_0_ pause
if _%interactive%_==_0_ exit
)
)
REM ====================================================================
REM Create: Build folder
REM ====================================================================
IF NOT EXIST "build" MKDIR build && (
REM Do nothing
) || (
if _%interactive%_==_0_ pause
if _%interactive%_==_0_ exit
)
REM ====================================================================
REM CMake: Clean any top-level cmake buid artifacts
REM ====================================================================
IF EXIST "cmake" RMDIR cmake /S /Q && (
REM Do nothing
) || (
if _%interactive%_==_0_ pause
if _%interactive%_==_0_ exit
)
IF EXIST "CMakeFiles" RMDIR CMakeFiles /S /Q && (
REM Do nothing
) || (
if _%interactive%_==_0_ pause
if _%interactive%_==_0_ exit
)
IF EXIST "CmakeCache.txt" DEL CmakeCache.txt && (
REM Do nothing
) || (
if _%interactive%_==_0_ pause
if _%interactive%_==_0_ exit
)
REM ====================================================================
REM CMake: Begin cmake build process
REM ====================================================================
cd build && (
REM Do nothing
) || (
if _%interactive%_==_0_ pause
if _%interactive%_==_0_ exit
)
REM ====================================================================
REM CMake: Create build files
REM ====================================================================
cmake ../ && (
REM Do nothing
) || (
if _%interactive%_==_0_ pause
if _%interactive%_==_0_ exit
)
IF "%~1"=="rebuild" (
make clean && (
echo Running make clean
) || (
if _%interactive%_==_0_ pause
if _%interactive%_==_0_ exit
)
shift
)
REM ====================================================================
REM CMake: Run Make
REM ====================================================================
make %* && (
echo Running make %*
) || (
if _%interactive%_==_0_ pause
if _%interactive%_==_0_ exit
)
#!/usr/bin/env bash
if [ "$1" == "clean" ] ; then
rm -Rf build
fi
if [ ! -d "build" ] ; then
mkdir build
fi
# clean out CMakeFiles...
rm -Rf cmake CMakeFiles CmakeCache.txt
cd build
cmake ../
if [ "$1" == "clean" ] ; then
make clean
shift
fi
# make doc
make VERBOSE=1 $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment