Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

passing string verbatim to fbuild and other issues #7

Closed
thelastmammoth opened this issue Mar 1, 2012 · 5 comments
Closed

passing string verbatim to fbuild and other issues #7

thelastmammoth opened this issue Mar 1, 2012 · 5 comments
Assignees

Comments

@thelastmammoth
Copy link

A) can we pass a string verbatim as one of the arguments, e.g. lflags, instead of passing in a vector of words?
Incidentally, that would solve the next problem (B).
That would also help migrating between a Makefile (or related) to Fbuild, since typically, arguments are given there as strings. Of course I wrote a 2-liner to go from string to vector of strings, but the problem in A remains.

B) Is there any way to build a C++ program/library that uses OSX frameworks ?
In WAF, you can simply provide:
bld.shlib(source='fun', target='libfun', framework=['A','B'])
There doesn't seem to be an equivalent in Fbuild.
I also tried passing those explicitly to

target = shared.build_lib('libfun', 'fun',lflags=['-framework','A','-framework','B'])

but that doesn't work as Fbuild converts it to :
/usr/bin/g++ -dynamiclib […] -framework A B […]
instead of
/usr/bin/g++ -dynamiclib […] -framework A -framework B […]
which fails (since B is not supposed to be a source)

C) problem when source file is absolute path:
when a source file /path/fun.cpp is absolute, the corresponding object file is in /path/fun.os instead of ./build/path/fun.cpp

D) support for multiple objects per source file
waf smartly compiles fun.cpp in fun.cpp.1.o , fun.cpp.2.o, etc. to support generating multiple object files for one source file.
It seems Fbuild only generates fun.os, which leads to having to recompile certain things and loses the intermediary files.

E) waf has a progress bar (indicating the percent of completion)
I'm not sure whether that'd be possible in Fbuild given the different build model used (and dynamic tasks), but I'm sure there should be some way to have at least an idea.. at the very least writing the task number

F) support for D, objective C, objective C++
Is there a way to at least let the user write his custom build for that?

G) does fbuild -j8have any effect (cf make -j8) ?
I couldn't see it in the (limited) doc

@thelastmammoth
Copy link
Author

I found a fix for problem B above, but it's a temporary one:

edit:
fbuild/lib/fbuild/builders/c/gcc/init.py
unset condition: if flag not in new_flags:

This will allow one to have:
-framework A -framework B without collapsing the 2nd framework, etc.

The obvious option is to add a framework field (on top of lflags), but a more robust solution, as I suggested above, is to add a lflags_verbatim field, which will be a string passed verbatim to the linker (and or cflags_verbatim); this will allow other esoteric compiler/linker options that one cannot think of in advance.

@refi64
Copy link
Contributor

refi64 commented Apr 2, 2015

@thelastmammoth I know this is 3 years late, but:

A) That's possible, but you end up with lots of type checks:

if isinstance(data, str):
    data = data.split()

There's also a big can of worms from that (should other iterators be treated as lists or strings? since there are already type checks, should fbuild check the validity of the argument types? what if someone passes in a number?)

B) That's definitely a bad issue. An option should probably be added like includes...but I don't have a Mac, so I'd need someone to test it.

C) You generally shouldn't use absolute paths in a build system. Regardless, what exactly is your use case?

D) That's another issue I need to fix.

E) Unfortunately, that's not really possible because fbuild doesn't have the notion of tasks like Waf does.

F) I want to add more builders, so that might be coming soon.

G) Yes.

Also, a *flags_verbatim field might be a good idea, but it'd need to be a list. Python's subprocess module requires that. You can always use shlex.split.

@refi64
Copy link
Contributor

refi64 commented Apr 2, 2015

@thelastmammoth Actually, I think you can build Objective C source with the C builder if you link with objc. Something like:

c = guess_static(ctx, external_libs=['objc'])

@refi64 refi64 self-assigned this Apr 2, 2015
@refi64
Copy link
Contributor

refi64 commented Jun 6, 2015

D now works by placing object files for different targets in different directories.

@refi64
Copy link
Contributor

refi64 commented May 1, 2016

No replies in ages. Closing in favor of #23, #24, #25.

@refi64 refi64 closed this as completed May 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants