MonoIntegrationGuide.txt 4.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. ---------------------------------Compiling runtime-------------------------------------
  2. - Grab Mono 5.4 (or newer) source code
  3. - From tarball: https://download.mono-project.com/sources/mono/
  4. - Optionally check it out from git repository: https://github.com/mono/mono
  5. - If on Windows, make sure your git client has this set: "git config --global core.autocrlf input" as otherwise you'll have problems with line endings during later steps
  6. - Expose "mono_class_bind_generic_parameters" to the public:
  7. - In mono/metadata/object-internals.h change:
  8. MonoClass* mono_class_bind_generic_parameters (MonoClass *klass, int type_argc, MonoType **types, gboolean is_dynamic) MONO_INTERNAL;
  9. to:
  10. MONO_API MonoClass* mono_class_bind_generic_parameters (MonoClass *klass, int type_argc, MonoType **types, mono_bool is_dynamic);
  11. then move it to:
  12. mono/metadata/object.h
  13. - In mono/metadata/reflection.c modify:
  14. MonoClass* mono_class_bind_generic_parameters (MonoClass *klass, int type_argc, MonoType **types, gboolean is_dynamic)
  15. to:
  16. MonoClass* mono_class_bind_generic_parameters (MonoClass *klass, int type_argc, MonoType **types, mono_bool is_dynamic)
  17. - (Windows only) Add "mono_class_bind_generic_parameters" entry to mono/msvc/mono.def file
  18. - Build
  19. - Install Mono binary release (whichever one is the latest).
  20. - (Windows only)Add the "(InstallDir)\Mono\bin" to your PATH environment variable.
  21. - If on Windows:
  22. - Go to msvc/ folder to find mono.sln (Visual studio solution)
  23. - Open in VS2012 as is, or open in later VS and upgrade all projects to latest toolkit (v120 and v140 tested and working)
  24. - Generate missing header files:
  25. - First compile "genmdesc" project for desired configuration (debug/release, 32/64 bit)
  26. - Then run "runmdesc x64\bin\Debug\genmdesc x64" located in /msvc folder
  27. - Replace folder path to genmdesc you generated in the previous step
  28. - Replace x64 with Win32 for 32-bit builds
  29. - Compile mono project with desired configuration (debug/release, 32/64 bit, SGen builds were not tested). You will receive mono-2.0.dll and mono-2.0.lib as output.
  30. - Repeat the "genmdesc" step above for each configuration. Doing it once might be enough but be on the safe side.
  31. - If on Linux/Mac:
  32. - "./autogen.sh --prefix="(OutputDir)" --with-preview=yes"" (Replace (OutputDir) with a folder where you want to output the binaries, e.g. "C:\MonoInstall")
  33. - "./configure"
  34. - "make"
  35. - "make install"
  36. - Post build
  37. - (If using GDB only) Mono uses certain signals internally for normal operation. In order to avoid GDB triggering breakpoints when not required, put this in your .gdbinit file (in your $HOME path):
  38. - handle SIGXCPU SIG33 SIG35 SIG36 SIGPWR nostop noprint
  39. -----------------------------Compiling libraries & compiler -------------------------------------
  40. - If on Linux/Mac the compiler and libraries should already be compiled using the above steps
  41. - If on Windows:
  42. - Install Cygwin 32-bit version using these command line parameters:
  43. setup-x86.exe -qnNdO -R "C:\cygwin" -s "http://cygwin.mirror.constant.com"
  44. -l "C:\cygwin\var\cache\setup" -P autoconf -P automake -P bison -P gcc-core -P gcc-g++ -P mingw64-i686-runtime
  45. -P mingw64-i686-binutils -P mingw64-i686-gcc-core -P mingw64-i686-gcc-g++ -P mingw64-i686-headers -P mingw64-i686-pthreads
  46. -P mingw64-i686-windows-default-manifest -P mingw64-i686-winpthreads -P w32api-headers -P w32api-runtime
  47. -P windows-default-manifest -P libtool -P make -P python -P gettext-devel -P gettext -P intltool -P libiconv
  48. -P pkg-config -P git -P wget -P curl
  49. - Go to your mono source directory (the one retrieved when compiling the runtime) in terminal (Cygwin or native) and enter these commands in order:
  50. - "./autogen.sh --prefix="(OutputDir)" --with-preview=yes"" (Replace (OutputDir) with a folder where you want to output the binaries, e.g. "C:\MonoInstall")
  51. - "./configure --host=i686-w64-mingw32"
  52. - "make"
  53. - "make install"
  54. - Your built mono should now be output to (OutputDir) folder. (If it's not in that folder, check your Cygwin install folder under /usr/local)
  55. - Copy contents of (OutputDir)/include/mono/mono-2.0/mono to (BansheeRootDir)/Dependencies/Include/Mono
  56. - Make sure to modify "object.h" as you did above when building the binaries
  57. - Copy folder (OutputDir)/etc to (BansheeRootDir)/bin/Mono
  58. - Copy assembly folders (OutputDir)/lib/mono/4.0 and (OutputDir)/lib/mono/4.5 to (BansheeRootDir)/bin/Mono/lib/mono/4.0 and (BansheeRootDir)/bin/Mono/lib/mono/4.5, respectively
  59. - If you wish, you can clean up the assemblies within those folders are many might not be used. The minimum needed are "mscorlib.dll", "System.dll" and "System.Core.dll".
  60. - Copy the compiler (mcs executable) from (OutputDir)/lib/mono/4.5 to (BansheeRootDir)/bin/Mono/compiler