List Info

Thread: Re: Same project but different files included




Re: Same project but different files included
country flaguser name
United States
2007-05-31 06:40:06

--- In anthemion-devtools%40yahoogroups.com">anthemion-devtoolsyahoogroups.com, YAP <x112358...> wrote:
&gt;
> Excellent! Thanks! Have never thought about myself.....
>
> Cheers
&gt; /Ake
>;
> On 5/31/07, ddotedotsdot <dsilvia...> wrote:
&gt; >
>; > --- In
anthemion-devtools%40yahoogroups.com">anthemion-devtoolsyahoogroups.com<;anthemion-devtools%40yahoogroups.com>,
> > YAP <x112358> wrote:
&gt; > >
>; > > Thanks Dave for all the work you spent on this (appreciated).
>; > >
>; > > I work in the way you describe today. For this project I use Visual
&gt; > C++ for
> > > WIN32 and GCC for Unix.
&gt; > >
>; > > As this is a quite a large project there is many ifdefs for platform
> > > dependent things but for some functionality the implementions are so
> > > different that the code is in a seperate h/cpp file pairs for each
>; > > platform. Yes I know it would have been possible to put them in the
> > same
>; > > files and use ifdefs but separate them make the code easier to
> > maintain and
> > > look nice.
&gt; > >
>; > > So to be clear
&gt; > >
>; > > - On Unix I need to compile files a.cpp, b.cpp, d.cpp amd x.cpp to
> > form the
> > > executable aaaa
>; > > - On Windows I need to compile files a.cpp, b.cpp, d.cpp amd y.cpp
&gt; > form the
> > > executable aaaa.exe
> > >
>; > > Cheers
&gt; > > /Ake
>; > >
>; > > On 5/31/07, Dave Silvia <dsilvia> wrote:
&gt; > > >
>; > > > > -- On Wed, 30 May 2007 22:39:29 +0200 YAP wrote -- I have a
> > project
> > > > > which is built for Windows and Unix. For some parts of this
project
> > > > > different files is used for each environment. How is this best
>; > > > > handled in DialogBlocks?
> > > > >
>; > > > > One obvious way to solve this is to create two projects. One for
> > > > > Unix and one for Windows which overlaps. A better way in my
opinion
> > > > > was if the source section could have some environment under
&gt; > > > > sections also which was hooked to the "configurations&quot; settings.
> > > > >
>; > > > > This is still my # 1 favorite tool!
&gt; > > > >
>; > > > > Cheers /Ake
>; > > > >
>; > > >
>; > > > Hi!
> > > >
>; > > > I'm only guessing, since you don't mention platform specifics,
> > > > compilers, or DB/wxWidgets versions, that you're using the current
> > > > DB/wxWidgets and the same compiler on both platforms? (else,
there is
> > > > no conflict!;)
> > > >
>; > > > >> A better way in my opinion was if the source section could have
>; > > > >> some environment under sections also which was hooked to the
> > > > >> "configurations&quot; settings.
> > > >
>; > > > Just for grins, let's say you're using GCC on both platforms.
You can
> > > > keep platform specific details separate by using the Add button in
> > > > Build>Configurations>Compiler Configurations:
>; > > >
>; > > >
>; > > >
>; > > > You then get:
>; > > >
>; > > >
>; > > >
>; > > > Check the box Debug version, insert Unix in front of GCC
Debug, and
> > > > click OK.
> > > >
>; > > > Select Add again, and this time:
&gt; > > >
>; > > >
>; > > >
>; > > > only insert Unix in front of GCC Release and click OK.
> > > >
>; > > > Then do similarly for Windows, inserting Windows in front of GCC
> > > > Debug/Release.
> > > >
>; > > > There should be no conflicts then, as DB will generate appropriate
> > > > makefiles on each platform. If the includes you need are in
addition
> > > > to platform headers (I assume they are, by implication from your
>; > > > post), the Include path would be set to:
> > > >
>; > > >
>; > > >
>; > > > for Unix and:
>; > > >
>; > > >
>; > > >
>; > > > for Windows.
> > > >
>; > > > If the specific files are what you're changing from one
platform to
> > > > another, the standard method is to #ifdef ... #else ... #endif
around
>; > > > the include files in the code, i.e.:
&gt; > > >
>; > > > #ifdef MyWindows
> > > > #include "myWindows.h&quot;
> > > > #else
&gt; > > > #include "myUnix.h"
> > > > #endif
&gt; > > >
>; > > > and have DB define MyWindows for Windows GCC Debug/Release:
> > > >
>; > > >
>; > > >
>; > > > with -DMyWindows in the Debug flags.
&gt; > > >
>; > > > Lastly, you'd want to have separate makefiles, so:
> > > >
>; > > >
>; > > >
>; > > > and:
>; > > >
>; > > >
>; > > >
>; > > > In this way, you have only one project for multiple builds.
> > > >
>; > > > I'm attaching a .pjd for reference.
> > > >
>; > > > HTH:
>; > > >
>; > > > thx, Dave S.
> > > ---
> > > Ake Hedman (YAP - Yet Another Programmer)
> >
>; > > - On Unix I need to compile files a.cpp, b.cpp, d.cpp amd x.cpp to
> > form the
> > > executable aaaa
>; > > - On Windows I need to compile files a.cpp, b.cpp, d.cpp amd y.cpp
&gt; > form the
> > > executable aaaa.exe
> >
>; > Hi!
> >
>; > Hmm...
&gt; >
>; > Is there a way you can put these files into an include file, i.e.:
&gt; >
>; > platformSrcs.h
>; >
>; > #ifdef MyWindows
> > #include "myWindowsa.cpp"
&gt; > #include "myWindowsb.cpp"
&gt; > #include "myWindowsd.cpp"
&gt; > #include "myWindowsy.cpp"
&gt; > #else
&gt; > #include "myUnixa.cpp&quot;
> > #include "myUnixb.cpp&quot;
> > #include "myUnixd.cpp&quot;
> > #include "myUnixx.cpp&quot;
> > #endif
&gt; >
>; > or if they need separate files, just put each in a file with the
> > #ifdef... #else ... #endif.
> >
>; > platformA.h
> > #ifdef MyWindows
> > #include "myWindowsa.cpp"
&gt; > #else
&gt; > #include "myUnixa.cpp&quot;
> > #endif
&gt; >
>; > platformB.h
> > #ifdef MyWindows
> > #include "myWindowsb.cpp"
&gt; > #else
&gt; > #include "myUnixb.cpp&quot;
> > #endif
&gt; >
>; > platformD.h
> > #ifdef MyWindows
> > #include "myWindowsd.cpp"
&gt; > #else
&gt; > #include "myUnixd.cpp&quot;
> > #endif
&gt; >
>; > platformXY.h
> > #ifdef MyWindows
> > #include "myWindowsy.cpp"
&gt; > #else
&gt; > #include "myUnixx.cpp&quot;
> > #endif
&gt; >
>; > In that way, you can have your cake and eat it, too! (to coin a
> > phrase!;)
> >
>; > Anyway, that's what I'd do. It should work just fine.
&gt; >
>; > HTH:
>; >
>; > thx,
>; > Dave S.
> >
>; >
> >
>;
>
>
> --
> ---
> Ake Hedman (YAP - Yet Another Programmer)
> eurosource, Brattbergavagen 17, 820 50 LOS, Sweden
&gt; Phone: (46) 657 413430 Cellular: (46) 73 0533 146
> Company home: http://www.dofscandinavia.com
> Kryddor/Te/Kaffe: http://www.brattberg.com
>; Personal homepage: http://www.dofscandinavia.com/akhe
>; Automated home: http://www.vscp.org
>

Hi!

Let me know how it turns out? It's an interesting problem.;)

thx,
Dave S.

__._,_.___
.

__,_._,___
Re: Re: Same project but different files included
country flaguser name
United States
2007-05-31 07:05:29




Hi!

Let me know how it turns out? It's an interesting problem.;)

thx,
Dave S.





 




Hi Dave,

works like a charm. Did a platform.h file where I include the platform dependent files into the project. The only thing that annoys me now is that I didn't figure out this myself...

Thanks all for your kind help.

Cheers
/Ake

&nbsp;

--
---
Ake Hedman (YAP - Yet Another Programmer)
eurosource, Brattbergavagen 17, 820 50 LOS, Sweden
Phone: (46) 657 413430 Cellular: (46) 73 0533 146
Company home: http://www.dofscandinavia.com&nbsp;   ;
Kryddor/Te/Kaffe: http://www.brattberg.com
Personal homepage: http://www.dofscandinavia.com/akhe
Automated home: http://www.vscp.org

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )