Skip to content

Commit 39129f5

Browse files
committed
CreateRelease: separated gcc/msvc build
1 parent 7d4936b commit 39129f5

File tree

1 file changed

+112
-10
lines changed

1 file changed

+112
-10
lines changed

src/createrelease/createrelease.wx

Lines changed: 112 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@ Const RELEASE_SUFFIX:=""
2323
Const TARGET:= "???"
2424
#endif
2525

26-
Const OUTPUT:="wonkey_"+TARGET+"_"+WONKEY_VERSION+RELEASE_SUFFIX
26+
Global TARGET_SUFFIX:=""
27+
28+
Global OUTPUT:="" '--> "wonkey_"+TARGET+TARGET_SUFFIX+"_"+WONKEY_VERSION+RELEASE_SUFFIX
2729

2830
Const IGNORE:="
2931
.gitignore
32+
.gitattributes
3033
src/createrelease
3134
bin/windows/wide.state.json
3235
bin/windows/wide/wide.state.json
@@ -38,6 +41,7 @@ bin/raspbian/wide.state.json
3841
bin/raspbian/wide/wide.state.json
3942
"
4043

44+
Global msvc:=False
4145
Global desktop:String
4246
Global output:String
4347

@@ -116,7 +120,13 @@ Function CopyFiles( dir:String )
116120
If file.StartsWith( "emscripten_" ) Continue
117121
If file.StartsWith( "android_" ) Continue
118122
If file.StartsWith( "ios_" ) Continue
119-
'If file.Contains( "_msvc" ) Continue
123+
#if __TARGET__="windows"
124+
If msvc
125+
If Not file.Contains( "_msvc" ) Continue
126+
Else
127+
If file.Contains( "_msvc" ) Continue
128+
End
129+
#end
120130
'If file.Contains( "_x64" ) Continue
121131
If file="build" Continue
122132
If file="src" Continue
@@ -155,6 +165,10 @@ Function CopyFiles( dir:String )
155165
If file.EndsWith("_fast.sh") Continue
156166
If file.EndsWith("_fastest.sh") Continue
157167
If file.EndsWith("_slow.sh") Continue
168+
169+
#if __TARGET__<>"raspbian"
170+
If file.EndsWith("_raspbian.bat") Continue
171+
#end
158172

159173
#if __TARGET__="windows"
160174
If file.EndsWith(".sh") Continue
@@ -216,7 +230,7 @@ Function MakeInno()
216230

217231
Local iss:=New StringStack
218232
iss.Push( "[Setup]" )
219-
iss.Push( "OutputDir="+desktop )
233+
iss.Push( "OutputDir=.") '+desktop )
220234
iss.Push( "OutputBaseFilename="+OUTPUT )
221235
iss.Push( "AppName="+OUTPUT )
222236
iss.Push( "AppVerName="+OUTPUT )
@@ -227,7 +241,7 @@ Function MakeInno()
227241
iss.Push( "Name: ~q{group}\"+OUTPUT+"~q; Filename: ~q{app}\Wonkey (windows).exe~q; WorkingDir: ~q{app}~q" )
228242
iss.Push( "Name: ~q{group}\Uninstall "+OUTPUT+"~q; Filename: ~q{uninstallexe}~q" )
229243
iss.Push( "[FILES]" )
230-
iss.Push( "Source: ~q"+output+"\*~q; DestDir: {app}; Flags: ignoreversion recursesubdirs" )
244+
iss.Push( "Source: ~q"+OUTPUT+"\*~q; DestDir: {app}; Flags: ignoreversion recursesubdirs" )
231245
iss.Push( "[RUN]" )
232246
iss.Push( "Filename: ~q{app}\Wonkey (windows).exe~q; Description: ~qLaunch "+OUTPUT+"~q; Flags: postinstall nowait skipifsilent" )
233247

@@ -262,6 +276,23 @@ Function Main()
262276
Endif
263277
ChangeDir( ExtractDir( CurrentDir() ) )
264278
Wend
279+
280+
'if windows msvc
281+
If TARGET = "windows"
282+
Local usemsvc:= GetEnv( "WX_USE_MSVC" )
283+
284+
If usemsvc=""
285+
usemsvc = FindMSVC() ? "1" Else "0"
286+
End
287+
288+
If int(usemsvc)
289+
TARGET_SUFFIX = "-msvc"
290+
msvc=True
291+
End
292+
End
293+
294+
' set output name
295+
OUTPUT = "wonkey_"+TARGET+TARGET_SUFFIX+"_"+WONKEY_VERSION+RELEASE_SUFFIX
265296

266297
'#if __TARGET__="windows"
267298
' desktop=(String.FromCString( getenv( "HOMEDRIVE" ) )+String.FromCString( getenv( "HOMEPATH" ) )+"\Desktop").Replace( "\","/" )+"/"
@@ -281,13 +312,12 @@ Function Main()
281312
Local outdir:= "releases/unknown/"
282313
#endif
283314

284-
285-
286-
DeleteDir(outdir,True )
287-
CreateDir(outdir)
288-
315+
desktop = outdir
289316
output=outdir+OUTPUT
290317

318+
DeleteDir(output,True )
319+
CreateDir(output)
320+
291321
CopyRelease()
292322

293323
#if __TARGET__="windows"
@@ -304,6 +334,78 @@ Function Main()
304334

305335
#endif
306336

307-
Print "~nFinished!!!!!"
337+
Print "~nFinished!"
308338

309339
End
340+
341+
'--------------
342+
343+
#If __TARGET__="windows"
344+
345+
Function FindMSVC:bool()
346+
347+
Local msvcs:=""
348+
Local msvcs_versions:=GetEnv("WX_MSVC_VERSIONS")
349+
For Local ver:=Eachin msvcs_versions.Split(",")
350+
msvcs=GetEnv( "ProgramFiles(x86)" )+"\Microsoft Visual Studio\" + ver.Trim()
351+
If GetFileType( msvcs )=FileType.Directory Exit
352+
Next
353+
If GetFileType( msvcs )<>FileType.Directory Return False
354+
355+
Local wkits:=GetEnv( "ProgramFiles(x86)" )+"\Windows Kits\10"
356+
If GetFileType( wkits )<>FileType.Directory Return False
357+
358+
Local toolsDir:="",maxver:=0
359+
360+
For Local f:=Eachin LoadDir( msvcs )
361+
362+
Local dir:=msvcs+"\"+f+"\VC\Tools\MSVC"
363+
If GetFileType( dir )<>FileType.Directory Continue
364+
365+
For Local f:=Eachin LoadDir( dir )
366+
Local verDir:=dir+"\"+f
367+
If GetFileType( verDir )<>FileType.Directory Continue
368+
Local ver:=Int( f.Replace( ".","" ) )
369+
If ver>maxver
370+
toolsDir=verDir
371+
maxver=ver
372+
Endif
373+
Next
374+
Next
375+
376+
Local incsDir:=FindMaxVerDir( wkits+"\Include" )
377+
If Not incsDir Return False
378+
379+
Local libsDir:=FindMaxVerDir( wkits+"\Lib" )
380+
If Not libsDir Return False
381+
382+
Return True
383+
End
384+
385+
Function FindMaxVerDir:String( dir:String )
386+
387+
Local maxver:Long=0,maxverDir:=""
388+
389+
For Local f:=Eachin LoadDir( dir )
390+
391+
Local verDir:=dir+"\"+f
392+
If GetFileType( verDir )<>FileType.Directory Continue
393+
394+
Local ver:Long=Int( f.Replace( ".","" ) )
395+
396+
If ver>maxver
397+
maxver=ver
398+
maxverDir=verDir
399+
Endif
400+
Next
401+
402+
Return maxverDir
403+
End
404+
405+
#Else
406+
407+
Function FindMSVC:Bool()
408+
Return False
409+
End
410+
411+
#endif

0 commit comments

Comments
 (0)