-
Notifications
You must be signed in to change notification settings - Fork 62
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
FreeType submodule #1446
base: master
Are you sure you want to change the base?
FreeType submodule #1446
Conversation
43c9ea1
to
247ece2
Compare
efeda01
to
a93f12d
Compare
…ompiled freetype when building cgame
ee22f48
to
f0492fc
Compare
f0492fc
to
a50d4e0
Compare
a50d4e0
to
82553f0
Compare
If there is no comment about mistakes to fix, I will merge it in two days. See this comment for the reasons why I want and need FreeType to be a submodule: |
I see that for now, Freetype in the engine would still use the external_deps or system package by default. But what is the future of Freetype in external_deps? Is the plan to remove that and make everyone build it from scratch later? |
The plan is to never drop the ability to build against system library. Being able to not rebuild Freetype when the system provides it a wanted feature. This is what classic Linux distributions want. If Debian does an |
But we may be able to drop FreeType from I implemented The future looks like we will be able to drop FreeType from the My priority was to be able to build Lua and FreeType from submodules (required for the static cgame) while not enforcing it and still relying on shared libraries when they exist to not extend the engine build time. The |
CMakeLists.txt
Outdated
@@ -791,6 +791,8 @@ if (USE_BREAKPAD) | |||
endif() | |||
endif() | |||
|
|||
option(USE_SYSTEM_LIBS "Tries to use system libs where possible." ON) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a good name since it really means to use any kind of precompiled one. How about inverting the meaning and calling it USE_SOURCE_LIBS? Meaning prefer to build stuff from source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverting it may not be a good idea if I change this to some PREFER_SYSTEM_LIBS
with a fallback mechanism.
We can name it USE_EXTERNAL_LIBS
, that name will fit both the system libraries and the ones from the external_deps
folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I implemented PREFER_EXTERNAL_LIBS
instead.
freetype.cmake
Outdated
@@ -0,0 +1,18 @@ | |||
set(FT_DISABLE_BROTLI ON CACHE STRING "Disable Brotli" FORCE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are adding a new cmake file it should go in cmake/
. This is small enough that personally I would just put it in the main file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not. I did it that way because I mimicked how rmlui.cmake
is stored in Unvanquished repository, but the Unvanquished repository has no cmake/
folder (maybe it's time to do one there too).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will keep it that way for now, to be consistent with all other cmake files in both Unvanquished and Daemon repositories for building sources, like src.cmake
, srclibs.cmake
(and the lua.cmake
and rmlui.cmake
ones in Unvanquished).
We can define a new convention later and migrate those to a better name later, but for now this is consistent.
if (NOT FLAG_GNU89) | ||
message(FATAL_ERROR "GNU89 or C99 not supported by compiler") | ||
message(FATAL_ERROR "GNU99 is not supported by the compiler") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test variable's name is now mismatched with the flag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
5f97eb4
to
e2a9060
Compare
I implemented |
e2a9060
to
90f8bb4
Compare
CMakeLists.txt
Outdated
find_package(${LIB_NAME}) | ||
|
||
if (NOT ${LIB_NAME}_FOUND) | ||
message(WARNING "PREFER_EXTERNAL_LIBS is enabled but external ${LIB_NAME} is not found, falling back to vendored FreeType.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The library name is hard-coded as "FreeType"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
freetype.cmake
Outdated
@@ -0,0 +1,18 @@ | |||
set(FT_DISABLE_BROTLI ON CACHE STRING "Disable Brotli" FORCE) | |||
set(FT_DISABLE_BZIP2 ON CACHE STRING "Disable bzip2" FORCE) | |||
set(FT_DISABLE_HARFBUZZ ON CACHE STRING "Disable HarfBuzz" FORCE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The subdirectory stuff showing up in the option list is always annoying. Let's put mark_as_advanced for all those
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I have also marked as advanced another one we don't modify.
While I was at it, I modified those lines as option()
, and we don't force them anymore, we just set the default value we want, and this takes precedence over FreeTypes's own defaults, but still allow us to tweak them if we want.
The only forced FreeType option is FT_DISABLE_ZLIB
(option to use builtin FreeType zlib) because it is always ON with NaCl and we already rely on PREFER_EXTERNAL_LIBS
instead when building the engine.
a38a469
to
d238ff3
Compare
It is written against the Saigo branch:
There is no submodule yet, one has to clone:
https://gitlab.freedesktop.org/freetype/freetype.git
aslibs/freetype
When
USE_SYSTEM_LIBS
is set toON
, system libraries are used instead of submodules.See also:
See this issue for the motivation behind it: