Ticket #19 (new enhancement)

Opened 2 years ago

Last modified 2 weeks ago

Port to Mac OS

Reported by: Carsten Owned by:
Priority: normal Milestone: asap
Component: other Version: svn-head
Keywords: Cc:
Platform: Mac OS X

Description

Complete the port to Mac OS (10.x).

Change History

Changed 19 months ago by Carsten

Ticket #34 is a recommended prerequisite for this ticket.

Changed 3 weeks ago by Haimi

the first steps to come some steps further is to fetch most of the libs via macports.
libpng could simply be used by compiling it from source (No devel package on macports).
In the SCons* files i added to every

if sys.platform=="linux2"
if sys.platform=="linux2" or sys-platform=="darwin"

Current problem: gtk+ could not be found with the mac port, I am trying to build it from source

Changed 3 weeks ago by Carsten

Regarding gtk+, I don't think it should be used under MacOS at all: We use the  wxWidgets library for our cross-platform application GUIs (most prominently CaWE), which in turn uses the native API under each OS, and thus has a "flavor" for each:

  • wxMSW under Windows,
  • wxGTK under Linux,
  • wxOSX under MacOS.

That is, using wxOSX (based on the MacOS Cocoa API) is most certainly the right choice. The source code ships with our copy of wxWidgets in ExtLibs/wxWidgets, and one of the first challenges is probably compiling that.

Changed 3 weeks ago by Haimi

Challenge accepted :) - and mastered, wxWidget copiled like a charm when using following colde Block in SConstruct:348

elif sys.platform=="darwin":
    if not os.path.exists("ExtLibs/wxWidgets/build-gtk/make-ok-flag"):
        envRelease.Execute(Mkdir("ExtLibs/wxWidgets/build-gtk"));
        result=envRelease.Execute("../configure --enable-unicode --with-osx_cocoa --disable-shared --without-libtiff --disable-pnm --disable-pcx --disable-iff --with-opengl --with-regex=builtin --disable-compat26 --disable-compat28 --with-macosx-sdk=/Developer/SDKs/MacOSX10.6.sdk", chdir="ExtLibs/wxWidgets/build-gtk");
        if (result!=0): envRelease.Exit(result);
        result=envRelease.Execute("make && touch make-ok-flag", chdir="ExtLibs/wxWidgets/build-gtk");
        if (result!=0): envRelease.Exit(result);

The important thing here is NOT to compile it for lion (SDK10.7), because wx does not yet compile with the 10.7 SDK, but fine with the 10.6

Now all dependencies should be fine... The next errors are already while compiling Ca3DE:

In file included from Ca3DE/MainCanvas.cpp:22:
Ca3DE/MainCanvas.hpp:82: error: 'HMODULE' does not name a type
Ca3DE/MainCanvas.hpp:85: error: 'HMODULE' does not name a type
Ca3DE/MainCanvas.hpp:86: error: 'HMODULE' does not name a type
In file included from Ca3DE/MainCanvas.cpp:48:
Libs/PlatformAux.hpp:54: error: 'HMODULE' has not been declared
Libs/PlatformAux.hpp:59: error: 'HMODULE' was not declared in this scope
Libs/PlatformAux.hpp:59: error: 'OutRendererDLL' was not declared in this scope
Libs/PlatformAux.hpp:64: error: 'HMODULE' was not declared in this scope
Libs/PlatformAux.hpp:70: error: 'HMODULE' has not been declared
Libs/PlatformAux.hpp:75: error: 'HMODULE' was not declared in this scope
Libs/PlatformAux.hpp:75: error: 'OutSoundSysDLL' was not declared in this scope
Ca3DE/MainCanvas.cpp: In constructor 'MainCanvasT::MainCanvasT(MainFrameT*)':
Ca3DE/MainCanvas.cpp:115: error: class 'MainCanvasT' does not have any field named 'm_RendererDLL'
Ca3DE/MainCanvas.cpp:118: error: class 'MainCanvasT' does not have any field named 'm_SoundSysDLL'
Ca3DE/MainCanvas.cpp:119: error: class 'MainCanvasT' does not have any field named 'm_GameDLL'
Ca3DE/MainCanvas.cpp: In destructor 'virtual MainCanvasT::~MainCanvasT()':
Ca3DE/MainCanvas.cpp:186: error: 'm_SoundSysDLL' was not declared in this scope
Ca3DE/MainCanvas.cpp:222: error: 'm_RendererDLL' was not declared in this scope
Ca3DE/MainCanvas.cpp:240: error: 'm_GameDLL' was not declared in this scope
Ca3DE/MainCanvas.cpp: At global scope:
Ca3DE/MainCanvas.cpp:249: error: 'HMODULE' has not been declared
Ca3DE/MainCanvas.cpp: In function 'cf::GameSys::GameI* LoadGameDLL(const std::string&, int&)':
Ca3DE/MainCanvas.cpp:275: error: invalid conversion from 'void*' to 'int'
Ca3DE/MainCanvas.cpp:288: error: invalid conversion from 'int' to 'void*'
Ca3DE/MainCanvas.cpp:288: error:   initializing argument 1 of 'void* dlsym(void*, const char*)'
Ca3DE/MainCanvas.cpp:291: error: invalid conversion from 'int' to 'void*'
Ca3DE/MainCanvas.cpp:291: error:   initializing argument 1 of 'int dlclose(void*)'
Ca3DE/MainCanvas.cpp:305: error: invalid conversion from 'int' to 'void*'
Ca3DE/MainCanvas.cpp:305: error:   initializing argument 1 of 'int dlclose(void*)'
Ca3DE/MainCanvas.cpp: In member function 'void MainCanvasT::Initialize()':
Ca3DE/MainCanvas.cpp:334: error: 'm_RendererDLL' was not declared in this scope
Ca3DE/MainCanvas.cpp:336: error: 'm_RendererDLL' was not declared in this scope
Ca3DE/MainCanvas.cpp:337: error: 'PlatformAux::GetBestRenderer' cannot be used as a function
Ca3DE/MainCanvas.cpp:339: error: 'm_RendererDLL' was not declared in this scope
Ca3DE/MainCanvas.cpp:346: error: 'm_RendererDLL' was not declared in this scope
Ca3DE/MainCanvas.cpp:346: error: 'PlatformAux::GetTextureMapManager' cannot be used as a function
Ca3DE/MainCanvas.cpp:367: error: 'm_SoundSysDLL' was not declared in this scope
Ca3DE/MainCanvas.cpp:369: error: 'm_SoundSysDLL' was not declared in this scope
Ca3DE/MainCanvas.cpp:370: error: 'PlatformAux::GetBestSoundSys' cannot be used as a function
Ca3DE/MainCanvas.cpp:372: error: 'm_SoundSysDLL' was not declared in this scope
Ca3DE/MainCanvas.cpp:382: error: 'm_SoundSysDLL' was not declared in this scope
Ca3DE/MainCanvas.cpp:424: error: 'm_GameDLL' was not declared in this scope
scons: *** [build/darwin/g++/release/Ca3DE/MainCanvas.o] Error 1
In file included from Ca3DE/MainFrame.cpp:24:
Ca3DE/MainCanvas.hpp:82: error: 'HMODULE' does not name a type
Ca3DE/MainCanvas.hpp:85: error: 'HMODULE' does not name a type
Ca3DE/MainCanvas.hpp:86: error: 'HMODULE' does not name a type
scons: *** [build/darwin/g++/release/Ca3DE/MainFrame.o] Error 1
scons: building terminated because of errors.

I will try to figure this out

Changed 3 weeks ago by Carsten

Wow, this looks very well, thank you very much!
I'll apply your changes to the SConstruct file in a minute.
(Let me know if I should, besides you nick "Haimi", use another name for the credits.)

If you make more exhaustive changes, e.g. addressing the issues above in several files, it would be ideal if you could attach them as a patch.
That would make it easy for me to apply even complicated changes.

Changed 3 weeks ago by Haimi

Okay, this error was rather easy to fix by just adding the precompiler-check for APPLE, but now I hang on following error:
Libs/Math3D/BezierPatch.cpp: In member function 'typename cf::math::BezierPatchT<T>::VertexT cf::math::BezierPatchT<T>::SampleSinglePatchPoint(const cf::math::BezierPatchT<T>::VertexT (*)[3], T, T) const [with T = float]':
Libs/Math3D/BezierPatch.cpp:709: internal compiler error: Segmentation fault: 11
Can anyone figure out what the Problem could be?

And, yes, my nick is always and everywhere "Haimi" :)
I plan to attach a Patchfile as soon as I get something running :), so I only have to run a recursive diff

Changed 3 weeks ago by Haimi

Current State: All Dependencies compile, Hanging in CaTool (TerrainViewerOld.cpp) because of OpenGL Problems.

Changed 2 weeks ago by Carsten

You can ignore the TerrainViewerOld program -- as it's name indicates, it's pretty old and kept only for reference when changing the terrain LOD algorithm.

Both the Cafu Engine as well as CaWE open their OpenGL windows using the wxWidgets library.

Note: See TracTickets for help on using tickets.