Jump to content

How to compile plugins on a Mac


Recommended Posts

Make sure you have Mono. I also have the Apple developer tools, but I don\'t think those are essential.

I took the source Cephei\'s Solar Panels and put them in the main KSP folder in three files, SolarPanels.cs Battery.cs and IonEngine.cs.

Open the Terminal, navigate to the KSP folder, and use this command:

gmcs -r:KSP.app/Contents/Data/Managed/Assembly-CSharp.dll,KSP.app/Contents/Data/Managed/UnityEngine.dll -t:library SolarPanel.cs IonEngine.cs Battery.cs -out:Plugins/MyPlugin.dll

You should now have MyPlugin.dll in the plugins folder!

Hopefully anyone with even a little background in developing on a Mac (like myself) should be able to figure out stuff from there :-)

*Disclaimer*: I\'ve never worked with Mono before, I just mucked around until something worked. I\'m sure there are lots of ways to make this more streamlined/easier to develop with, Mac developers please add tips and tricks!

Link to comment
Share on other sites

Here\'s the Makefile I\'m using, because I couldn\'t get things to compile with MonoDevelop :\'(

If you know how to use a makefile it should be fairly obvious how to edit it to change the name of your plugin, and what to do if your KSP isn\'t in the Applications folder.


PLUGINNAME = MyPlugin.dll

KSP = /Applications/KSP/
DLL = $(KSP)KSP.app/Contents/Data/Managed/
REFS = $(DLL)Assembly-CSharp.dll,$(DLL)UnityEngine.dll
OUTPUT = $(KSP)Plugins/$(PLUGINNAME)
SOURCE = $(wildcard *.cs)


all:
gmcs -t:library -r:$(REFS) $(SOURCE) -out:$(OUTPUT)

Link to comment
Share on other sites

Hey, i tried to do that but it didn\'t worked. I have my two .cs files in the main directory, i naviagate to the folder, i type in :

gmcs -r:KSP.app/Contents/Data/Managed/Assembly-CSharp.dll,KSP.app/Contents/Data/Managed/UnityEngine.dll -t:library NuclearEngine.cs ReactorCore.cs -out:Plugins/Nuclear.dll

But it says me :

ordinateur-de-barabara-bouley:~ barabarabouley$ /Users/barabarabouley/Downloads/KSP_osx-3
-bash: /Users/barabarabouley/Downloads/KSP_osx-3: is a directory
ordinateur-de-barabara-bouley:~ barabarabouley$ gmcs -r:KSP.app/Contents/Data/Managed/Assembly-CSharp.dll,KSP.app/Contents/Data/Managed/UnityEngine.dll -t:library NuclearEngine.cs ReactorCore.cs -out:Plugins/Nuclear.dll
error CS2001: Source file `NuclearEngine.cs\' could not be found
error CS2001: Source file `ReactorCore.cs\' could not be found
Compilation failed: 2 error(s), 0 warnings
ordinateur-de-barabara-bouley:~ barabarabouley$

I have MONO installed, what\'s happening ?

Link to comment
Share on other sites

ordinateur-de-barabara-bouley:~ barabarabouley$ /Users/barabarabouley/Downloads/KSP_osx-3

You need to put [tt]cd[/tt] in your first line (change directory).

cd /Users/barabarabouley/Downloads/KSP_osx-3

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...