Author Topic: I can help with C::B with cross platforms.  (Read 28529 times)

Offline Paco.Blasco

  • Multiple posting newcomer
  • *
  • Posts: 30
I can help with C::B with cross platforms.
« on: August 03, 2006, 01:10:39 pm »
Hi all:

I'm developing in Windows/Linux/OSX, and I use now C::B in with Windows/MinGW/wx. Now I'm using Eclipse in OSX, but I will prefer C::B...thinking in the posibility of create a project to compile the same code in all platforms (one code, one editor, multiple OS - OCEOMOS?? :) ).
For OSX I have a MacMini (PPC) and a MacBookPro (Intel), and I see that the SVN code fails....
Now I'm trying to compile using the GTK/X11 with fink (I want tC::B on OSX NOW!!!), and I'm solving some issues.
Can I help you to develop C::B.

My first thing:

Revision:2804
File: src/src/app.cpp
Line: 644
Code:
wxString CodeBlocksApp::GetAppPath() const
{
    wxString base;
#ifdef __WXMSW__
    wxChar name[MAX_PATH] = {0};
    GetModuleFileName(0L, name, MAX_PATH);
    wxFileName fname(name);
    base = fname.GetPath(wxPATH_GET_VOLUME);
#elif defined(__WXMAC__)
   // TODO: get the path
   base = _T(".");
#else
    if (!m_Prefix.IsEmpty())
        return m_Prefix;

    // SELFPATH is a macro from prefix.h (binreloc)
    // it returns the absolute filename of us
    // similar to win32 GetModuleFileName()...
    base = wxString(SELFPATH,wxConvUTF8);
    base = wxFileName(base).GetPath();
   if (base.IsEmpty())
      base = _T(".");
#endif
    return base;
}

On WXGTK there are two "base = ...". The first one it is failed on my compilation on OSX/GTK/X11.
I've commented it to avoid the error (in fact can be a "forgotten" line, ain't? )

Thx.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: I can help with C::B with cross platforms.
« Reply #1 on: August 03, 2006, 01:15:04 pm »
Quote
On WXGTK there are two "base = ...". The first one it is failed on my compilation on OSX/GTK/X11.
I've commented it to avoid the error (in fact can be a "forgotten" line, ain't? )

No, it "ain't a forgotten line" :).
What's strange is why you land there. Isn't __WXMAC__ defined?  :shock:
Be patient!
This bug will be fixed soon...

Offline Paco.Blasco

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: I can help with C::B with cross platforms.
« Reply #2 on: August 03, 2006, 01:20:33 pm »
I don't have __WXMAC__ defined because C::B requires wxPopuWindow and that wxClass is not supported by WXMAC, so, I'm using fink and I compile wxWidgets with GTK. So i'm defining "WXGTK".
First I want to have a C::B working right (I probed the PPC version, but it have a lot of problems with the window layout).
And then to begin to work with WXMAC.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: I can help with C::B with cross platforms.
« Reply #3 on: August 03, 2006, 01:27:48 pm »
OK, you should know better. I have no clue about MACs :P

The binreloc library (which defines the SELFPATH symbol), is conditionally enabled in src/src/Makefile.am.

Code
if CODEBLOCKS_LINUX
AM_CPPFLAGS = -DENABLE_BINRELOC -DAPP_PREFIX="\"@prefix@\""
endif

You can make it unconditional and see if it works right...
Be patient!
This bug will be fixed soon...

Offline Paco.Blasco

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: I can help with C::B with cross platforms.
« Reply #4 on: August 03, 2006, 01:40:29 pm »
I suppose that binreloc should work on MAC (OS X is called Darwin and it is BSD with a nice GUI and JFS, basically).
My question is: one of the lines of "base = ... " must be removed (in fact, the first line is not used.....)


Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: I can help with C::B with cross platforms.
« Reply #5 on: August 03, 2006, 01:44:14 pm »
I suppose that binreloc should work on MAC (OS X is called Darwin and it is BSD with a nice GUI and JFS, basically).
My question is: one of the lines of "base = ... " must be removed (in fact, the first line is not used.....)

No, it is used. Read the code:

Code: cpp
    // SELFPATH is a macro from prefix.h (binreloc)
    // it returns the absolute filename of us
    // similar to win32 GetModuleFileName()...
    base = wxString(SELFPATH,wxConvUTF8);
    base = wxFileName(base).GetPath();

The second assignment, uses the same object (base). It's the same as writing:

Code: cpp
    base = wxFileName(wxString(SELFPATH,wxConvUTF8)).GetPath();

only a little clearer.
Be patient!
This bug will be fixed soon...

Offline Paco.Blasco

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: I can help with C::B with cross platforms.
« Reply #6 on: August 03, 2006, 01:50:18 pm »
I'm silly.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2802
Re: I can help with C::B with cross platforms.
« Reply #7 on: August 03, 2006, 04:15:19 pm »
I don't have __WXMAC__ defined because C::B requires wxPopuWindow and that wxClass is not supported by WXMAC, so, I'm using fink and I compile wxWidgets with GTK. So i'm defining "WXGTK".
First I want to have a C::B working right (I probed the PPC version, but it have a lot of problems with the window layout).
And then to begin to work with WXMAC.


wxMac supports a "form" of popup window that will work with CodeBlocks.
It's called "miniframe". You can pick it out of the following patch.
As used in Codeblocks, the "MiniFrame" class works just like wxPopupWindow on all platforms (MS, Unix, OSX)

Code
Index: src/sdk/infowindow.cpp
===================================================================
--- src/sdk/infowindow.cpp (revision 2750)
+++ src/sdk/infowindow.cpp (working copy)
@@ -8,7 +8,14 @@
     #include "manager.h"
 #endif
 
+// --------------------------------------------------------------------------
+//  wxMAC has no support for wxPopupWindow, use wxMiniFrame instead
+// --------------------------------------------------------------------------
+#if (defined(__WXMAC__) || defined(_TEST_MINIFRAME_))
+BEGIN_EVENT_TABLE(InfoWindow, wxMiniFrame)
+#else
 BEGIN_EVENT_TABLE(InfoWindow, wxPopupWindow)
+#endif
 EVT_TIMER(-1, InfoWindow::OnTimer)
 EVT_MOTION(InfoWindow::OnMove)
 EVT_LEFT_DOWN(InfoWindow::OnClick)
@@ -116,7 +123,13 @@
 
 
 InfoWindow::InfoWindow(const wxString& title, const wxString& message, unsigned int delay, unsigned int hysteresis)
+            #if (defined(__WXMAC__) || defined(_TEST_MINIFRAME_))
+                #warning "Testing wxMac wxMiniFrame substitution for wxPopupWindow"\
+                " because the _TEST_MINIFRAME_ option was specified"
+            : wxMiniFrame(Manager::Get()->GetAppWindow(), -1, _T(""), wxDefaultPosition, wxDefaultSize, 0),
+            #else
             : wxPopupWindow(Manager::Get()->GetAppWindow(), wxSIMPLE_BORDER | wxWS_EX_TRANSIENT | wxCLIP_CHILDREN),
+            #endif
               m_timer(new wxTimer(this, 0)), status(0), m_delay(delay), ks(2)
     {
         wxBoxSizer *bs = new wxBoxSizer(wxVERTICAL);
@@ -225,4 +238,3 @@
     status = 3;
     m_timer->Start(scroll_millis, false);
 }
-
Index: src/sdk/infowindow.h
===================================================================
--- src/sdk/infowindow.h (revision 2750)
+++ src/sdk/infowindow.h (working copy)
@@ -16,8 +16,16 @@
 #include <wx/event.h>
 #include <wx/timer.h>
 #include <wx/string.h>
-#include <wx/popupwin.h>
 
+//-----------------------------------------------------------------------------
+// There is no wxPopupWindows for wxMac, use wxMiniFrame instead
+//-----------------------------------------------------------------------------
+#if (defined(__WXMAC__) || defined(_TEST_MINIFRAME_))
+    #include <wx/minifram.h>
+#else
+    #include <wx/popupwin.h>
+#endif
+
 #undef new
 #include <list>
 #include <algorithm>
@@ -48,7 +56,11 @@
     };
 };
 
+#if (defined(__WXMAC__) || defined(_TEST_MINIFRAME_))
+class InfoWindow : public wxMiniFrame
+#else
 class InfoWindow : public wxPopupWindow
+#endif
 {
     wxTimer *m_timer;
     int left;
@@ -71,7 +83,8 @@
 
     public:
 
-    static void Display(const wxString& title, const wxString& message, unsigned int delay = 5000, unsigned int hysteresis = 1){new InfoWindow(title, message, delay, hysteresis);};
+    static void Display(const wxString& title, const wxString& message, unsigned int delay = 5000, unsigned int hysteresis = 1)
+        {new InfoWindow(title, message, delay, hysteresis);};
 };
 
 #endif
Index: src/sdk/pluginmanager.cpp
===================================================================
--- src/sdk/pluginmanager.cpp (revision 2750)
+++ src/sdk/pluginmanager.cpp (working copy)
@@ -106,6 +106,14 @@
         ok = dir.GetNext(&filename);
     }
     Manager::Get()->GetMessageManager()->Log(_("Found %d plugins"), count);
+    #if defined(_TEST_MINIFRAME_)
+ {
+        InfoWindow::Display(_("Testing"),
+                            _("This is a test of wxMiniFrame.\n"
+                            "Used on the Mac to substitute for wxPopupWindow:\n"),
+                            15000, 3000);
+ }
+ #endif
  if (!failed.IsEmpty())
  {
         InfoWindow::Display(_("Warning"),

« Last Edit: August 03, 2006, 04:20:06 pm by Pecan »

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: I can help with C::B with cross platforms.
« Reply #8 on: August 03, 2006, 04:53:42 pm »
Quote
wxMac supports a "form" of popup window that will work with CodeBlocks.
It's called "miniframe". You can pick it out of the following patch.
I was going to say "wow, you're genious", when I changed it to use wxMiniFrame regardless of the OS (as it should work fine for Windows and Linux, too).
However, wxMiniFrame draws behind the Windows taskbar, so it is only partially visible :(
Any ideas on how to solve this? Well, anything apart from moving it up by the taskbar's height... :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2802
Re: I can help with C::B with cross platforms.
« Reply #9 on: August 03, 2006, 05:14:20 pm »
Quote
wxMac supports a "form" of popup window that will work with CodeBlocks.
It's called "miniframe". You can pick it out of the following patch.
I was going to say "wow, you're genious", when I changed it to use wxMiniFrame regardless of the OS (as it should work fine for Windows and Linux, too).
However, wxMiniFrame draws behind the Windows taskbar, so it is only partially visible :(
Any ideas on how to solve this? Well, anything apart from moving it up by the taskbar's height... :)

Oops!, I knew my luck couldn't last. My taskbar is in "hidden" mode, so I didn't see this.

I'll fiddle with it. It's using a style="0". I'll try some options.

thanks
pecan
« Last Edit: August 03, 2006, 05:25:44 pm by Pecan »

Offline Paco.Blasco

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: I can help with C::B with cross platforms.
« Reply #10 on: August 03, 2006, 11:44:07 pm »
Trying your solution with the wx comming with Tiger....

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2802
Re: I can help with C::B with cross platforms.
« Reply #11 on: August 03, 2006, 11:49:27 pm »
Trying your solution with the wx comming with Tiger....

IIRC, the wxMac included with Tiger is 2.5.2 . I don't believe CB will work with that.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2802
Re: I can help with C::B with cross platforms.
« Reply #12 on: August 03, 2006, 11:52:54 pm »
Quote
wxMac supports a "form" of popup window that will work with CodeBlocks.
It's called "miniframe". You can pick it out of the following patch.
I was going to say "wow, you're genious", when I changed it to use wxMiniFrame regardless of the OS (as it should work fine for Windows and Linux, too).
However, wxMiniFrame draws behind the Windows taskbar, so it is only partially visible :(
Any ideas on how to solve this? Well, anything apart from moving it up by the taskbar's height... :)

It doesn't appear that I'm going to be able to make the wxMiniFrame work as a top level window in MSW. wxPopupWindow is using a trick to make the Desk Top its' parent. That's how it stays on top without stealing the focus.

Guess we'll have to use the patch as is. I'll keep exploring it though.



Offline Paco.Blasco

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: I can help with C::B with cross platforms.
« Reply #13 on: August 04, 2006, 02:06:16 am »
I've compiled wxWdigets 2.6.3 patch2.
Ok.
But I'm having that problem:
g++ -dynamiclib  -single_module -flat_namespace -undefined suppress -o .libs/libcodeblocks.0.dylib  .libs/annoyingdialog.o .libs/autodetectcompilers.o .libs/base64.o .libs/blockallocated.o .libs/cbexception.o .libs/cbeditor.o .libs/cbeditorprintout.o .libs/cbplugin.o .libs/cbproject.o .libs/cbthreadpool.o .libs/cbworkspace.o .libs/compileoptionsbase.o .libs/compiler.o .libs/compilercommandgenerator.o .libs/compilerfactory.o .libs/compileroptions.o .libs/compiletargetbase.o .libs/configmanager.o .libs/configmanager-revision.o .libs/configurationpanel.o .libs/configuretoolsdlg.o .libs/confirmreplacedlg.o .libs/crc32.o .libs/devcpploader.o .libs/editarrayfiledlg.o .libs/editarrayorderdlg.o .libs/editarraystringdlg.o .libs/editkeywordsdlg.o .libs/editorbase.o .libs/editorcolourset.o .libs/editorconfigurationdlg.o .libs/editorlexerloader.o .libs/editormanager.o .libs/editor_hooks.o .libs/editpairdlg.o .libs/editpathdlg.o .libs/edittooldlg.o .libs/encodingdetector.o .libs/externaldepsdlg.o .libs/filefilters.o .libs/filegroupsandmasks.o .libs/filemanager.o .libs/finddlg.o .libs/globals.o .libs/importers_globals.o .libs/incrementalselectlistdlg.o .libs/infowindow.o .libs/macrosmanager.o .libs/managedthread.o .libs/manager.o .libs/menuitemsmanager.o .libs/messagelog.o .libs/messagemanager.o .libs/msvc7loader.o .libs/msvc7workspaceloader.o .libs/msvcloader.o .libs/msvcworkspacebase.o .libs/msvcworkspaceloader.o .libs/multiselectdlg.o .libs/newfromtemplatedlg.o .libs/personalitymanager.o .libs/pipedprocess.o .libs/pluginmanager.o .libs/pluginsconfigurationdlg.o .libs/printing_types.o .libs/projectbuildtarget.o .libs/projectdepsdlg.o .libs/projectfile.o .libs/projectfileoptionsdlg.o .libs/projectlayoutloader.o .libs/projectloader.o .libs/projectloader_hooks.o .libs/projectmanager.o .libs/projectoptionsdlg.o .libs/projectsfilemasksdlg.o .libs/projecttemplateloader.o .libs/replacedlg.o .libs/scriptingmanager.o .libs/sdk_events.o .libs/searchresultslog.o .libs/selecttargetdlg.o .libs/simplelistlog.o .libs/simpletextlog.o .libs/templatemanager.o .libs/toolsmanager.o .libs/uservarmanager.o .libs/workspaceloader.o .libs/xtra_classes.o .libs/xtra_res.o -all_load  scripting/bindings/.libs/libsqbindings.a scripting/sqplus/.libs/libsqplus.a scripting/sqstdlib/.libs/libsqstdlib.a scripting/squirrel/.libs/libsquirrel.a tinyxml/.libs/libtinyxml.a wxscintilla/.libs/libwxscintilla.a wxFlatNotebook/.libs/libwxflatnotebook.a propgrid/.libs/libpropgrid.a  -L/proiser/tools/lib -lwx_mac-2.6 -lpthread -ldl  -install_name  /proiser/tools/lib/libcodeblocks.0.dylib -compatibility_version 1 -current_version 1.1
ld: multiple definitions of symbol ___divdi3
/usr/lib/gcc/i686-apple-darwin8/4.0.1/libgcc.a(_divdi3.o) private external definition of ___divdi3 in section (__TEXT,__text)
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_divdi3_s.o) definition of ___divdi3
ld: multiple definitions of symbol ___moddi3
/usr/lib/gcc/i686-apple-darwin8/4.0.1/libgcc.a(_moddi3.o) private external definition of ___moddi3 in section (__TEXT,__text)
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_moddi3_s.o) definition of ___moddi3
ld: multiple definitions of symbol ___udivdi3
/usr/lib/gcc/i686-apple-darwin8/4.0.1/libgcc.a(_udivdi3.o) private external definition of ___udivdi3 in section (__TEXT,__text)
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_udivdi3_s.o) definition of ___udivdi3
ld: multiple definitions of symbol ___umoddi3
/usr/lib/gcc/i686-apple-darwin8/4.0.1/libgcc.a(_umoddi3.o) private external definition of ___umoddi3 in section (__TEXT,__text)
/usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libgcc_s.10.4.dylib(_umoddi3_s.o) definition of ___umoddi3
/usr/bin/libtool: internal link edit command failed
make[2]: *** [libcodeblocks.la] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

It seems as if a shared lib and a static lib was introducing the same symbols. I must to investigate this.
Thx!

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2802
Re: I can help with C::B with cross platforms.
« Reply #14 on: August 04, 2006, 01:02:28 pm »
I've compiled wxWdigets 2.6.3 patch2.
Ok.
But I'm having that problem:
g++ -dynamiclib  -single_module -flat_namespace -undefined suppress -o .libs/libcodeblocks.0.dylib  .libs/annoyingdialog.o .libs/autodetectcompilers.o .libs/base64.o .libs/blockallocated.o .libs/cbexception.o .libs/cbeditor.o
<...snip...>
make: *** [all] Error 2

It seems as if a shared lib and a static lib was introducing the same symbols. I must to investigate this.
Thx!

Check out "Installing Code::Blocks from source on Mac OS X" at http://wiki.codeblocks.org/index.php?title=Compiling_Code::Blocks_in_Mac_OS_X