-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathSpawnPythonBuild.mke
More file actions
150 lines (130 loc) · 4.71 KB
/
SpawnPythonBuild.mke
File metadata and controls
150 lines (130 loc) · 4.71 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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#--------------------------------------------------------------------------------------
#
# $Source: SpawnPythonBuild.mke $
#
# $Copyright: (c) 2018 Bentley Systems, Incorporated. All rights reserved. $
#
#--------------------------------------------------------------------------------------
MS_NO_PATH_AUGMENT = 1
PolicyFile = $(SrcRoot)PowerPlatformSDK/privmki/AssertPowerPlatformSDKPolicy.mki
%include mdl.mki
%if not defined ExampleToRun
# It is assumed that we run $(ExampleToRun)\$(ExampleToRun).mke. This was to make it
# so that one argument could be passed in and used as the makefile name and the build
# directory. If this is a hardship, we can always pass in two arguments.
%error ExampleToRun must be defined. Usually this is passed in on the command line
%endif
ExampleBuildDir = $[@basename $(ExampleToRun)]
ExampleOut = $(OutputRootDir)ExampleBuild/$(ExampleBuildDir)/
always:
~@mkdir $(ExampleOut)
# Files used in this process
varCleanInclFile = $(ExampleOut)VarcleanInclusions.txt
varCleanBatFile = $(ExampleOut)MstnExampleEnvClean.bat
varCleanCreateFile = $(ExampleOut)CreateEnvClean.bat
SpawnMstnExampleBat = $(ExampleOut)SpawnMstnExample.bat
# Create the varclean bat file that will include all the SET statemets to remove most environment variables
CreateVarcleanInclusionFile:
$(msg)
> $(varCleanInclFile)
BSITRANSKIT
TRANSKITSHAREDSHELL
MSMDE
LANGUAGE
REL_V
MAJ_V
MIN_V
SUBMIN_V
NOBUILDMSTN
NOBUILDMSTNVIEW
NOBUILDDRAFT
WORKING_ON_PORT_TO_NEW_TOOLSET
PRG_WIPBUILD
PRG_BETABUILD
NO_BUILD_POWERPLATFORM_TRANSKIT
NO_WIXLIB_INSTALLER
MS_RTCONFIG
RCCODEPAGE
MS
MDL_TOOLS_CODEPAGE
WINZIPCL
DEVEXPRESS
AUTOCAD_PLATFORM
<
always:
~@mkdir $(temp)
> $(varCleanCreateFile)
@ECHO OFF
@ECHO \#-------------------------------------------------------------------------
@ECHO \# CreateEnvClean.bat is clearing the inherited environment variables that
@ECHO \# indicate source directories. This make sure that nothing creeps into our
@ECHO \# example builds that assumes that source is available.
@ECHO \#-------------------------------------------------------------------------
set BSI=
python $(SrcRoot)bsitools/anycpu/varclean.py $(varCleanInclFile) > $(varCleanBatFile)
<
# If doing a clean, just have the makefile flush itself
%if defined (BMAKE_DELETE_ALL_TARGETS)
bmakeOptsToPass = +aD
%endif
# For debugging
# bmakeOptsToPass = -v
%if defined (BSIBUILD)
bmakeOptsToPass + +dBSIBUILD
%endif
outbase = $(OutRoot)$(DEFAULT_TARGET_PROCESSOR_DIRECTORY)/
%if exists ($(outbase)product/MicroStationSDK)
sdkdir = $(outbase)product/MicroStationSDK/
%elif exists ($(outbase)product/MicroStationSDKNoDocs)
sdkdir = $(outbase)product/MicroStationSDKNoDocs/
%else
%error Unable to find SDK dir in $(outbase)product
%endif
builddir = $(outbase)product/SDKStation/SDKStation/
publicEnvVarBat = $(_MakeFilePath)/mstnpythonvars.bat
pythonMKIDir = $(_MakeFilePath)/build/publicSDK/
always:
~@mkdir $(builddir)mdlapps/
%include DefaultToolSet.mki
# create the batch file to run that will set up the exact environment we want for the example build
always:
> $(SpawnMstnExampleBat)
call $(varCleanCreateFile)
call $(varCleanBatFile)
set REL_V=$(REL_V)
set MAJ_V=$(MAJ_V)
set MIN_V=$(MIN_V)
set SUBMIN_V=$(SUBMIN_V)
set LANGUAGE=$(LANGUAGE)
set MDL_TOOLS_CODEPAGE=$(MDL_TOOLS_CODEPAGE)
set RCCODEPAGE=$(RCCODEPAGE)
set SrcRoot=$(SrcRoot)
set PythonDir=$(PythonDir)
set USE_CPP_17_OR_HIGHER=1
set DEFAULT_TARGET_PROCESSOR_ARCHITECTURE=$(DEFAULT_TARGET_PROCESSOR_ARCHITECTURE)
REM This puts the output in a conveniently deletable place
set MSMDE_OUTPUT=$(OutBuildDir)$(ExampleBuildDir)/
%if defined (WORKING_ON_PORT_TO_NEW_TOOLSET)
set WORKING_ON_PORT_TO_NEW_TOOLSET=$(WORKING_ON_PORT_TO_NEW_TOOLSET)
set SrcBsiCommon=$(SrcBsiCommon)
%endif
%if defined (BUILD_USING_VS2022)
set BUILD_USING_VS2022=1
%endif
%if defined (BUILD_USING_VS2019)
set BUILD_USING_VS2019=1
%endif
%if defined (BUILD_USING_VS2017)
set BUILD_USING_VS2017=1
%endif
%if defined (BUILD_USING_VS2015)
set BUILD_USING_VS2015=1
%endif
set > %temp%/LastExampleEnv.txt
<
# Doing a "call" to publicEnvVarBat in the preceding batch file seems to have the effect of spawning
# a shell and bringing back a lot of the python-set (bb) environment.
tmp_command = cmd.exe \/X \/c "$(SpawnMstnExampleBat) & $(publicEnvVarBat) $(builddir) $(sdkdir) $(pythonMKIDir) & bmake.exe $(bmakeOptsToPass) $(ExampleToRun)"
always:
%warn $(tmp_command)
$(tmp_command)