summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-03-30 20:10:55 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-03-30 20:10:55 -0400
commit551153bb00c8a3a448db4b3a059e8322108b772a (patch)
treed887afdd040f55f5c05a8af1defaed7b7fd3bf01
parent75f3600ab1eae06463ae8f386c5ab71f3815142f (diff)
downloadSMAPI-551153bb00c8a3a448db4b3a059e8322108b772a.tar.gz
SMAPI-551153bb00c8a3a448db4b3a059e8322108b772a.tar.bz2
SMAPI-551153bb00c8a3a448db4b3a059e8322108b772a.zip
prepare mod build package for 64-bit SMAPI (#767)
-rw-r--r--build/find-game-folder.targets4
-rw-r--r--docs/technical/mod-package.md24
-rw-r--r--src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj5
-rw-r--r--src/SMAPI.ModBuildConfig/build/smapi.targets21
4 files changed, 44 insertions, 10 deletions
diff --git a/build/find-game-folder.targets b/build/find-game-folder.targets
index 0a766ad4..ec8a3787 100644
--- a/build/find-game-folder.targets
+++ b/build/find-game-folder.targets
@@ -44,7 +44,11 @@
<!-- set game metadata -->
<PropertyGroup>
+ <!--standard executable name-->
<GameExecutableName>Stardew Valley</GameExecutableName>
<GameExecutableName Condition="$(OS) != 'Windows_NT'">StardewValley</GameExecutableName>
+
+ <!--Linux install on Windows (for 64-bit hack)-->
+ <GameExecutableName Condition="$(OS) == 'Windows_NT' AND !Exists('$(GamePath)\$(GameExecutableName).exe') AND Exists('$(GamePath)\StardewValley.exe')">StardewValley</GameExecutableName>
</PropertyGroup>
</Project>
diff --git a/docs/technical/mod-package.md b/docs/technical/mod-package.md
index f7475e37..d89f86c9 100644
--- a/docs/technical/mod-package.md
+++ b/docs/technical/mod-package.md
@@ -137,6 +137,15 @@ The filename for the game's executable (i.e. `StardewValley.exe` on Linux/Mac or
</td>
</tr>
+<tr>
+<td><code>GameFramework</code></td>
+<td>
+
+The game framework for which the mod is being compiled (one of `Xna` or `MonoGame`). This is
+auto-detected based on the platform, and you should almost never change this.
+
+</td>
+</tr>
</table>
</li>
@@ -291,6 +300,15 @@ Warning text:
Your code accesses a field which is obsolete or no longer works. Use the suggested field instead.
+### Wrong processor architecture
+Warning text:
+> The target platform should be set to 'Any CPU' for compatibility with both 32-bit and 64-bit
+> versions of Stardew Valley (currently set to '{{current platform}}').
+
+Mods can be used in either 32-bit or 64-bit mode. Your project's target platform isn't set to the
+default 'Any CPU', so it won't work in both. You can fix it by [setting the target platform to
+'Any CPU'](https://docs.microsoft.com/en-ca/visualstudio/ide/how-to-configure-projects-to-target-platforms).
+
## FAQs
### How do I set the game path?<span id="custom-game-path"></span>
The package detects where your game is installed automatically, so you usually don't need to set it
@@ -347,6 +365,12 @@ The NuGet package is generated automatically in `StardewModdingAPI.ModBuildConfi
when you compile it.
## Release notes
+## Upcoming release
+* Added a build warning when the mod isn't compiled for `Any CPU`.
+* Added a `GameFramework` build property set to `MonoGame` or `Xna` based on the platform. This can be overridden to change which framework it references.
+* Added support for building mods against the 64-bit Linux version of the game on Windows.
+* The package now suppresses the misleading 'processor architecture mismatch' warnings.
+
## 3.2.2
Released 23 September 2020.
diff --git a/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj b/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj
index 5992fbbf..2d15678c 100644
--- a/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj
+++ b/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj
@@ -15,10 +15,6 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>images/icon.png</PackageIcon>
<PackageProjectUrl>https://smapi.io/package/readme</PackageProjectUrl>
- <PackageReleaseNotes>
- - Reworked and streamlined how the package is compiled.
- - Added SMAPI-ModTranslationClassBuilder files to the ignore list.
- </PackageReleaseNotes>
<IncludeBuildOutput>false</IncludeBuildOutput>
</PropertyGroup>
@@ -48,5 +44,4 @@
<None PackagePath="build/Pathoschild.Stardew.ModBuildConfig.targets" Include="build\smapi.targets" Pack="true" />
<None PackagePath="images/icon.png" Include="assets\nuget-icon.png" Pack="true" />
</ItemGroup>
-
</Project>
diff --git a/src/SMAPI.ModBuildConfig/build/smapi.targets b/src/SMAPI.ModBuildConfig/build/smapi.targets
index 76a1536c..698765ad 100644
--- a/src/SMAPI.ModBuildConfig/build/smapi.targets
+++ b/src/SMAPI.ModBuildConfig/build/smapi.targets
@@ -15,6 +15,9 @@
<!-- recognise XNA Framework DLLs in the GAC (only affects mods using new csproj format) -->
<AssemblySearchPaths>$(AssemblySearchPaths);{GAC}</AssemblySearchPaths>
+ <!-- suppress processor architecture mismatch warning (mods should be compiled in 'Any CPU' so they work in both 32-bit and 64-bit mode) -->
+ <ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
+
<!-- set default package options -->
<ModFolderName Condition="'$(ModFolderName)' == ''">$(MSBuildProjectName)</ModFolderName>
<ModZipPath Condition="'$(ModZipPath)' == ''">$(TargetDir)</ModZipPath>
@@ -24,6 +27,9 @@
<EnableHarmony Condition="'$(EnableHarmony)' == ''">false</EnableHarmony>
<EnableGameDebugging Condition="'$(EnableGameDebugging)' == ''">true</EnableGameDebugging>
<CopyModReferencesToBuildOutput Condition="'$(CopyModReferencesToBuildOutput)' == '' OR ('$(CopyModReferencesToBuildOutput)' != 'true' AND '$(CopyModReferencesToBuildOutput)' != 'false')">false</CopyModReferencesToBuildOutput>
+
+ <GameFramework Condition="'$(GameFramework)' == '' AND '$(OS)' == 'Windows_NT'">Xna</GameFramework>
+ <GameFramework Condition="'$(GameFramework)' == ''">MonoGame</GameFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(OS)' == 'Windows_NT' AND '$(EnableGameDebugging)' == 'true'">
@@ -54,7 +60,7 @@
<!-- Game framework -->
<Choose>
- <When Condition="$(DefineConstants.Contains(SMAPI_FOR_XNA))">
+ <When Condition="'$(GameFramework)' == 'Xna'">
<ItemGroup>
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" Private="$(CopyModReferencesToBuildOutput)" />
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" Private="$(CopyModReferencesToBuildOutput)" />
@@ -71,14 +77,19 @@
<!--*********************************************
- ** Show friendly error for invalid OS or game path
+ ** Show validation messages
**********************************************-->
<Target Name="BeforeBuild">
+ <!-- unknown OS type -->
<Error Condition="'$(OS)' != 'OSX' AND '$(OS)' != 'Unix' AND '$(OS)' != 'Windows_NT'" Text="The mod build package doesn't recognise OS type '$(OS)'." />
- <Error Condition="!Exists('$(GamePath)')" Text="The mod build package can't find your game folder. You can specify where to find it; see https://smapi.io/package/custom-game-path." />
- <Error Condition="!Exists('$(GamePath)\$(GameExecutableName).exe')" Text="The mod build package found a game folder at $(GamePath), but it doesn't contain the $(GameExecutableName) file. If this folder is invalid, delete it and the package will autodetect another game install path." />
- <Error Condition="!Exists('$(GamePath)\StardewModdingAPI.exe')" Text="The mod build package found a game folder at $(GamePath), but it doesn't contain SMAPI. You need to install SMAPI before building the mod." />
+ <!-- invalid game path -->
+ <Error Condition="!Exists('$(GamePath)')" Text="The mod build package can't find your game folder. You can specify where to find it; see https://smapi.io/package/custom-game-path." ContinueOnError="false" />
+ <Error Condition="!Exists('$(GamePath)\$(GameExecutableName).exe')" Text="The mod build package found a game folder at $(GamePath), but it doesn't contain the $(GameExecutableName) file. If this folder is invalid, delete it and the package will autodetect another game install path." ContinueOnError="false" />
+ <Error Condition="!Exists('$(GamePath)\StardewModdingAPI.exe')" Text="The mod build package found a game folder at $(GamePath), but it doesn't contain SMAPI. You need to install SMAPI before building the mod." ContinueOnError="false" />
+
+ <!-- invalid target architecture (note: internal value is 'AnyCPU', value shown in Visual Studio is 'Any CPU') -->
+ <Warning Condition="'$(Platform)' != 'AnyCPU'" Text="The target platform should be set to 'Any CPU' for compatibility with both 32-bit and 64-bit versions of Stardew Valley (currently set to '$(Platform)'). See https://smapi.io/package/wrong-processor-architecture for details." HelpLink="https://smapi.io/package/wrong-processor-architecture" />
</Target>