[build2] Building objective C code

Fabian Meyer fabian.meyer at posteo.de
Thu May 5 18:35:47 UTC 2022


Hi Boris,

thanks, that actually worked! Finally the MacOS build succeeds. However, 
I'm not really happy with build2 code.
I had to replicate the adhoc recipes for obj-c and obj-c++ files, which 
makes a total of 4 pretty similar recipes. I am not familiar enough with 
the capabilities of the build2 language, so I have no clue on how to 
reduce this redundancy.
Are there any resources that I can consult to get the bigger picture? 
Like how can I create my own rules? Or is there the possibility for 
macros or functions in build2?

Regards
Fabian

On 5/5/22 10:23, Boris Kolpackov wrote:
> Fabian Meyer via users <users at build2.org> writes:
>
>> I am currently trying to compile some objective-C source files using build2
>> for MacOS builds of SFML (see https://github.com/build2-packaging/sfml/blob/master/sfml-window/src/buildfile#L72).
>> I basically copied the adhoc-recipe from the GLFW package (see
>> https://github.com/build2-packaging/glfw/blob/master/glfw/src/buildfile#L24)
>>
>> It seems to work or at least do something meaningful. However, during the
>> build the compilation of some objective-c files fails, because the compiler
>> cannot find certain header files ([...]). The missing header files lie in
>> the sfml-system package, which is imported at the top of the buildfile [...].
>> Building C++ sources, which also need these headers, works.
>> It seems like the exported include paths of the sfml-system dependency are
>> not propagated to the adhoc recipe. I tried adding the intf_libs explicitly
>> to the adhoc recipe but that did not help.
> The current state of the art in Objective-C/C++ compilation is libQt6Core
> (warning: it's quite a complex buildfile, and it requires not-yet-released
> build2 0.15.0):
>
> https://github.com/build2-packaging/Qt6/blob/master/libQt6Core/QtCore/buildfile
>
> In particular, it solves the problem of obtaining header search paths
> from imported libraries (via libul{Qt6CoreMeta}). The buildfile is
> quite well commented (IMO), so I think you should be able to figure
> out what's going on. But let me know if you have any questions about
> any of this.



More information about the users mailing list