easier setup process

added MG Pipeline tool support
This commit is contained in:
Mike 2019-02-10 17:48:18 -08:00
parent 264f0efe18
commit 5e618eca79
8 changed files with 80 additions and 137 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ FNA/
fnalibs/
project_name/bin/
project_name/obj/
project_name/CompiledContent/.mgstats

View File

@ -91,4 +91,16 @@ else
fi
if [[ $shouldDownloadLibs =~ ^[Yy]$ ]]; then
getLibs
fi
fi
# Rename project
read -p "Enter the project name to use for your folder and csproj file: " newProjectName
sed -i '' "s/project_name/$newProjectName/g" project_name/project_name.csproj
sed -i '' "s/project_name/$newProjectName/g" project_name/Game1.cs
sed -i '' "s/project_name/$newProjectName/g" project_name/Program.cs
sed -i '' "s/project_name/$newProjectName/g" project_name/.vscode/tasks.json
sed -i '' "s/project_name/$newProjectName/g" project_name/.vscode/launch.json
mv project_name/project_name.csproj "project_name/$newProjectName.csproj"
mv project_name "$newProjectName"

View File

@ -1,17 +0,0 @@
# Compiles all .fx files found in the project's Content directory.
# Intended for usage with VS Code Build Tasks tooling.
# You may need to change the path to fxc.exe depending on your installation.
Write-Output "Starting build process..."
Get-ChildItem ".\Content\" -R -Filter *.fx |
Foreach-Object {
$fileFullname = $_.FullName
$fileBasename = $_.BaseName
$fileDirectory = $_.Directory.FullName
& 'C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\bin\x86\fxc.exe' `
/T fx_2_0 $fileFullname /Fo "$fileDirectory\$fileBasename.fxb"
Write-Output ""
}

View File

@ -6,4 +6,12 @@
// This just circumvents annoying default behavior with the C# extension...
// If you really like Code Lens, feel free to change this.
"csharp.referencesCodeLens.enabled": false,
"files.exclude": {
"obj": true,
"bin": true,
"CompiledContent/bin": true,
"CompiledContent/obj": true,
"CompiledContent/.mgstats": true
}
}

View File

@ -88,6 +88,28 @@
"command": "& ${workspaceFolder}/.vscode/buildEffects.ps1"
},
"problemMatcher": "$msCompile"
}
},
{
"label": "Build Content",
"type": "shell",
"group": "build",
"command": "mono /Applications/Pipeline.app/Contents/MonoBundle/MGCB.exe /@:Content.mgcb",
"options": {
"cwd": "${workspaceFolder}/CompiledContent"
},
"problemMatcher": "$msCompile"
},
{
"label": "Force Build Content",
"type": "shell",
"group": "build",
"command": "mono /Applications/Pipeline.app/Contents/MonoBundle/MGCB.exe /@:Content.mgcb -r",
"options": {
"cwd": "${workspaceFolder}/CompiledContent"
},
"problemMatcher": "$msCompile"
},
]
}

View File

@ -0,0 +1,18 @@
#----------------------------- Global Properties ----------------------------#
/outputDir:bin/$(Platform)
/intermediateDir:obj/$(Platform)
/platform:DesktopGL
/config:
/profile:HiDef
/compress:False
#-------------------------------- References --------------------------------#
/reference:../../Nez.FNA/Nez/Nez.PipelineImporter/bin/Debug/Ionic.ZLib.dll
/reference:../../Nez.FNA/Nez/Nez.PipelineImporter/bin/Debug/Newtonsoft.Json.dll
/reference:../../Nez.FNA/Nez/Nez.PipelineImporter/bin/Debug/Nez.PipelineImporter.dll
/reference:../../Nez.FNA/Nez/Nez.PipelineImporter/bin/Debug/Nez.dll
#---------------------------------- Content ---------------------------------#

View File

@ -19,6 +19,23 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<!-- Include the CompiledContent bin (MGCB output). Copy it to the Content folder in the build. -->
<ItemGroup>
<Content Include="CompiledContent/bin/DesktopGL/**/*.xnb">
<Link>Content/%(RecursiveDir)%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<!-- I can't seem to get msbuild to automatically handle content so these next two bits do nothing -->
<ItemGroup>
<MonoGameContentReference Include="CompiledContent\Content.mgcb" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />
<!-- Copy fnalib directories to output -->
<ItemGroup>

View File

@ -1,118 +0,0 @@
# Program: win_getFNA
# Author: Caleb Cornett
# Usage: ./win_getFNA.ps1
# Description: Quick and easy way to install a local copy of FNA and its native libraries.
# NOTE: 7-Zip must be installed to decompress fnalibs.
# Checks if git is installed
function checkGit()
{
git --version > $null 2>&1
if ( -Not $? ) {
Write-Error "ERROR: Git is required to pull FNA from the command line."
Write-Output "Either install git or download and unzip FNA manually."
exit 1
}
}
# Clones FNA from the git master branch
function downloadFNA()
{
checkGit
Write-Output "Downloading FNA..."
git -C $PSScriptRoot clone https://github.com/FNA-XNA/FNA.git --recursive
if ($?) {
Write-Output "Finished downloading!"
}
else {
Write-Error "ERROR: Unable to download successfully. Maybe try again later?"
}
}
# Pulls FNA from the git master branch
function updateFNA()
{
checkGit
Write-Output "Updating to the latest git version of FNA..."
git -C $PSScriptRoot/FNA pull --recurse-submodules
if ($?) {
Write-Output "Finished updating!"
}
else {
Write-Error "ERROR: Unable to update."
}
}
function getLibs()
{
# Downloading
Write-Output "Downloading latest fnalibs..."
Invoke-WebRequest -Uri http://fna.flibitijibibo.com/archive/fnalibs.tar.bz2 -OutFile $PSScriptRoot/fnalibs.tar.bz2
if ($?) {
Write-Output "Finished downloading!"
}
else {
Write-Error "ERROR: Unable to download successfully. Maybe try again later?"
exit 1
}
# Is 7Zip installed?
# Edit this to be Program Files (x86) if you installed the 32-bit version.
$7zip = 'C:\Program Files\7-Zip\7z.exe'
& $7zip >$null
if (-Not $?)
{
Write-Error "7Zip is required to decompress fnalibs."
exit 1
}
# Decompress
& $7zip x -y $PSScriptRoot/fnalibs.tar.bz2 -o"$PSScriptRoot"
& $7zip x -y $PSScriptRoot/fnalibs.tar -o"$PSScriptRoot/fnalibs" >$null
if ($?)
{
Write-Output "Finished decompressing!"
Remove-Item $PSScriptRoot/fnalibs.tar.bz2
Remove-Item $PSScriptRoot/fnalibs.tar
}
else
{
Write-Error "ERROR: Unable to decompress successfully."
}
}
# FNA
if ( -Not (Test-Path -Path "$PSScriptRoot/FNA") )
{
$shouldDownload = Read-Host "Download FNA (y/n)? "
if ($shouldDownload -match "^[Yy]$")
{
downloadFNA
}
}
else
{
$shouldUpdate = Read-Host "Update FNA (y/n)? "
if ($shouldUpdate -match "^[Yy]$")
{
updateFNA
}
}
# FNALIBS
$shouldDownloadLibs = ""
if ( -Not (Test-Path -Path "$PSScriptRoot/fnalibs") )
{
$shouldDownloadLibs = Read-Host "Download fnalibs (y/n)? "
}
else
{
$shouldDownloadLibs = Read-Host "Redownload fnalibs (y/n)? "
}
if ($shouldDownloadLibs -match "^[Yy]$")
{
getLibs
}