Author Topic: Trying to build a cross-platform project  (Read 4268 times)

Offline vdave420

  • Single posting newcomer
  • *
  • Posts: 4
Trying to build a cross-platform project
« on: June 01, 2011, 09:36:43 am »
Hello,

I have a project i'm trying to build in CB, and it needs to be built on both mac osx and win32 platforms (ie, the developers have these platforms to work with).

Unfortunately, libraries which this project relies upon will not be located in the same place for each platform (nor will they even be the same set of libraries!).

I've seen examples of using something called pkg-config to accomplish this, as the docs seem to indicate that in the Linker Settings -> Other Settings, something like:

`pkg-config opencv --libs`

should be possible (as an example).  For various unrelated reasons, I can't use pkg-config for this project, but i have something similar: a command i can run on both platforms which will produce the required command line arguments.

For example, on the windows platform, from a shell in an arbitrary directory, I can do this:

C:\>opencv_utils_libpath
-L C:\Users\Henry/tmp/opencv/OpenCV-2.2.0-win/OpenCV-2.2.0/bin


C:\>opencv_utils_includepath
-I C:\Users\Henry/tmp/opencv/OpenCV-2.2.0-win/OpenCV-2.2.0/include/opencv/ -I C:\Users\Henry/tmp/opencv/OpenCV-2.2.0-win/OpenCV-2.2.0/include/


These are producing the correct output.
In the "Other settings" however, i have added lines like:

`opencv_utils_includepath`

The idea being that this command should be executed (from anywhere in the filesystem) and the above output would be generated.  However, the actual command line going to gcc is:


mingw32-g++.exe -Wall -fexceptions -mstackrealign     -g     -c C:\test\main.cpp -o obj\Debug\main.o

which clearly means something is failing to substitute that command's output correctly.  What am I doing wrong?

Thanks in advance,
     -dave-

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Trying to build a cross-platform project
« Reply #1 on: June 01, 2011, 10:01:28 am »
Have you tried to use full path in the backtick (``) expression?
Probably C::B is not searching the PATH variable.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline vdave420

  • Single posting newcomer
  • *
  • Posts: 4
Re: Trying to build a cross-platform project
« Reply #2 on: June 01, 2011, 10:10:00 am »
Yikes.  The problem with that is the two platforms have completely different path schemes, so it's not possible to have a single fully-path-qualified command be sufficient for both systems.

The fact that various documentation seems to make it look like pkg-config can solve the same problem means it's got to be possible some how.  Documentation i've read seems to indicate that it _should_ be searching the path, but with absolutely no debugging output from CB it's a bit harder to test that assertion.  I'll give it a shot, but if that actually ends up being the problem, it'll make me a sad panda.

Thanks!
    -dave-

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Trying to build a cross-platform project
« Reply #3 on: June 01, 2011, 11:08:36 am »
If the command is reachable via the system path, it should work.

C::B caches the result of the backticked commands, so if the output has changed, while C::B is open (probably due to an error), you have to restart C::B.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Trying to build a cross-platform project
« Reply #4 on: June 01, 2011, 12:36:40 pm »
Yikes.  The problem with that is the two platforms have completely different path schemes, so it's not possible to have a single fully-path-qualified command be sufficient for both systems.
I've meant to test it, in order to verify that the command is executed.

Another test you could try is to enter `echo "test"`, to see if it will be printed in the output...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline mirai

  • Multiple posting newcomer
  • *
  • Posts: 108
Re: Trying to build a cross-platform project
« Reply #5 on: June 01, 2011, 07:12:50 pm »
There's another solution to this kind of problems.
In Windows you can use linkd.exe tool from Resource Kit Tools http://www.microsoft.com/downloads/en/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd to link one directory into another on NTFS drive.
This is similar to unix symbolic links, but works only with directories. This way you can link all you need into project tree and use only short relative paths within project. Also, you can make few scripts to setup and remove links to make this approach friendly to VCS.

Offline vdave420

  • Single posting newcomer
  • *
  • Posts: 4
Re: Trying to build a cross-platform project
« Reply #6 on: June 01, 2011, 07:34:49 pm »
Yikes.  The problem with that is the two platforms have completely different path schemes, so it's not possible to have a single fully-path-qualified command be sufficient for both systems.
I've meant to test it, in order to verify that the command is executed.

Another test you could try is to enter `echo "test"`, to see if it will be printed in the output...

I've tried that, and it didn't seem to work.  I think the caching might be to blame here, as it seemed to work intermittently for me last night.