DXGL r212 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r211‎ | r212 | r213 >
Date:00:49, 11 July 2012
Author:admin
Status:new
Tags:
Comment:
Add installer to build tool.
Add installer project to automatically build installer.
Create unique name for debug installers.
Update readme.
Modified paths:
  • /Installer (modified) (history)
  • /Installer/Installer.vcxproj (added) (history)
  • /Installer/Installer.vcxproj.filters (added) (history)
  • /Installer/dxgl.nsi (modified) (history)
  • /ReadMe.txt (modified) (history)
  • /buildtool/buildtool.cpp (modified) (history)
  • /dxgl.sln (modified) (history)

Diff [purge]

Index: Installer/Installer.vcxproj
@@ -0,0 +1,80 @@
 2+<?xml version="1.0" encoding="utf-8"?>
 3+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 4+ <ItemGroup Label="ProjectConfigurations">
 5+ <ProjectConfiguration Include="Debug|Win32">
 6+ <Configuration>Debug</Configuration>
 7+ <Platform>Win32</Platform>
 8+ </ProjectConfiguration>
 9+ <ProjectConfiguration Include="Release|Win32">
 10+ <Configuration>Release</Configuration>
 11+ <Platform>Win32</Platform>
 12+ </ProjectConfiguration>
 13+ </ItemGroup>
 14+ <PropertyGroup Label="Globals">
 15+ <ProjectGuid>{4DC98095-5F42-4A44-962C-346ABEE2C9B6}</ProjectGuid>
 16+ <RootNamespace>Installer</RootNamespace>
 17+ </PropertyGroup>
 18+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
 19+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
 20+ <ConfigurationType>Application</ConfigurationType>
 21+ <UseDebugLibraries>true</UseDebugLibraries>
 22+ <CharacterSet>MultiByte</CharacterSet>
 23+ </PropertyGroup>
 24+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
 25+ <ConfigurationType>Application</ConfigurationType>
 26+ <UseDebugLibraries>false</UseDebugLibraries>
 27+ <WholeProgramOptimization>true</WholeProgramOptimization>
 28+ <CharacterSet>MultiByte</CharacterSet>
 29+ </PropertyGroup>
 30+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
 31+ <ImportGroup Label="ExtensionSettings">
 32+ </ImportGroup>
 33+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
 34+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
 35+ </ImportGroup>
 36+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
 37+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
 38+ </ImportGroup>
 39+ <PropertyGroup Label="UserMacros" />
 40+ <PropertyGroup />
 41+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
 42+ <ClCompile>
 43+ <WarningLevel>Level3</WarningLevel>
 44+ <Optimization>Disabled</Optimization>
 45+ </ClCompile>
 46+ <Link>
 47+ <GenerateDebugInformation>true</GenerateDebugInformation>
 48+ </Link>
 49+ <PostBuildEvent>
 50+ <Command>$(OutDir)buildtool.exe makeinstaller $(ProjectDir)dxgl.nsi</Command>
 51+ </PostBuildEvent>
 52+ <PostBuildEvent>
 53+ <Message>Building installer...</Message>
 54+ </PostBuildEvent>
 55+ </ItemDefinitionGroup>
 56+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
 57+ <ClCompile>
 58+ <WarningLevel>Level3</WarningLevel>
 59+ <Optimization>MaxSpeed</Optimization>
 60+ <FunctionLevelLinking>true</FunctionLevelLinking>
 61+ <IntrinsicFunctions>true</IntrinsicFunctions>
 62+ </ClCompile>
 63+ <Link>
 64+ <GenerateDebugInformation>true</GenerateDebugInformation>
 65+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
 66+ <OptimizeReferences>true</OptimizeReferences>
 67+ </Link>
 68+ <PostBuildEvent>
 69+ <Command>$(OutDir)buildtool.exe makeinstaller $(ProjectDir)dxgl.nsi</Command>
 70+ </PostBuildEvent>
 71+ <PostBuildEvent>
 72+ <Message>Building installer...</Message>
 73+ </PostBuildEvent>
 74+ </ItemDefinitionGroup>
 75+ <ItemGroup>
 76+ <None Include="dxgl.nsi" />
 77+ </ItemGroup>
 78+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
 79+ <ImportGroup Label="ExtensionTargets">
 80+ </ImportGroup>
 81+</Project>
\ No newline at end of file
Index: Installer/Installer.vcxproj.filters
@@ -0,0 +1,6 @@
 2+<?xml version="1.0" encoding="utf-8"?>
 3+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 4+ <ItemGroup>
 5+ <None Include="dxgl.nsi" />
 6+ </ItemGroup>
 7+</Project>
\ No newline at end of file
Index: Installer/dxgl.nsi
@@ -70,7 +70,11 @@
7171 !else
7272 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
7373 !endif
 74+!ifdef _DEBUG
 75+OutFile "DXGL-${PRODUCT_VERSION}-win32-Debug.exe"
 76+!else
7477 OutFile "DXGL-${PRODUCT_VERSION}-win32.exe"
 78+!endif
7579 InstallDir "$PROGRAMFILES\DXGL"
7680 InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
7781 ShowInstDetails show
Index: Installer
Property changes on: Installer
___________________________________________________________________
Modified: svn:ignore
## -1 +1,4 ##
7882 *.exe
 83+Debug
 84+Release
 85+Installer.vcxproj.user
Index: ReadMe.txt
@@ -1,4 +1,4 @@
2 -DXGL 0.2.3
 2+DXGL 0.3.0
33 http://www.williamfeely.info/wiki/DXGL
44
55 == Introduction ==
Index: buildtool/buildtool.cpp
@@ -221,7 +221,39 @@
222222
223223 int MakeInstaller(char *path)
224224 {
225 - // Registry path: HKEY_LOCAL_MACHINE\SOFTWARE\NSIS\(Default)
 225+ HKEY hKey;
 226+ bool foundnsis = false;
 227+ char nsispath[(MAX_PATH+1)*2];
 228+ DWORD buffersize = MAX_PATH+1;
 229+ if(RegOpenKeyExA(HKEY_LOCAL_MACHINE,"Software\\NSIS",0,KEY_READ,&hKey) == ERROR_SUCCESS)
 230+ {
 231+ if(RegQueryValueExA(hKey,"",NULL,NULL,(LPBYTE)nsispath,&buffersize) == ERROR_SUCCESS)
 232+ {
 233+ strcat(nsispath,"\\makensis.exe");
 234+ PROCESS_INFORMATION process;
 235+ STARTUPINFOA startinfo;
 236+ ZeroMemory(&startinfo,sizeof(STARTUPINFOA));
 237+ startinfo.cb = sizeof(STARTUPINFOA);
 238+ strcat(nsispath," ");
 239+ strcat(nsispath,path);
 240+ if(CreateProcessA(NULL,nsispath,NULL,NULL,FALSE,0,NULL,NULL,&startinfo,&process))
 241+ {
 242+ foundnsis = true;
 243+ WaitForSingleObject(process.hProcess,INFINITE);
 244+ CloseHandle(process.hProcess);
 245+ CloseHandle(process.hThread);
 246+ }
 247+ }
 248+ RegCloseKey(hKey);
 249+ }
 250+ if(!foundnsis)
 251+ {
 252+ int result = MessageBoxA(NULL,"Could not find NSIS, would you like to download it?","NSIS not found",
 253+ MB_YESNO|MB_ICONERROR);
 254+ if(result == IDYES) ShellExecuteA(NULL,"open","http://nsis.sourceforge.net/Main_Page",NULL,NULL,SW_SHOWNORMAL);
 255+ cout << "ERROR: NSIS not found." << endl;
 256+ return -1;
 257+ }
226258 return 0;
227259 }
228260
Index: dxgl.sln
@@ -32,6 +32,15 @@
3333 EndProject
3434 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "buildtool", "buildtool\buildtool.vcxproj", "{34883A93-DFE4-42EF-9DAE-BEE4D3FC87D0}"
3535 EndProject
 36+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Installer", "Installer\Installer.vcxproj", "{4DC98095-5F42-4A44-962C-346ABEE2C9B6}"
 37+ ProjectSection(ProjectDependencies) = postProject
 38+ {8041FD11-3A2E-4EE9-A3FF-A9755803B7FB} = {8041FD11-3A2E-4EE9-A3FF-A9755803B7FB}
 39+ {9F051466-EA2C-4195-80B1-1B7C5B3F4AC2} = {9F051466-EA2C-4195-80B1-1B7C5B3F4AC2}
 40+ {3A14A469-504B-4E32-8F23-063F8A2A8B5D} = {3A14A469-504B-4E32-8F23-063F8A2A8B5D}
 41+ {34883A93-DFE4-42EF-9DAE-BEE4D3FC87D0} = {34883A93-DFE4-42EF-9DAE-BEE4D3FC87D0}
 42+ {DF380DA1-90DE-4174-9A1F-EEC16C5B5879} = {DF380DA1-90DE-4174-9A1F-EEC16C5B5879}
 43+ EndProjectSection
 44+EndProject
3645 Global
3746 GlobalSection(SolutionConfigurationPlatforms) = preSolution
3847 Debug no DXGL|Win32 = Debug no DXGL|Win32
@@ -96,6 +105,14 @@
97106 {34883A93-DFE4-42EF-9DAE-BEE4D3FC87D0}.Release no DXGL|Win32.Build.0 = Release|Win32
98107 {34883A93-DFE4-42EF-9DAE-BEE4D3FC87D0}.Release|Win32.ActiveCfg = Release|Win32
99108 {34883A93-DFE4-42EF-9DAE-BEE4D3FC87D0}.Release|Win32.Build.0 = Release|Win32
 109+ {4DC98095-5F42-4A44-962C-346ABEE2C9B6}.Debug no DXGL|Win32.ActiveCfg = Debug|Win32
 110+ {4DC98095-5F42-4A44-962C-346ABEE2C9B6}.Debug no DXGL|Win32.Build.0 = Debug|Win32
 111+ {4DC98095-5F42-4A44-962C-346ABEE2C9B6}.Debug|Win32.ActiveCfg = Debug|Win32
 112+ {4DC98095-5F42-4A44-962C-346ABEE2C9B6}.Debug|Win32.Build.0 = Debug|Win32
 113+ {4DC98095-5F42-4A44-962C-346ABEE2C9B6}.Release no DXGL|Win32.ActiveCfg = Release|Win32
 114+ {4DC98095-5F42-4A44-962C-346ABEE2C9B6}.Release no DXGL|Win32.Build.0 = Release|Win32
 115+ {4DC98095-5F42-4A44-962C-346ABEE2C9B6}.Release|Win32.ActiveCfg = Release|Win32
 116+ {4DC98095-5F42-4A44-962C-346ABEE2C9B6}.Release|Win32.Build.0 = Release|Win32
100117 EndGlobalSection
101118 GlobalSection(SolutionProperties) = preSolution
102119 HideSolutionNode = FALSE