Skip to content

Commit

Permalink
Update Visual Studio build scripts. (#120)
Browse files Browse the repository at this point in the history
Updated build scripts.
ZipPack now appends assembly version to the zip package name.
Updated readme for KSP v1.3.0
Added new include file Database/UIData.cs to .csproj file.
  • Loading branch information
PiezPiedPy authored and ShotgunNinja committed Apr 30, 2017
1 parent 01815e0 commit f147f13
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 29 deletions.
30 changes: 22 additions & 8 deletions misc/VisualStudio/Kerbalism.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@
<BaseAddress>4194304</BaseAddress>
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<FileAlignment>4096</FileAlignment>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>C:\Games\KSP\GameData\Kerbalism\</OutputPath>
<DebugSymbols>True</DebugSymbols>
<DebugType>Full</DebugType>
<Optimize>True</Optimize>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE;DEVELOPMENT;ENABLE_PROFILER</DefineConstants>
<Optimize>False</Optimize>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE;DEVELOPMENT;ENABLE_PROFILER;KERBALISM_PROFILER</DefineConstants>
<StartAction>Project</StartAction>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath>
<OutputPath>..\..\..\..\..\KSP_Dev\GameData\Kerbalism\</OutputPath>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
Expand All @@ -54,8 +54,9 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<OutputPath>..\..\..\..\..\KSP_Dev\GameData\Kerbalism\</OutputPath>
<ErrorReport>none</ErrorReport>
<ErrorReport>prompt</ErrorReport>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<DefineConstants>TRACE;DEBUG;DEVELOPMENT;ENABLE_PROFILER;KERBALISM_PROFILER</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
Expand Down Expand Up @@ -120,6 +121,7 @@
<Compile Include="Database\LandmarkData.cs" />
<Compile Include="Database\RuleData.cs" />
<Compile Include="Database\SupplyData.cs" />
<Compile Include="Database\UIData.cs" />
<Compile Include="Database\VesselData.cs" />
<Compile Include="External\RemoteTech.cs" />
<Compile Include="External\SCANsat.cs" />
Expand Down Expand Up @@ -196,8 +198,20 @@
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="PostBuildMacros">
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
<Output TaskParameter="Assemblies" ItemName="Targets" />
</GetAssemblyIdentity>
<ItemGroup>
<VersionNumber Include="@(Targets->'%(Version)')"/>
</ItemGroup>
</Target>
<PropertyGroup>
<PostBuildEvent>if $(ConfigurationName)==Debug (call "$(ProjectDir)..\misc\VisualStudio\buildscripts\UnityDebug\prepare-debug.bat" "$(OutDir)")
if $(ConfigurationName)==Release (call "$(ProjectDir)..\misc\VisualStudio\buildscripts\ZipPack\build-package.bat" "$(OutDir)")</PostBuildEvent>
<PostBuildEventDependsOn>
$(PostBuildEventDependsOn);
PostBuildMacros;
</PostBuildEventDependsOn>
<PostBuildEvent>if $(ConfigurationName)==Debug (call "$(ProjectDir)..\misc\VisualStudio\buildscripts\UnityDebug\prepare-debug.bat" $(TargetName))
if $(ConfigurationName)==Release (call "$(ProjectDir)..\misc\VisualStudio\buildscripts\ZipPack\build-package.bat" $(TargetName) -@(VersionNumber))</PostBuildEvent>
</PropertyGroup>
</Project>
6 changes: 3 additions & 3 deletions misc/VisualStudio/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ A set of instructions and files to help set up Kerbalism for:
#
### SETUP
For building and/or debugging Kerbalism with Visual Studio or Unity Editor you will need to download and install the exact version of Unity Editor that was used to build the version of KSP you are working with.
- The Unity Editor for **KSP v1.2.2** is **Unity v5.4.0.p4** and can be downloaded here: [UnitySetup64-5.4.0p4.exe](http://beta.unity3d.com/download/b15b5ae035b7/Windows64EditorInstaller/UnitySetup64-5.4.0p4.exe)
- The Unity Editor for **KSP v1.3.0** is **Unity v5.4.0.p4** and can be downloaded here: [UnitySetup64-5.4.0p4.exe](http://beta.unity3d.com/download/b15b5ae035b7/Windows64EditorInstaller/UnitySetup64-5.4.0p4.exe)

If you want to debug with Visual Studio then you will need the **UnityVS Extension** which you can download and install by using the **Tools->Extensions and Updates** window in Visual Studio.

Expand All @@ -30,8 +30,8 @@ For building and/or debugging Kerbalism with Visual Studio or Unity Editor you w
- Open the copied *"src\Kerbalism.sln"* file with Visual Studio and then open the **Properties** page and goto the **Build Events** tab.
- Enter the code below into the **Post-build event command line** box.
```
if $(ConfigurationName)==Debug (call "$(ProjectDir)..\misc\VisualStudio\buildscripts\UnityDebug\prepare-debug.bat" "$(OutDir)")
if $(ConfigurationName)==Release (call "$(ProjectDir)..\misc\VisualStudio\buildscripts\ZipPack\build-package.bat" "$(OutDir)")
if $(ConfigurationName)==Debug (call "$(ProjectDir)..\misc\VisualStudio\buildscripts\UnityDebug\prepare-debug.bat" $(TargetName))
if $(ConfigurationName)==Release (call "$(ProjectDir)..\misc\VisualStudio\buildscripts\ZipPack\build-package.bat" $(TargetName) -v@(VersionNumber))
```
- Change to the **Reference Paths** tab and add a path to your KSP dev install *"\KSP_x64_Data\Managed"* folder.
- Goto **Debug Menu->Options** and clear the **Enable Edit and Continue** checkbox.
Expand Down
10 changes: 3 additions & 7 deletions misc/VisualStudio/buildscripts/UnityDebug/prepare-debug.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@ rem see https://github.com/ShotgunNinja/Kerbalism/tree/master/misc/VisualStudio/
@echo off

rem get parameters that are passed by visual studio post build event
SET outDllPath=%1
SET TargetName=%1

rem make sure the initial working directory is the one containing the current script
SET scriptPath=%~dp0
SET initialWD=%CD%

echo Generating Unity Monodevelop Debug file...
echo Kerbalism.dll -^> %outDllPath%Kerbalism.dll.mdb
cd "%outDllPath%"
"%scriptPath%\pdb2mdb.exe" Kerbalism.dll

cd "%initialWD%"
echo %TargetName%.dll -^> %TargetName%.dll.mdb
"%scriptPath%\pdb2mdb.exe" %TargetName%.dll
24 changes: 13 additions & 11 deletions misc/VisualStudio/buildscripts/ZipPack/build-package.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,37 @@ rem see https://github.com/ShotgunNinja/Kerbalism/tree/master/misc/VisualStudio/
@echo off

rem get parameters that are passed by visual studio post build event
SET outDllPath=%1
SET TargetName=%1
SET Dllversion=%2

rem make sure the initial working directory is the one containing the current script
SET scriptPath=%~dp0
SET rootPath=%scriptPath%..\..\..\..\
SET initialWD=%CD%

echo Generating Kerbalism Release Package...
cd "%scriptPath%..\..\..\..\"
xcopy /y "%outDllPath%Kerbalism.dll" GameData\Kerbalism\Kerbalism.dll*
echo Generating %TargetName% Release Package...
cd "%rootPath%"
xcopy /y "%initialWD%\%TargetName%.dll" GameData\%TargetName%\%TargetName%.dll*

IF EXIST package\ rd /s /q package
mkdir package
cd package
mkdir GameData
cd GameData
mkdir Kerbalism
cd Kerbalism
mkdir "%TargetName%"
cd "%TargetName%"

xcopy /y /e ..\..\..\GameData\Kerbalism\* .
xcopy /y /e "..\..\..\GameData\%TargetName%\*" .
xcopy /y ..\..\..\CHANGELOG.md .
xcopy /y ..\..\..\License .
xcopy /y ..\..\..\README.md .

echo.
echo Compressing Kerbalism Release Package...
IF EXIST ..\..\..\Kerbalism.zip del ..\..\..\Kerbalism.zip
"%scriptPath%7za.exe" a ..\..\..\Kerbalism.zip ..\..\GameData
echo Compressing %TargetName% Release Package...
IF EXIST "%rootPath%%TargetName%*.zip" del "%rootPath%%TargetName%*.zip"
"%scriptPath%7za.exe" a "..\..\..\%TargetName%%Dllversion%.zip" ..\..\GameData

cd ..\..\..\
cd "%rootPath%"
rd /s /q package

cd "%initialWD%"

0 comments on commit f147f13

Please sign in to comment.