-
Notifications
You must be signed in to change notification settings - Fork 67
/
BuildEnv.cmd
96 lines (72 loc) · 2.58 KB
/
BuildEnv.cmd
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
@echo off
:: ************************************************************************
:: * Setup the build Environment for builds on Windows *
:: ************************************************************************
::
:: Run this script to setup a command shell with the proper environment
:: variables required for building the IDE and other programs in this
:: repository.
::
:: The commandline for execution of this script is the following:
::
:: BuildEnv.cmd <TargetPureBasicDirectory>
::
:: The <TargetPureBasicDirectory> parameter is mandatory. It specifies
:: the compiler to use and building the IDE will actually override
:: the IDE and other resources within that target directory. It is
:: therefore recommended to setup a dedicated PB installation for
:: IDE development and testing.
::
:: If the target directory is a SpiderBasic installation, the SB IDE
:: will be built instead. Note that for this case you will need a
:: regular PB installation available in the PATH as well.
::
:: By default this script will launch a command shell with the build
:: environment. You can suppress this by setting the PB_BATCH=1 env
:: variable before running this script.
::
:: ************************************************************************
:: Check presence of the mandatory argument
IF NOT [%1]==[] GOTO path_argument_ok
echo Invalid parameters: Missing argument for target PureBasic directory
pause
exit /b 1
:path_argument_ok
:: Set PUREBASIC_HOME and ensure the compiler and IDE are in the path
set PUREBASIC_HOME=%1
set PATH=%PUREBASIC_HOME%\Compilers;%PUREBASIC_HOME%;%PATH%
:: Check if this is PB or SB
IF EXIST %PUREBASIC_HOME%\Compilers\pbcompiler.exe (
GOTO configure_purebasic
) ELSE (
IF EXIST %PUREBASIC_HOME%\Compilers\sbcompiler.exe (
GOTO configure_spiderbasic
)
)
@echo Failed to detect PB or SB compiler in %PUREBASIC_HOME%
exit /b 1
:configure_purebasic
SET PB_JAVASCRIPT=
:: Detect processor architecture used by the compiler
%PUREBASIC_HOME%\Compilers\pbcompiler.exe /version | findstr /C:"(Windows - x64)" 1>nul
IF %ERRORLEVEL% EQU 0 (
SET PB_PROCESSOR=X64
) ELSE (
SET PB_PROCESSOR=X86
)
echo Setting environment for PureBasic %PB_PROCESSOR% in %PUREBASIC_HOME%
echo.
GOTO configure_common
:configure_spiderbasic
SET PB_JAVASCRIPT=1
echo Setting environment for SpiderBasic in %PUREBASIC_HOME%
echo.
GOTO configure_common
:configure_common
:: There should be no need to modify these:
set PB_WINDOWS=1
set PB_SUBSYSTEM=purelibraries/
:: Open command shell unless we are in batch mode:
IF DEFINED PB_BATCH GOTO end
cmd
:end