summaryrefslogtreecommitdiff
path: root/build/smapi.targets
blob: 7d512a294b8dbbe4bc1bff8f2ea9532dcb12114c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!-- find game install path -->
  <PropertyGroup>
    <!-- injected by Silverplum -->
    <GamePath Condition="!Exists('$(GamePath)')">$(STARDEWVALLEY_DIR)</GamePath>
    
    <!-- Linux -->
    <GamePath Condition="!Exists('$(GamePath)')">~/.local/share/Steam/steamapps/common/Stardew Valley</GamePath>

    <!-- Mac -->
    <GamePath Condition="!Exists('$(GamePath)')">~/Library/Application Support/Steam/steamapps/common/Stardew Valley/Contents/MacOS</GamePath>

    <!-- Windows -->
    <GamePath Condition="!Exists('$(GamePath)')">C:\Program Files (x86)\GalaxyClient\Games\Stardew Valley</GamePath>
    <GamePath Condition="!Exists('$(GamePath)')">C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley</GamePath>
  </PropertyGroup>

  <!-- set up configuration -->
  <Choose>
    <When Condition="$(OS) == 'Windows_NT'">
      <!-- references -->
      <ItemGroup>
        <Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
        <Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
        <Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
        <Reference Include="Stardew Valley">
          <HintPath>$(GamePath)\Stardew Valley.exe</HintPath>
        </Reference>
        <Reference Include="StardewModdingAPI">
          <HintPath>$(GamePath)\StardewModdingAPI.exe</HintPath>
        </Reference>
        <Reference Include="xTile, Version=2.0.4.0, Culture=neutral, processorArchitecture=x86">
          <SpecificVersion>False</SpecificVersion>
          <HintPath>$(GamePath)\xTile.dll</HintPath>
        </Reference>
      </ItemGroup>

      <!-- launch game for debugging -->
      <PropertyGroup>
        <StartAction>Program</StartAction>
        <StartProgram>$(GamePath)\StardewModdingAPI.exe</StartProgram>
        <StartWorkingDirectory>$(GamePath)</StartWorkingDirectory>
      </PropertyGroup>
    </When>
    <Otherwise>
      <!-- references -->
      <ItemGroup>
        <Reference Include="MonoGame.Framework">
          <SpecificVersion>False</SpecificVersion>
          <HintPath>$(GamePath)\MonoGame.Framework.dll</HintPath>
        </Reference>
        <Reference Include="StardewValley">
          <HintPath>$(GamePath)\StardewValley.exe</HintPath>
        </Reference>
        <Reference Include="StardewModdingAPI">
          <HintPath>$(GamePath)\StardewModdingAPI.exe</HintPath>
        </Reference>
        <Reference Include="xTile">
          <HintPath>$(GamePath)\xTile.dll</HintPath>
        </Reference>
      </ItemGroup>
    </Otherwise>
  </Choose>

  <!-- if game path is invalid, show one user-friendly error instead of a slew of reference errors -->
  <Target Name="BeforeBuild">
    <Error Condition="!Exists('$(GamePath)')" Text="Failed to find the game install path automatically; edit the *.csproj file and manually add a &lt;GamePath&gt; setting with the full directory path containing the Stardew Valley executable." />
  </Target>
</Project>