lidgren / lidgren-network-gen3

Lidgren Network Library
https://groups.google.com/forum/#!forum/lidgren-network-gen3
MIT License
1.19k stars 331 forks source link

Solution setup to compile for different platforms #73

Open MithrilMan opened 8 years ago

MithrilMan commented 8 years ago

Grats for this library, I just started using it and i've implemented a framework upon that to use interfaces and reflection magic / compiled expressions to handle my messages without having to do huge switches, etc.. and it works like a charm

Now i moved to Unity because i wanted to play with it, creating a simple project to test my implementation, I successfully built lindgren sources using the info on the Wiki https://github.com/lidgren/lidgren-network-gen3/wiki/Unity3D but ... what if instead polluting code with defines and having to add compilation symbols, you don't take the "Shared Project" route?

In case you don't know, it's a special kind of project in Visual Studio 2015 that doesn't produce any output per se, but is a placeholder to put a code that can be included in other projects, so you can put there partial classes and implement the platform specific code in other projects that compile output for that platform (so you can have a lidgren compiled for unity, one for windows, one for PCL and so on in a single step)

This means to not having to change any code, and no duplication code needed

In order to not generate compilation error in case you don't have some dll (like unity) in your environment, you can just create ad hoc Build configurations that switch off/on the projects you want (so you can have a build like "Debug Unity" that just compile the unity projects, etc...

If you like the idea and don't have the time i could implement the needed changes in my fork when i have the time

cheers

forestrf commented 8 years ago

I didn't know about this option. I use Lidgren in Unity3d and having it as a separated project and not as a dll would be useful