aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--devtools/create_project/create_project.cpp5
-rw-r--r--devtools/create_project/create_project.h6
-rw-r--r--devtools/create_project/msbuild.cpp2
-rw-r--r--devtools/create_project/msvc.cpp7
-rw-r--r--devtools/create_project/msvc.h9
-rw-r--r--devtools/create_project/msvc10/create_project.vcxproj1
-rw-r--r--devtools/create_project/msvc10/create_project.vcxproj.filters3
-rw-r--r--devtools/create_project/msvc8/create_project.vcproj4
-rw-r--r--devtools/create_project/msvc9/create_project.vcproj4
-rw-r--r--devtools/create_project/scripts/installer.vbs170
-rw-r--r--devtools/create_project/scripts/postbuild.cmd41
-rw-r--r--devtools/create_project/visualstudio.cpp2
12 files changed, 236 insertions, 18 deletions
diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp
index a597ba36e9..affd8f8675 100644
--- a/devtools/create_project/create_project.cpp
+++ b/devtools/create_project/create_project.cpp
@@ -245,6 +245,9 @@ int main(int argc, char *argv[]) {
} else if (!std::strcmp(argv[i], "--build-events")) {
setup.runBuildEvents = true;
+ } else if (!std::strcmp(argv[i], "--installer")) {
+ setup.runBuildEvents = true;
+ setup.createInstaller = true;
} else {
std::cerr << "ERROR: Unknown parameter \"" << argv[i] << "\"\n";
return -1;
@@ -487,6 +490,8 @@ void displayHelp(const char *exe) {
" The default is \"9\", thus \"Visual Studio 2008\"\n"
" --build-events Run custom build events as part of the build\n"
" (default: false)\n"
+ " --installer Create NSIS installer after the build (implies --build-events)\n"
+ " (default: false)\n"
"\n"
"Engines settings:\n"
" --list-engines list all available engines and their default state\n"
diff --git a/devtools/create_project/create_project.h b/devtools/create_project/create_project.h
index c228c34898..8968610e99 100644
--- a/devtools/create_project/create_project.h
+++ b/devtools/create_project/create_project.h
@@ -220,10 +220,12 @@ struct BuildSetup {
StringList defines; ///< List of all defines for the build.
StringList libraries; ///< List of all external libraries required for the build.
- bool runBuildEvents;
+ bool runBuildEvents; ///< Run build events as part of the build (generate revision number and copy engine/theme data & needed files to the build folder
+ bool createInstaller; ///< Create NSIS installer after the build
BuildSetup() {
- runBuildEvents = false;
+ runBuildEvents = false;
+ createInstaller = false;
}
};
diff --git a/devtools/create_project/msbuild.cpp b/devtools/create_project/msbuild.cpp
index 9d8b9c0407..36ea710c82 100644
--- a/devtools/create_project/msbuild.cpp
+++ b/devtools/create_project/msbuild.cpp
@@ -275,7 +275,7 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
// Copy data files to the build folder
project << "\t\t<PostBuildEvent>\n"
"\t\t\t<Message>Copy data files to the build folder</Message>\n"
- "\t\t\t<Command>" << getPostBuildEvent(isWin32) << "</Command>\n"
+ "\t\t\t<Command>" << getPostBuildEvent(isWin32, setup.createInstaller) << "</Command>\n"
"\t\t</PostBuildEvent>\n";
}
}
diff --git a/devtools/create_project/msvc.cpp b/devtools/create_project/msvc.cpp
index 49998cd738..af3aa4a519 100644
--- a/devtools/create_project/msvc.cpp
+++ b/devtools/create_project/msvc.cpp
@@ -158,7 +158,7 @@ std::string MSVCProvider::getPreBuildEvent() const {
return cmdLine;
}
-std::string MSVCProvider::getPostBuildEvent(bool isWin32) const {
+std::string MSVCProvider::getPostBuildEvent(bool isWin32, bool createInstaller) const {
std::string cmdLine = "";
cmdLine = "@echo off\n"
@@ -168,7 +168,10 @@ std::string MSVCProvider::getPostBuildEvent(bool isWin32) const {
cmdLine += (isWin32) ? "x86" : "x64";
- cmdLine += " %SCUMMVM_LIBS%";
+ cmdLine += " %SCUMMVM_LIBS% ";
+
+ // Specify if installer needs to be built or not
+ cmdLine += (createInstaller ? "1" : "0");
cmdLine += "\n"
"EXIT /B0";
diff --git a/devtools/create_project/msvc.h b/devtools/create_project/msvc.h
index b2f2a5d33f..6c8ac33a76 100644
--- a/devtools/create_project/msvc.h
+++ b/devtools/create_project/msvc.h
@@ -89,11 +89,14 @@ protected:
std::string getPreBuildEvent() const;
/**
- * Get the command line for copying data files to the build directory
+ * Get the command line for copying data files to the build directory.
*
- * @param isWin32 Bitness of property file
+ * @param isWin32 Bitness of property file.
+ * @param createInstaller true to NSIS create installer
+ *
+ * @return The post build event.
*/
- std::string getPostBuildEvent(bool isWin32) const;
+ std::string getPostBuildEvent(bool isWin32, bool createInstaller) const;
};
} // End of CreateProjectTool namespace
diff --git a/devtools/create_project/msvc10/create_project.vcxproj b/devtools/create_project/msvc10/create_project.vcxproj
index 15ce217bfc..bf5e415b5d 100644
--- a/devtools/create_project/msvc10/create_project.vcxproj
+++ b/devtools/create_project/msvc10/create_project.vcxproj
@@ -108,6 +108,7 @@ xcopy /Y $(TargetPath) $(SolutionDir)\..\..\..\dists\codeblocks\</Command>
<ClInclude Include="..\visualstudio.h" />
</ItemGroup>
<ItemGroup>
+ <None Include="..\scripts\installer.vbs" />
<None Include="..\scripts\postbuild.cmd" />
<None Include="..\scripts\prebuild.cmd" />
<None Include="..\scripts\revision.vbs" />
diff --git a/devtools/create_project/msvc10/create_project.vcxproj.filters b/devtools/create_project/msvc10/create_project.vcxproj.filters
index 42db5aa97e..b5e870824e 100644
--- a/devtools/create_project/msvc10/create_project.vcxproj.filters
+++ b/devtools/create_project/msvc10/create_project.vcxproj.filters
@@ -58,5 +58,8 @@
<None Include="..\scripts\postbuild.cmd">
<Filter>scripts</Filter>
</None>
+ <None Include="..\scripts\installer.vbs">
+ <Filter>scripts</Filter>
+ </None>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/devtools/create_project/msvc8/create_project.vcproj b/devtools/create_project/msvc8/create_project.vcproj
index 9cd833ea23..639b23d6e7 100644
--- a/devtools/create_project/msvc8/create_project.vcproj
+++ b/devtools/create_project/msvc8/create_project.vcproj
@@ -232,6 +232,10 @@
RelativePath="..\scripts\revision.vbs"
>
</File>
+ <File
+ RelativePath="..\scripts\installer.vbs"
+ >
+ </File>
</Filter>
</Files>
<Globals>
diff --git a/devtools/create_project/msvc9/create_project.vcproj b/devtools/create_project/msvc9/create_project.vcproj
index 4e0375c35e..f56cbd711c 100644
--- a/devtools/create_project/msvc9/create_project.vcproj
+++ b/devtools/create_project/msvc9/create_project.vcproj
@@ -233,6 +233,10 @@
RelativePath="..\scripts\revision.vbs"
>
</File>
+ <File
+ RelativePath="..\scripts\installer.vbs"
+ >
+ </File>
</Filter>
</Files>
<Globals>
diff --git a/devtools/create_project/scripts/installer.vbs b/devtools/create_project/scripts/installer.vbs
new file mode 100644
index 0000000000..3348b692e5
--- /dev/null
+++ b/devtools/create_project/scripts/installer.vbs
@@ -0,0 +1,170 @@
+'
+' ScummVM - Graphic Adventure Engine
+'
+' ScummVM is the legal property of its developers, whose names
+' are too numerous to list here. Please refer to the COPYRIGHT
+' file distributed with this source distribution.
+'
+' This program is free software; you can redistribute it and/or
+' modify it under the terms of the GNU General Public License
+' as published by the Free Software Foundation, version 2
+' of the License.
+'
+' This program is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with this program; if not, write to the Free Software
+' Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+'
+'/
+
+Option Explicit
+
+Dim FSO : Set FSO = CreateObject("Scripting.FileSystemObject")
+Dim WshShell : Set WshShell = CreateObject("WScript.Shell")
+
+' Folders
+Dim rootFolder : rootFolder = ""
+Dim targetFolder : targetFolder = ""
+
+' Parse our command line arguments
+If ParseCommandLine() Then
+ CreateInstaller()
+End If
+
+'////////////////////////////////////////////////////////////////
+'// Installer creation
+'////////////////////////////////////////////////////////////////
+Sub CreateInstaller()
+ ' Get nsis installation folder
+ Dim nsisPath : nsisPath = GetNSISPath()
+ If (nsisPath = "") Then
+ Exit Sub
+ End If
+
+ ' Build command line
+ Dim commandLine : commandLine = """" & nsisPath & "\makensis.exe"" /V2" & _
+ " /Dtop_srcdir=""" & rootFolder & """" & _
+ " /Dbuild_dir=""" & targetFolder & """" & _
+ " /Dtext_dir=""" & targetFolder & """" & _
+ " """ & rootFolder & "\dists\nsis\scummvm.nsi"""
+
+ Dim oExec: Set oExec = WshShell.Exec(commandline)
+ If Err.Number <> 0 Then
+ Wscript.StdErr.WriteLine "Error running makensis.exe!"
+ Exit Sub
+ End If
+
+ ' Wait till the application is finished ...
+ Dim ostdOut : Set oStdOut = oExec.StdOut
+ Do While oExec.Status = 0
+ If Not ostdOut.AtEndOfStream Then
+ Wscript.StdErr.WriteLine ostdOut.ReadAll
+ End If
+
+ WScript.Sleep 100
+ Loop
+
+ If oExec.ExitCode <> 0 Then
+ Wscript.StdErr.WriteLine "Error while creating installer!"
+ Exit Sub
+ End If
+End Sub
+
+Function GetNSISPath()
+ ' Get the directory where NSIS (should) reside(s)
+ Dim sNSIS
+
+ ' First, try with 32-bit architecture
+ sNSIS = ReadRegistryKey("HKLM", "SOFTWARE\NSIS", "", 32)
+
+ If sNSIS = "" Or IsNull(sNSIS) Then
+ ' No 32-bit version of TortoiseSVN installed, try 64-bit version (doesn't hurt on 32-bit machines, it returns nothing or is ignored)
+ sNSIS = ReadRegistryKey("HKLM", "SOFTWARE\NSIS", "", 64)
+ End If
+
+ ' Check if Tortoise is present
+ If sNSIS = "" Then
+ Wscript.StdErr.WriteLine "NSIS not installed!"
+ Exit Function
+ End If
+
+ GetNSISPath = sNSIS
+End Function
+
+'////////////////////////////////////////////////////////////////
+'// Utilities
+'////////////////////////////////////////////////////////////////
+Function ParseCommandLine()
+ ParseCommandLine = True
+
+ If Wscript.Arguments.Count <> 2 Then
+ Wscript.StdErr.WriteLine "[Error] Invalid number of arguments (was: " & Wscript.Arguments.Count & ", expected: 2)"
+
+ ParseCommandLine = False
+ Exit Function
+ End If
+
+ ' Get our arguments
+ rootFolder = Wscript.Arguments.Item(0)
+ targetFolder = Wscript.Arguments.Item(1)
+
+ ' Check that the folders are valid
+ If Not FSO.FolderExists(rootFolder) Then
+ Wscript.StdErr.WriteLine "[Error] Invalid root folder (" & rootFolder & ")"
+
+ ParseCommandLine = False
+ Exit Function
+ End If
+
+ If Not FSO.FolderExists(targetFolder) Then
+ Wscript.StdErr.WriteLine "[Error] Invalid target folder (" & targetFolder & ")"
+
+ ParseCommandLine = False
+ Exit Function
+ End If
+
+ ' Set absolute paths
+ rootFolder = FSO.GetAbsolutePathName(rootFolder)
+ targetFolder = FSO.GetAbsolutePathName(targetFolder)
+End Function
+
+Function ReadRegistryKey(shive, subkey, valuename, architecture)
+ Dim hiveKey, objCtx, objLocator, objServices, objReg, Inparams, Outparams
+
+ ' First, get the Registry Provider for the requested architecture
+ Set objCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
+ objCtx.Add "__ProviderArchitecture", architecture ' Must be 64 of 32
+ Set objLocator = CreateObject("Wbemscripting.SWbemLocator")
+ Set objServices = objLocator.ConnectServer("","root\default","","",,,,objCtx)
+ Set objReg = objServices.Get("StdRegProv")
+
+ ' Check the hive and give it the right value
+ Select Case shive
+ Case "HKCR", "HKEY_CLASSES_ROOT"
+ hiveKey = &h80000000
+ Case "HKCU", "HKEY_CURRENT_USER"
+ hiveKey = &H80000001
+ Case "HKLM", "HKEY_LOCAL_MACHINE"
+ hiveKey = &h80000002
+ Case "HKU", "HKEY_USERS"
+ hiveKey = &h80000003
+ Case "HKCC", "HKEY_CURRENT_CONFIG"
+ hiveKey = &h80000005
+ Case "HKDD", "HKEY_DYN_DATA" ' Only valid for Windows 95/98
+ hiveKey = &h80000006
+ Case Else
+ MsgBox "Hive not valid (ReadRegistryKey)"
+ End Select
+
+ Set Inparams = objReg.Methods_("GetStringValue").Inparameters
+ Inparams.Hdefkey = hiveKey
+ Inparams.Ssubkeyname = subkey
+ Inparams.Svaluename = valuename
+ Set Outparams = objReg.ExecMethod_("GetStringValue", Inparams,,objCtx)
+
+ ReadRegistryKey = Outparams.SValue
+End Function \ No newline at end of file
diff --git a/devtools/create_project/scripts/postbuild.cmd b/devtools/create_project/scripts/postbuild.cmd
index 6c062f7ab1..aacf7255d0 100644
--- a/devtools/create_project/scripts/postbuild.cmd
+++ b/devtools/create_project/scripts/postbuild.cmd
@@ -1,34 +1,49 @@
-REM @echo off
+@echo off
REM ---------------------------------------------------------------
REM -- Post-Build Script
REM ---------------------------------------------------------------
REM
REM Copy engine data, themes, translation and required dlls to the
-REM output folder.
+REM output folder and optionnaly create an installer
REM
REM Expected parameters
REM Root folder
REM Output folder
REM Architecture
REM Libs folder
+REM Installer ("1" to build, "0" to skip)
if "%~1"=="" goto error_root
if "%~2"=="" goto error_output
if "%~3"=="" goto error_arch
if "%~4"=="" goto error_libs
+if "%~5"=="" goto error_installer
echo Copying data files
echo.
-REM Copy files
-xcopy /F /Y "%~1/dists/engine-data/*.dat" %~2 > NUL 2>&1
-xcopy /F /Y "%~1/dists/engine-data/*.tbl" %~2 > NUL 2>&1
-xcopy /F /Y "%~1/dists/engine-data/*.cpt" %~2 > NUL 2>&1
-xcopy /F /Y "%~1/dists/engine-data/README" %~2 > NUL 2>&1
-xcopy /F /Y "%~1/gui/themes/*.zip" %~2 > NUL 2>&1
+xcopy /F /Y "%~1/AUTHORS" %~2 > NUL 2>&1
+xcopy /F /Y "%~1/COPYING.GPL" %~2 > NUL 2>&1
+xcopy /F /Y "%~1/COPYING" %~2 > NUL 2>&1
+xcopy /F /Y "%~1/COPYING.LGPL" %~2 > NUL 2>&1
+xcopy /F /Y "%~1/COPYRIGHT" %~2 > NUL 2>&1
+xcopy /F /Y "%~1/NEWS" %~2 > NUL 2>&1
+xcopy /F /Y "%~1/README" %~2 > NUL 2>&1
+
+xcopy /F /Y "%~1/dists/engine-data/*.dat" %~2 > NUL 2>&1
+xcopy /F /Y "%~1/dists/engine-data/*.tbl" %~2 > NUL 2>&1
+xcopy /F /Y "%~1/dists/engine-data/*.cpt" %~2 > NUL 2>&1
+xcopy /F /Y "%~1/gui/themes/*.zip" %~2 > NUL 2>&1
xcopy /F /Y "%~1/gui/themes/translations.dat" %~2 > NUL 2>&1
-xcopy /F /Y "%~4/lib/%~3/SDL.dll" %~2 > NUL 2>&1
+xcopy /F /Y "%~4/lib/%~3/SDL.dll" %~2 > NUL 2>&1
+
+if "%~5"=="0" goto done
+
+echo Running installer script
+echo.
+@call cscript "%~1/devtools/create_project/scripts/installer.vbs" %~1 %~2 1>NUL
+if not %errorlevel% == 0 goto error_script
goto done
:error_root
@@ -47,5 +62,13 @@ goto done
echo Invalid libs folder (%~4)!
goto done
+:error_installer
+echo Invalid installer parameter. Should be "0" or "1" (was %~5)!
+goto done
+
+:error_script:
+echo An error occured while running the installer script!
+goto done
+
:done
exit /B0
diff --git a/devtools/create_project/visualstudio.cpp b/devtools/create_project/visualstudio.cpp
index 2997e3096a..e405e42e54 100644
--- a/devtools/create_project/visualstudio.cpp
+++ b/devtools/create_project/visualstudio.cpp
@@ -63,7 +63,7 @@ int VisualStudioProvider::getVisualStudioVersion() {
"\t\t\t\tCommandLine=\"" << getPreBuildEvent() << "\"\n" \
"\t\t\t/>\n" \
"\t\t\t<Tool\tName=\"VCPostBuildEventTool\"\n" \
- "\t\t\t\tCommandLine=\"" << getPostBuildEvent(isWin32) << "\"\n" \
+ "\t\t\t\tCommandLine=\"" << getPostBuildEvent(isWin32, setup.createInstaller) << "\"\n" \
"\t\t\t/>\n"; \
}