scons: Generate Windows installer

Also:
- scons: Fix copying wrong scenario graphics on Windows
- MSVC: Fix output filenames for release builds
This commit is contained in:
2015-09-14 02:15:40 -04:00
parent 19197a64e7
commit 43e057949d
12 changed files with 157 additions and 97 deletions

2
.gitignore vendored
View File

@@ -57,7 +57,7 @@ build/
deps/
# Generated NSIS script file
src/*.vsproj/Installer/data.nsi
pkg/win/data.nsi
# Shader Builder projects
# It's an sqlite3 database and not particularly important, so exclude it

View File

@@ -14,7 +14,7 @@ if str(platform) not in ("darwin", "win32"):
print 'Building for:', platform
env = Environment(TARGET_ARCH='x86')
env = Environment(TARGET_ARCH='x86',ENV=os.environ)
env.VariantDir('#build/obj', 'src')
env.VariantDir('#build/obj/test', 'test')
@@ -331,4 +331,21 @@ elif str(platform) == "win32":
for targ in target_dirs:
env.Install(targ, src_file)
break
# Extra: Microsoft redistributable libraries installer
if 'msvc' in env["TOOLS"]:
if path.exists("dep/VCRedistInstall.exe"):
env.Install("build/Blades of Exile/", "dep/VCRedistInstall.exe")
else:
print "WARNING: Cannot find installer for the MSVC redistributable libraries for your version of Visual Studio."
print "Please download it from Microsoft's website and place it at:"
print " dep/VCRedistInstall.exe"
# Create it so its lack doesn't cause makensis to break
# (Because the installer is an optional component.)
open("build/Blades of Exile/VCRedistInstall.exe", 'w').close()
if str(platform) == "darwin":
# TODO: Build a disk image package
env.VariantDir("#build/pkg", "pkg/mac")
elif str(platform) == "win32" and subprocess.call(['where', '/Q', 'makensis']) == 0:
env.VariantDir("#build/pkg", "pkg/win")
SConscript("build/pkg/SConscript")

0
pkg/mac/SConscript Normal file
View File

26
pkg/win/SConscript Normal file
View File

@@ -0,0 +1,26 @@
import os.path as path
Import("env platform")
if str(platform) != "win32":
print "Error: Building for", str(platform), "but trying to create a Windows installer package"
env.Depends("data.nsi", ["gen-data.py", "#build/Blades of Exile/data"])
env.Command("data.nsi", "../Blades of Exile",
action = 'python build/pkg/gen-data.py ${SOURCE.abspath} > $TARGET'
)
env.Depends("Install-OBoE.exe", [
"#build/Blades of Exile",
"data.nsi",
"fileassoc.nsh"
])
if 'msvc' in env["TOOLS"]:
makensis = "makensis /DMSVC"
else:
makensis = "makensis"
env.Command("Install-OBoE.exe", "main.nsi", action = makensis + " /V2 $SOURCE")

View File

@@ -1,8 +1,9 @@
from os.path import relpath as makepath
from os.path import normpath as makepath
from glob import glob
import sys
root = makepath("../Release")
root = makepath(sys.argv[1])
# To add directories to the list of sources to generate file lists from,
# simply edit this dictionary. The key is the directory path (relative to
@@ -27,7 +28,7 @@ for path, pattern in files.items():
if type(pattern) == list:
check_files = [root + '/' + path + '/' + x for x in pattern]
else:
check_files = glob(root + '/' + path + '/' + pattern)
check_files = glob(makepath(root + '/' + path + '/' + pattern))
for fname in check_files:
print 'File', '"' + makepath(fname) + '"'
print 'File', '"' + makepath(fname.replace(root, '${RELEASE_DIR}')) + '"'

View File

@@ -4,11 +4,18 @@
!define APPNAME "Blades of Exile"
!define APPNAMEANDVERSION "Blades of Exile 1.0 beta"
; This specifies the build output dir to copy files from
; It uses /ifndef so it can be overridden from the commandline
; The default is the scons output directory
!ifndef RELEASE_DIR
!define RELEASE_DIR "..\..\build\Blades of Exile"
!endif
; Main Install settings
Name "${APPNAMEANDVERSION}"
InstallDir "$PROGRAMFILES\Blades of Exile"
InstallDirRegKey HKLM "Software\${APPNAME}" ""
OutFile "Release\Install-OBoE.exe"
OutFile "Install-OBoE.exe"
; File association helpers
!include "fileassoc.nsh"
@@ -24,7 +31,7 @@ OutFile "Release\Install-OBoE.exe"
!define MUI_LICENSEPAGE_BUTTON "&Install"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "..\..\..\LICENSE.txt"
!insertmacro MUI_PAGE_LICENSE "..\..\LICENSE.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
@@ -46,30 +53,32 @@ Section "Blades of Exile" Section1
; Set Section Files and Shortcuts
SetOutPath "$INSTDIR\"
; Install Visual Studio Redistributables
File "..\Release\VCRedistInstall.exe"
MessageBox MB_OK "Blades of Exile Installer will now launch the Microsoft Visual C++ \
Redistributable installer, which is required to complete the installation."
ExecWait '$INSTDIR\VCRedistInstall.exe /passive'
Delete "$INSTDIR\VCRedistInstall.exe"
!ifdef MSVC
File "${RELEASE_DIR}\VCRedistInstall.exe"
MessageBox MB_OK "Blades of Exile Installer will now launch the Microsoft Visual C++ \
Redistributable installer, which is required to complete the installation."
ExecWait '$INSTDIR\VCRedistInstall.exe /passive'
Delete "$INSTDIR\VCRedistInstall.exe"
!endif
; The executable file itself
File "..\Release\Blades of Exile.exe"
File "${RELEASE_DIR}\Blades of Exile.exe"
; Required DLLs
File "..\Release\libsndfile-1.dll"
File "..\Release\openal32.dll"
File "..\Release\sfml-audio-2.dll"
File "..\Release\sfml-graphics-2.dll"
File "..\Release\sfml-system-2.dll"
File "..\Release\sfml-window-2.dll"
File "..\Release\zlib1.dll"
File "${RELEASE_DIR}\libsndfile-1.dll"
File "${RELEASE_DIR}\openal32.dll"
File "${RELEASE_DIR}\sfml-audio-2.dll"
File "${RELEASE_DIR}\sfml-graphics-2.dll"
File "${RELEASE_DIR}\sfml-system-2.dll"
File "${RELEASE_DIR}\sfml-window-2.dll"
File "${RELEASE_DIR}\zlib1.dll"
; Scenarios
SetOutPath "$INSTDIR\Blades of Exile Scenarios"
File "..\Release\Blades of Exile Scenarios\busywork.exs"
File "..\Release\Blades of Exile Scenarios\STEALTH.BMP"
File "..\Release\Blades of Exile Scenarios\stealth.exs"
File "..\Release\Blades of Exile Scenarios\VALLEYDY.BMP"
File "..\Release\Blades of Exile Scenarios\valleydy.exs"
File "..\Release\Blades of Exile Scenarios\ZAKHAZI.BMP"
File "..\Release\Blades of Exile Scenarios\zakhazi.exs"
File "${RELEASE_DIR}\Blades of Exile Scenarios\busywork.exs"
File "${RELEASE_DIR}\Blades of Exile Scenarios\STEALTH.BMP"
File "${RELEASE_DIR}\Blades of Exile Scenarios\stealth.exs"
File "${RELEASE_DIR}\Blades of Exile Scenarios\VALLEYDY.BMP"
File "${RELEASE_DIR}\Blades of Exile Scenarios\valleydy.exs"
File "${RELEASE_DIR}\Blades of Exile Scenarios\ZAKHAZI.BMP"
File "${RELEASE_DIR}\Blades of Exile Scenarios\zakhazi.exs"
!include data.nsi
SetShellVarContext all
CreateShortCut "$DESKTOP\Blades of Exile.lnk" "$INSTDIR\Blades of Exile.exe"
@@ -85,9 +94,9 @@ Section "Character Editor" Section2
; Set Section Files and Shortcuts
SetOutPath "$INSTDIR\"
File "..\Release\Char Editor.exe"
File "${RELEASE_DIR}\BoE Character Editor.exe"
SetShellVarContext all
CreateShortCut "$SMPROGRAMS\Blades of Exile\Character Editor.lnk" "$INSTDIR\Char Editor.exe"
CreateShortCut "$SMPROGRAMS\Blades of Exile\Character Editor.lnk" "$INSTDIR\BoE Character Editor.exe"
SectionEnd
@@ -98,11 +107,11 @@ Section "Scenario Editor" Section3
; Set Section Files and Shortcuts
SetOutPath "$INSTDIR\"
File "..\Release\Scen Editor.exe"
File "${RELEASE_DIR}\BoE Scenario Editor.exe"
SetOutPath "$INSTDIR\Blades of Exile Base\"
File "..\Release\Blades of Exile Base\bladbase.exs"
File "${RELEASE_DIR}\Blades of Exile Base\bladbase.exs"
SetShellVarContext all
CreateShortCut "$SMPROGRAMS\Blades of Exile\Scenario Editor.lnk" "$INSTDIR\Scen Editor.exe"
CreateShortCut "$SMPROGRAMS\Blades of Exile\Scenario Editor.lnk" "$INSTDIR\BoE Scenario Editor.exe"
SectionEnd
@@ -113,60 +122,60 @@ Section /o "Documentation" Section4
; Set Section Files and Shortcuts
SetOutPath "$INSTDIR\doc\game"
File "..\..\..\doc\game\Contents.html"
File "..\..\..\doc\game\About.html"
File "..\..\..\doc\game\Tips.html"
File "..\..\..\doc\game\Intro.html"
File "..\..\..\doc\game\Screen.html"
File "..\..\..\doc\game\Menus.html"
File "..\..\..\doc\game\Town.html"
File "..\..\..\doc\game\Outdoors.html"
File "..\..\..\doc\game\Combat.html"
File "..\..\..\doc\game\Misc.html"
File "..\..\..\doc\game\Mage.html"
File "..\..\..\doc\game\Priest.html"
File "..\..\..\doc\game\Hints.html"
File "..\..\..\doc\game\Editor.html"
File "..\..\..\doc\game\Credits.html"
File "..\..\..\doc\game\Licensing.html"
File "..\..\..\doc\game\nav.js"
File "..\..\..\doc\game\style.css"
File "..\..\doc\game\Contents.html"
File "..\..\doc\game\About.html"
File "..\..\doc\game\Tips.html"
File "..\..\doc\game\Intro.html"
File "..\..\doc\game\Screen.html"
File "..\..\doc\game\Menus.html"
File "..\..\doc\game\Town.html"
File "..\..\doc\game\Outdoors.html"
File "..\..\doc\game\Combat.html"
File "..\..\doc\game\Misc.html"
File "..\..\doc\game\Mage.html"
File "..\..\doc\game\Priest.html"
File "..\..\doc\game\Hints.html"
File "..\..\doc\game\Editor.html"
File "..\..\doc\game\Credits.html"
File "..\..\doc\game\Licensing.html"
File "..\..\doc\game\nav.js"
File "..\..\doc\game\style.css"
SetOutPath "$INSTDIR\doc\editor"
File "..\..\..\doc\editor\Contents.html"
File "..\..\..\doc\editor\About.html"
File "..\..\..\doc\editor\Building.html"
File "..\..\..\doc\editor\Editing.html"
File "..\..\..\doc\editor\Outdoors.html"
File "..\..\..\doc\editor\Towns.html"
File "..\..\..\doc\editor\Terrain.html"
File "..\..\..\doc\editor\Monsters.html"
File "..\..\..\doc\editor\Items.html"
File "..\..\..\doc\editor\Advanced.html"
File "..\..\..\doc\editor\Specials.html"
File "..\..\..\doc\editor\Dialogue.html"
File "..\..\..\doc\editor\Graphics.html"
File "..\..\..\doc\editor\Testing.html"
File "..\..\..\doc\editor\nav.js"
File "..\..\..\doc\editor\style.css"
File "..\..\doc\editor\Contents.html"
File "..\..\doc\editor\About.html"
File "..\..\doc\editor\Building.html"
File "..\..\doc\editor\Editing.html"
File "..\..\doc\editor\Outdoors.html"
File "..\..\doc\editor\Towns.html"
File "..\..\doc\editor\Terrain.html"
File "..\..\doc\editor\Monsters.html"
File "..\..\doc\editor\Items.html"
File "..\..\doc\editor\Advanced.html"
File "..\..\doc\editor\Specials.html"
File "..\..\doc\editor\Dialogue.html"
File "..\..\doc\editor\Graphics.html"
File "..\..\doc\editor\Testing.html"
File "..\..\doc\editor\nav.js"
File "..\..\doc\editor\style.css"
SetOutPath "$INSTDIR\doc\editor\appendix"
File "..\..\..\doc\editor\appendix\Specials.html"
File "..\..\..\doc\editor\appendix\Items.html"
File "..\..\..\doc\editor\appendix\Monsters.html"
File "..\..\..\doc\editor\appendix\Terrain.html"
File "..\..\..\doc\editor\appendix\Sounds.html"
File "..\..\..\doc\editor\appendix\Messages.html"
File "..\..\..\doc\editor\appendix\Magic.html"
File "..\..\..\doc\editor\appendix\Examples.html"
File "..\..\doc\editor\appendix\Specials.html"
File "..\..\doc\editor\appendix\Items.html"
File "..\..\doc\editor\appendix\Monsters.html"
File "..\..\doc\editor\appendix\Terrain.html"
File "..\..\doc\editor\appendix\Sounds.html"
File "..\..\doc\editor\appendix\Messages.html"
File "..\..\doc\editor\appendix\Magic.html"
File "..\..\doc\editor\appendix\Examples.html"
SetOutPath "$INSTDIR\doc\img"
File "..\..\..\doc\img\background.gif"
File "..\..\..\doc\img\boe.gif"
File "..\..\..\doc\img\editormainmenu.png"
File "..\..\..\doc\img\editorsymbols.gif"
File "..\..\..\doc\img\edoutbtns.png"
File "..\..\..\doc\img\edtownbtns.png"
File "..\..\..\doc\img\invenbtn.gif"
File "..\..\..\doc\img\pcbtn.gif"
File "..\..\..\doc\img\terscr.gif"
File "..\..\doc\img\background.gif"
File "..\..\doc\img\boe.gif"
File "..\..\doc\img\editormainmenu.png"
File "..\..\doc\img\editorsymbols.gif"
File "..\..\doc\img\edoutbtns.png"
File "..\..\doc\img\edtownbtns.png"
File "..\..\doc\img\invenbtn.gif"
File "..\..\doc\img\pcbtn.gif"
File "..\..\doc\img\terscr.gif"
SectionEnd

View File

@@ -18,7 +18,12 @@ env.Install(path.join(data_dir, "shaders"), Glob("#src/tools/mask.*"))
# Scenarios
env.Install(path.join(install_dir, "Blades of Exile Scenarios"), Glob("Blades of Exile Scenarios/*.exs") + Glob("Blades of Exile Scenarios/*.meg"))
if str(platform) == "darwin":
scen_gfx = Glob("Blades of Exile Scenarios/*.meg")
elif str(platform) == "win32":
scen_gfx = Glob("Blades of Exile Scenarios/*.BMP")
env.Install(path.join(install_dir, "Blades of Exile Scenarios"), Glob("Blades of Exile Scenarios/*.exs") + scen_gfx)
env.Install(path.join(install_dir, "Blades of Exile Base"), Glob("Blades of Exile Bases/*.exs"))
have_xmllint = False

View File

@@ -7,13 +7,13 @@
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="main.nsi">
<None Include="..\..\..\pkg\win\main.nsi">
<Filter>Source Files</Filter>
</None>
<None Include="data.nsi">
<None Include="..\..\..\pkg\win\data.nsi">
<Filter>Source Files</Filter>
</None>
<None Include="gen-data.py">
<None Include="..\..\..\pkg\win\gen-data.py">
<Filter>Source Files</Filter>
</None>
<None Include="Makefile.mak" />

View File

@@ -1,14 +1,14 @@
all: Release\Install-OBoE.exe
all: Install-OBoE.exe Makefile.mak
Release\Install-OBoE.exe: main.nsi data.nsi
makensis main.nsi
Install-OBoE.exe: ..\..\..\pkg\win\main.nsi ..\..\..\pkg\win\data.nsi
makensis /DMSVC /DRELEASE_DIR=..\..\src\BoE.vsproj\Release ..\..\..\pkg\win\main.nsi
data.nsi: gen-data.py
python gen-data.py > data.nsi
..\..\..\pkg\win\data.nsi: ..\..\..\pkg\win\gen-data.py
python ..\..\..\pkg\win\gen-data.py ..\Release > ..\..\..\pkg\win\data.nsi
clean:
del data.nsi
del Release\Install-OBoE.exe
del ..\..\..\pkg\win\data.nsi
del Install-OBoE.exe
rebuild: clean all

View File

@@ -42,11 +42,12 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<TargetName>Character Editor</TargetName>
<TargetName>BoE Character Editor</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<TargetName>BoE Character Editor</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>

View File

@@ -42,11 +42,12 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<TargetName>Scenario Editor</TargetName>
<TargetName>BoE Scenario Editor</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<TargetName>BoE Scenario Editor</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>