AmigaPorts / ACE

Amiga C Engine
Mozilla Public License 2.0
156 stars 26 forks source link

use CMake Package Manager instead of bundling freetype/fmt for tools #199

Closed tehKaiN closed 1 year ago

tehKaiN commented 1 year ago

Description

Amalgamated version of freetype is problematic due to being outdated (build emitted lots of "register" warnings). Also, some ppl had errors while building tools with OSX, and error messages hinted that this library is a problem.

Instead of bundling freetype and fmt sources, they are now auto-downloaded using CMake Package Manager (CPM). Also, they're now in more recent version and bumping them should be less tedious.

Tested with MS Build Tools 2022 and GCC 12.2 under Windows.

Checklist

richardleggett commented 1 year ago

Just testing this branch on MacOS (x86 and an M1) and both are yielding a new error:

In file included from ~/src/ace/tools/src/common/bitmap.cpp:10:
~/src/ace/tools/src/common/../common/endian.h:11:17: error: constexpr function never produces a constant expression [-Winvalid-constexpr]
        constexpr bool isBig(void)
                       ^
~/src/ace/tools/src/common/../common/endian.h:18:10: note: read of member 'c' of union with active member 'i' is not allowed in a constant expression
                return uTest.c[0] == 1;
                       ^
1 error generated.

If access to those platforms is restricted would be happy to dig into this, maybe with some pointers.

tehKaiN commented 1 year ago

huh, looks like clang/gcc mismatch 👀 https://stackoverflow.com/questions/72329759/constexpr-function-returning-member-of-union-g-vs-clang-no-diagnostics-vs

richardleggett commented 1 year ago

On a Mac gcc is aliased to clang*, would this be a case we need to force e.g. gcc-11 via cmake (e.g. using brew install gcc@11)?

*
gcc --version
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.3.0
Thread model: posix
InstalledDir: /Applications/Xcode-14.3.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
tehKaiN commented 1 year ago

Nah, I prefer fixing it for clang. I've deployed a fix - try now! ;)

richardleggett commented 1 year ago

Almost there!

ld: library not found for -lcrt0.o

I had to remove the -static flag to get it to work and build the binaries. Would that be OK do you think?

tehKaiN commented 1 year ago

try now ;)

richardleggett commented 1 year ago

🍾 That got it