Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » multi-platform c++ development
multi-platform c++ development [message #196719] Thu, 12 July 2007 17:44 Go to next message
Eclipse UserFriend
Originally posted by: dingfelder_nospam.gmail.com

I need to generate a library for multiple platforms: win, linux and mac

I am currently running eclipse on XP and can successfully generate the
dll for windows.

I am moving my development platform to linux.

Assuming that I can get my code to compile there which should not be too
hard, as it is pretty standard, how do I get CDT to generate the library
for all 3 platforms?
Re: multi-platform c++ development [message #196850 is a reply to message #196719] Fri, 13 July 2007 04:24 Go to previous messageGo to next message
Eclipse UserFriend
dingfelder wrote:
> I need to generate a library for multiple platforms: win, linux and mac
>
> I am moving my development platform to linux.
>
> Assuming that I can get my code to compile there which should not be too
> hard, as it is pretty standard, how do I get CDT to generate the library
> for all 3 platforms?

Did you write your own makefiles? If this is true it is simple, I would
(assuming autotools which you probably didn't used in the past for
simplicity, should work with cmake as well) create different build
directories with different (cross) compilers:

First create the makefiles or adapt you build system ...
mkdir build.linux; cd build.linux; CXX=g++-linux ../configure
mkdir build.macos; cd build.macos; CXX=g++-macos ../configure

Than you could select your makefile targets for the individual build
directories to create your stuff ...

Jens
Re: multi-platform c++ development [message #197730 is a reply to message #196850] Thu, 19 July 2007 01:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dingfelder_nospam.gmail.com

My make files were autogenerated, but I am open to suggestions on how I
"should" be doing it.

My projects are not too large so I assume I could start from scratch
from a helloworld point of view and then drop in my 5 or 6 cpp files
once I get it working on both windows and linux.

Do you suggest making the makefiles yourself? or can eclipse do it for me?

Ideally, I would set my target to release, and hit build, and it would
generate both the linux and windows exes or libraries.

thoughts?

Jens Seidel wrote:
> dingfelder wrote:
>> I need to generate a library for multiple platforms: win, linux and mac
>>
>> I am moving my development platform to linux.
>>
>> Assuming that I can get my code to compile there which should not be too
>> hard, as it is pretty standard, how do I get CDT to generate the library
>> for all 3 platforms?
>
> Did you write your own makefiles? If this is true it is simple, I would
> (assuming autotools which you probably didn't used in the past for
> simplicity, should work with cmake as well) create different build
> directories with different (cross) compilers:
>
> First create the makefiles or adapt you build system ...
> mkdir build.linux; cd build.linux; CXX=g++-linux ../configure
> mkdir build.macos; cd build.macos; CXX=g++-macos ../configure
>
> Than you could select your makefile targets for the individual build
> directories to create your stuff ...
>
> Jens
>
Re: multi-platform c++ development [message #197764 is a reply to message #197730] Thu, 19 July 2007 04:11 Go to previous messageGo to next message
Eclipse UserFriend
dingfelder wrote:

> My make files were autogenerated, but I am open to suggestions on how I
> "should" be doing it.

There is no proper way to do it but really many ones. I suggest you use
explicitely a build system such as ant, autoconf/automake, cmake,
tmake/qmake but there are many more. cmake is maybe a good candidate (I
don't know it well but KDE uses it).

Using the Eclipse build system will probably never fullfil all your goals,
especially if you want to build the project also without Eclipse (which
requires that some kind of system check is performed, the compiler name and
paths differ across various platforms and should be detected), want to
integrate unit tests, ...

But please be aware that writing your own build system configuration can be
very hard (but should be easy for a trivial hello world example).

> Do you suggest making the makefiles yourself? or can eclipse do it for
> me?

Both is possible, it depends on your requirements. I suggest you try it out,
play a little bit and learn it just for fun. You could also see how other
Open Source projects do it (GNU projects uses always autotools), the source
code of thousands of projects is part of every Linux system, don't know
about cygwin ...

> Ideally, I would set my target to release, and hit build, and it would
> generate both the linux and windows exes or libraries.

At the same time, with one build? This requires very probably manual work,
e.g. the following Makefile stanza:

all: linux win

linux: FORCE
cd build.linux; make all

win: FORCE
cd build.win; make all

FORCE:

Jens
Re: multi-platform c++ development [message #198041 is a reply to message #197764] Mon, 23 July 2007 20:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dingfelder_nospam.gmail.com

Thanks for the advise.

I am working through learning cmake, but am finding examples for eclipse
a bit hard to find at the moment.

I do have one example from Mike Jackson that he announced on this board
earlier this week, but it is missing some basic info such as how to
generate the control CMakeLists.txt file.

When I get it working, I will post an update.

Cheers,

Ding

Jens Seidel wrote:
> dingfelder wrote:
>
>> My make files were autogenerated, but I am open to suggestions on how I
>> "should" be doing it.
>
> There is no proper way to do it but really many ones. I suggest you use
> explicitely a build system such as ant, autoconf/automake, cmake,
> tmake/qmake but there are many more. cmake is maybe a good candidate (I
> don't know it well but KDE uses it).
>
> Using the Eclipse build system will probably never fullfil all your goals,
> especially if you want to build the project also without Eclipse (which
> requires that some kind of system check is performed, the compiler name and
> paths differ across various platforms and should be detected), want to
> integrate unit tests, ...
>
> But please be aware that writing your own build system configuration can be
> very hard (but should be easy for a trivial hello world example).
>
>> Do you suggest making the makefiles yourself? or can eclipse do it for
>> me?
>
> Both is possible, it depends on your requirements. I suggest you try it out,
> play a little bit and learn it just for fun. You could also see how other
> Open Source projects do it (GNU projects uses always autotools), the source
> code of thousands of projects is part of every Linux system, don't know
> about cygwin ...
>
>> Ideally, I would set my target to release, and hit build, and it would
>> generate both the linux and windows exes or libraries.
>
> At the same time, with one build? This requires very probably manual work,
> e.g. the following Makefile stanza:
>
> all: linux win
>
> linux: FORCE
> cd build.linux; make all
>
> win: FORCE
> cd build.win; make all
>
> FORCE:
>
> Jens
Re: multi-platform c++ development [message #198082 is a reply to message #198041] Tue, 24 July 2007 04:27 Go to previous messageGo to next message
Eclipse UserFriend
dingfelder wrote:

> I am working through learning cmake, but am finding examples for eclipse
> a bit hard to find at the moment.

That's your first error! cmake is completely unrelated to Eclipse! I suggest
you forget Eclipse when trying to understand cmake. Maybe Eclipse is indeed
able to simplify some steps for cmake but your first steps should be
independent from Eclipse and done on the command line.

> I do have one example from Mike Jackson that he announced on this board
> earlier this week, but it is missing some basic info such as how to
> generate the control CMakeLists.txt file.

Creating CMakeLists.txt is the only job you have to do. If some programs can
create it for you it would be useless to suggest that *you* learn cmake.
It's your job to write it! If this is too hard for you than you should
indeed use Eclipse default build system but you should not expect to be able
to extent it (easily).

As I told you I do not know cmake (yet) as well. But I'm sure there are many
tutorials available.

Jens
Re: multi-platform c++ development [message #198114 is a reply to message #196719] Tue, 24 July 2007 10:07 Go to previous messageGo to next message
Eclipse UserFriend
On 2007-07-12 17:44:00 -0400, dingfelder <dingfelder_nospam@gmail.com> said:

> I need to generate a library for multiple platforms: win, linux and mac
>
> I am currently running eclipse on XP and can successfully generate the
> dll for windows.
>
> I am moving my development platform to linux.
>
> Assuming that I can get my code to compile there which should not be
> too hard, as it is pretty standard, how do I get CDT to generate the
> library for all 3 platforms?

I am not sure that you can actually generate a binary for OS X on
Linux. You would need Apple's version of the GCC toolchain, which I
think is opensourced somewhere. Just FYI. If you really need to do this
and your program is purely a command line app that will NOT need any
type of GUI or access to apple specific system calls then you _might_
be able to load Darwin on an intel based PC and try your compile then
find someone who has a mac to test it out.

Just FYI.

Mike
Re: multi-platform c++ development [message #198176 is a reply to message #198114] Tue, 24 July 2007 17:03 Go to previous message
Eclipse UserFriend
Originally posted by: dingfelder_nospam.gmail.com

Thanks Mike.

My main concern at this point is just windows and Linux, although Mac is
desirable as well if possible. And to make things easier, it is just a
(command line) library I am trying to make. (it is currently a windows
c++ dll used for java JNI that I am trying to port to linux)

Cheers,

- Ding

>> Assuming that I can get my code to compile there which should not be
>> too hard, as it is pretty standard, how do I get CDT to generate the
>> library for all 3 platforms?
>
> I am not sure that you can actually generate a binary for OS X on Linux.
> You would need Apple's version of the GCC toolchain, which I think is
> opensourced somewhere. Just FYI. If you really need to do this and your
> program is purely a command line app that will NOT need any type of GUI
> or access to apple specific system calls then you _might_ be able to
> load Darwin on an intel based PC and try your compile then find someone
> who has a mac to test it out.
>
> Just FYI.
>
> Mike
>
Previous Topic:Problem with C in Eclipse 3.3
Next Topic:define compiler parametrs per file.
Goto Forum:
  


Current Time: Fri May 09 02:32:03 EDT 2025

Powered by FUDForum. Page generated in 0.03735 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top