-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCodeBlocksBuild.cmd
More file actions
49 lines (40 loc) · 1.38 KB
/
CodeBlocksBuild.cmd
File metadata and controls
49 lines (40 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
@echo off
rem ***************************************************************************
rem
rem Script to build a CodeBlocks workspace
rem
rem Note: The CodeBlocks build is not command line based and so it returns
rem immediately. This is also the reason why we leave the build window open,
rem because otherwise there is no build output.
rem
rem ***************************************************************************
setlocal enabledelayedexpansion
:handle_help_request
if /i "%~1" == "-?" call :usage & exit /b 0
if /i "%~1" == "--help" call :usage & exit /b 0
:check_args
if /i "%~1" == "" call :usage & exit /b 1
set "codeBlocksProgram=%ProgramFiles%\CodeBlocks\codeblocks.exe"
if not defined "ProgramFiles(x86)" goto :check_installed
set "codeBlocksProgram=%ProgramFiles(x86)%\CodeBlocks\codeblocks.exe"
:check_installed
if not exist "%codeBlocksProgram%" (
echo ERROR: CodeBlocks program not installed under "(Program Files x86/x64)\CodeBlocks\codeblocks.exe"
exit /b 1
)
"%codeBlocksProgram%" --build "%~1" --no-batch-window-close
if errorlevel 1 (
echo ERROR: Build failed.
exit /b 1
)
:success
exit /b 0
rem ***************************************************************************
rem Functions
rem ***************************************************************************
:usage
echo.
echo Usage: %~n0 [solution]
echo.
echo e.g. %~n0 lib\project\Solution.workspace
goto :eof