Author Topic: building on macosx: second path, first cut for CMake  (Read 1869 times)

GeoVah

  • Guest
building on macosx: second path, first cut for CMake
« on: 13 September 2010, 14:08:20 »
So here is the second patch for building over MacOsX http://fforjan.free.fr/File/megaglest.cmake.macosx.diff
This patch enables to generate the xcode project for building the project.
The game is still not usable due to :
* font problem
* not bundle (installation) provided
* surely lot of problem

What has been modified :
* the gl_wrapp.cpp is now split into the different platform.
Currently the CMake 'project' is only including the mac platform since i cannot run it on windows or linux.
the platform dependant gl_wrapp.cpp contains the code to retrieve the font information on the different platform.
* the CMake module for Lua,Xerces and Vorbis are updated to found the different library on macosx (lib name and some patch)
* add some configuration for the platform on xcode (i386 up to now)

So, if this patch can be reviewed and maybe accepted, which means also update the linux side and windows side,please provide me some feedback.

The next steps, is to create an application bundle by still managing it with the CMake area, resolve the problem for the font.

Regards,
GeoVah
 

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: building on macosx: second path, first cut for CMake
« Reply #1 on: 13 September 2010, 17:02:27 »
The main issue with this diff is that the X11 code in gl_Warp was moved into the mac specific file, but this code is used for linux. Either use a shared version of gl_wrap for osx and linux or please create a split for linux as well and then we should be able to merge this into trunk.

GeoVah

  • Guest
Re: building on macosx: second path, first cut for CMake
« Reply #2 on: 13 September 2010, 21:42:18 »
it was already split and existing on my computer ;)
But a missing svn add on this file concludes in a wrong patch...

So i've uploaded a new patch..., same url : http://fforjan.free.fr/File/megaglest.cmake.macosx.diff

GeoVah

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: building on macosx: second path, first cut for CMake
« Reply #3 on: 13 September 2010, 22:41:31 »
Seems to be a problem with the patch:

Code: [Select]
softcoder@softhauslinux:~/Code/megaglest/trunk$ patch -p0 -i mac_patch2.diff
patching file source/glest_game/main/SDLMain.m
patching file source/glest_game/main/SDLMain.h
patching file source/glest_game/CMakeLists.txt
patching file source/shared_lib/sources/platform/sdl/gl_wrap.cpp
Hunk #2 FAILED at 139.
1 out of 2 hunks FAILED -- saving rejects to file source/shared_lib/sources/platform/sdl/gl_wrap.cpp.rej
patching file source/shared_lib/sources/platform/win32/gl_wrap.cpp
patching file source/shared_lib/sources/platform/unix/gl_wrap.cpp
patching file source/shared_lib/sources/platform/macosx/NSFont_OpenGL.h
patching file source/shared_lib/sources/platform/macosx/gl_wrap.mm
patching file source/shared_lib/sources/platform/macosx/NSFont_OpenGL.m
patching file source/shared_lib/CMakeLists.txt
patching file mk/cmake/Modules/FindLUA.cmake
patching file mk/cmake/Modules/FindOGG.cmake
patching file mk/cmake/Modules/FindXercesC.cmake

Please provide a fixed diff file and I'll retry.

Thanks

GeoVah

  • Guest
Re: building on macosx: second path, first cut for CMake
« Reply #4 on: 14 September 2010, 09:37:48 »
So i've updated the diff (same URL) against the latest svn (svn update before generating it).

This diff also contains the fix for CMake file to include the map directory (seems there is a map preview feature added recently and the CMake must be updated to include this directory)

GeoVah

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: building on macosx: second path, first cut for CMake
« Reply #5 on: 14 September 2010, 14:55:26 »
For some reason i still get the same error applying this new patch:

Quote
softcoder@softhauslinux:~/Code/megaglest/trunk$ patch -p0 -i mac_patch3.diff
patching file source/glest_game/main/SDLMain.m
patching file source/glest_game/main/SDLMain.h
patching file source/glest_game/CMakeLists.txt
patching file source/shared_lib/sources/platform/sdl/gl_wrap.cpp
Hunk #2 FAILED at 139.
1 out of 2 hunks FAILED -- saving rejects to file source/shared_lib/sources/platform/sdl/gl_wrap.cpp.rej
patching file source/shared_lib/sources/platform/win32/gl_wrap.cpp
patching file source/shared_lib/sources/platform/unix/gl_wrap.cpp
patching file source/shared_lib/sources/platform/macosx/NSFont_OpenGL.h
patching file source/shared_lib/sources/platform/macosx/gl_wrap.mm
patching file source/shared_lib/sources/platform/macosx/NSFont_OpenGL.m
patching file source/shared_lib/CMakeLists.txt
patching file mk/cmake/Modules/FindLUA.cmake
patching file mk/cmake/Modules/FindOGG.cmake
patching file mk/cmake/Modules/FindXercesC.cmake
softcoder@softhauslinux:~/Code/megaglest/trunk$

Also here is the rej file contents:

http://codepad.org/XFAHDAYi

GeoVah

  • Guest
Re: building on macosx: second path, first cut for CMake
« Reply #6 on: 15 September 2010, 09:17:15 »
On my side, starting from scratch (doing a fresh svn checkout) and applying the patch works for me.
And regarding your rejected file, i cannot see where is the problem ?

Regards

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: building on macosx: second path, first cut for CMake
« Reply #7 on: 15 September 2010, 15:35:56 »
I just checked out a temp folder with source and mk folders and try pathcing (using the following):

Quote
softcoder@softhauslinux:~/Code/megaglest-temp$ patch -p0 -i mac_patch3.diff
patching file source/glest_game/main/SDLMain.m
patching file source/glest_game/main/SDLMain.h
patching file source/glest_game/CMakeLists.txt
patching file source/shared_lib/sources/platform/sdl/gl_wrap.cpp
Hunk #2 FAILED at 139.
1 out of 2 hunks FAILED -- saving rejects to file source/shared_lib/sources/platform/sdl/gl_wrap.cpp.rej
patching file source/shared_lib/sources/platform/win32/gl_wrap.cpp
patching file source/shared_lib/sources/platform/unix/gl_wrap.cpp
patching file source/shared_lib/sources/platform/macosx/NSFont_OpenGL.h
patching file source/shared_lib/sources/platform/macosx/gl_wrap.mm
patching file source/shared_lib/sources/platform/macosx/NSFont_OpenGL.m
patching file source/shared_lib/CMakeLists.txt
patching file mk/cmake/Modules/FindLUA.cmake
patching file mk/cmake/Modules/FindOGG.cmake
patching file mk/cmake/Modules/FindXercesC.cmake
softcoder@softhauslinux:~/Code/megaglest-temp$

My question is what parameters are you using to apply your patch? (notice my patch command and parameters)

Thanks

GeoVah

  • Guest
Re: building on macosx: second path, first cut for CMake
« Reply #8 on: 16 September 2010, 10:36:45 »
I was using the same command as you.
But anyway, I've updated the patch with my latest modification.
You can found it here : http://fforjan.free.fr/MegaGlest/patch_1002/
This folder contains the patch file against revision 1002 of the repository.
Since i've added the icone for the installer, you will also found the binary file to be put into the mk/macosx directory.

The font problem is now corrected, you can do svn co, Cmake, xcodebuild, cpack and it will generate the installer (still one manual steps on the cpack area, i will try to fix it). Some strings are still hard coded on the installer and the application description thus I need more work to have something polish (i.e. you get the latest, build and it will generate a full installer).
Maybe with the CMake modificatiom some platform are broken.Do you know which platform is using CMake ?

Regards,
GeoVah


softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: building on macosx: second path, first cut for CMake
« Reply #9 on: 16 September 2010, 15:16:55 »
Done, and nice job :). I fixed the main cmake file for our Linux compiling in case we ever fully switch away from jam, but all of your changes are in svn.

Thanks again.

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: building on macosx: second path, first cut for CMake
« Reply #10 on: 16 September 2010, 17:21:53 »
By the way, perhaps you can give us a link to the current Mac Binary and we will link to it on the beta1 page to let people test it!

Thanks

GeoVah

  • Guest
Re: building on macosx: second path, first cut for CMake
« Reply #11 on: 16 September 2010, 23:29:35 »
I wanted to do this, but I need to update the hardcoded string to match the version and the name (still glest v3.2.2 somewhere) and maybe investigate why the game is crashing at the exit, but I think it can live like this for the first beta ;)

I plan to do it this friday evening or maybe next monday (I will be away the full week-end)

Regards,
GeoVah

GeoVah

  • Guest
Re: building on macosx: second path, first cut for CMake
« Reply #12 on: 22 September 2010, 12:36:24 »
I've a new patch for the CMake area, the header were not included in the XCode, thus not usable.
This patch enables them :
http://fforjan.free.fr/MegaGlest/patch_1015/headerInXCode.diff

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: building on macosx: second path, first cut for CMake
« Reply #13 on: 24 September 2010, 15:26:29 »
Sorry for the delay, this patch has now been applied in svn.