cmake: make DaemonPlatform, Architecture, Compiler, etc. autonomous and reusable as Yokai framework#1641
cmake: make DaemonPlatform, Architecture, Compiler, etc. autonomous and reusable as Yokai framework#1641illwieckz wants to merge 26 commits into
Conversation
|
Why would we need a variable called NACL_PIE? There is no PIE for NaCl and never will be. |
Note that some of the facilities here duplicate CMake built-in functionality, or have more fully developed alternatives available from other projects. Effort is likely to be wasted in such cases:
DaemonArchitecture looks most likely to be useful. I think I saw a similar thing with SDL, but Daemon's looked more complete. |
Well maybe I'm wrong about that: the native_client scons build has a |
|
Then again, there is a comment explaining that it is not useful: Also there is another comment confirming that Saigo does not have PIC. |
745bede to
d2b73ca
Compare
|
I removed the unused NaCl PIE thing. |
f01bf1f to
10ae04b
Compare
5d31fb8 to
a9191be
Compare
We already renamed “unsupported” as “unknown” so it was just by luck we didn't stop the build (what we wanted when changing that).
a9191be to
cd64470
Compare
|
I landed my rewrite of This defines variables like A good example of usage of them is to avoid the ambiguity of Instead of It may also help to do things differently with MinGW on Linux and MinGW on Windows, when needed. It may also help in the future as cross-compiler evolves, for example the day Zig becomes suitable for us to cross-compile for macOS on Linux, and things like that. I also renamed |
3227432 to
5712ef4
Compare
6bfb4db to
95c6284
Compare
|
The NaCl architecture stuff is now removed from Yokai and stored in |
Right now Dæmon's yokai_write_buildinfo("DaemonEngine")And game's yokai_write_buildinfo("DaemonGame")The buildinfo is never mixed between engine and game. |
Also the list of things in engine and game buildinfo aren't the same anymore, for example the game buildinfo doesn't have the Also it's not possible for the game to use engine's buildinfo because the nexe build is done in a subfolder. The name passed to |
I'm saying the write_buildinfo should be in Unvanquished CMakeLists.txt, not in DaemonGame.cmake. I'm hoping this could fix #1599. |
| #endif | ||
|
|
||
| #if defined(__unix__) || defined(__unix) || defined(unix) | ||
| #pragma message(REPORT_COMPATIBILITY("Unix")) |
There was a problem hiding this comment.
I suggest removing this as it has unexpected semantics: Mac OS is a Unix, but does not define these. Anyhow the good old idiom for Unix-like is NOT WIN32 :)
| # implementing standards like FHS, XDG, GLVND… | ||
| # Makes possible to do that in CMake code: | ||
| # > if (YOKAI_HOST_SYSTEM_XDG_COMPATIBILITY) | ||
| # > if (YOKAI_SYSTEM_XDG_COMPATIBILITY) |
There was a problem hiding this comment.
Instead of XDG_COMPATIBILITY I prefer the GNU_COMPATIBILITY name you used in some other places. This makes sense by reflecting the "GNU/Linux" userland/kernel distinction. So we have Linux compatibility include Android's Linux-based kernel, and GNU compatibility including the FreeBSD using a similar userland to the Linux desktops.
There was a problem hiding this comment.
Well it's not that great since GNU compatibility could also be confused for the "GNU compiler id" that CMake identifier for GCC. But at least it relates to the "GNU/Linux" meme. For me XDG doesn't suggest the concept you want to get at at all.
There was a problem hiding this comment.
In some iterations I wrote GNU too, then switched to XDG. The thing is that GNU means GNU Hurd in System context.
One may say that GNU Linux is probably similar to GNU Hurd, not less then FreeBSD, but well…
The SYSTEM_GNU_COMPATIBILITY in some other places are leftovers remaining from that first iteration I failed to clean-up properly. I'll fix it.
95c6284 to
813b85c
Compare
Right now this does: And this doesn't do any: So for now I expect it to just be reported as If needed we can make it be reported as One can use the |
4ce1846 to
726fb11
Compare
| PARENT_SCOPE) | ||
| endforeach() | ||
| endif() | ||
| yokai_run_detection("${lang}" "COMPILER" "Compiler${${lang}_EXT}" "GCC;Clang;generic") |
There was a problem hiding this comment.
"generic" string seems to be unused
There was a problem hiding this comment.
It exports compiler's __VERSION__ macro to YOKAI_C_COMPILER_GENERIC_VERSION_STRING.
This is used (named as temporary variable compiler_generic_version_string in yokai_detect_compiler function) to extract the PNaCl version string.
| endif() | ||
|
|
||
| if (NACL AND USE_NACL_SAIGO AND SAIGO_ARCH STREQUAL "arm") | ||
| if (YOKAI_TARGET_SYSTEM_NACL AND USE_NACL_SAIGO AND YOKAI_NACL_ARCH_armhf) |
| if (YOKAI_CXX_COMPILER_ICC) | ||
| set(GCC_GENERIC_ARCH "pentium4") | ||
| elseif (DAEMON_CXX_COMPILER_Zig) | ||
| elseif (YOKAI_CXX_COMPILER_Zig) |
726fb11 to
cf3e784
Compare
|
Will these commits be squashed? There's one outstanding comment about the UNIX_COMPATIBILITY variable having bad semantics. |
cf3e784 to
728e37c
Compare
They are fine as they are right now. Every time a mistake has been found, I applied the fix to the earliest commit, fixing the rebase all the way up, in order for every commit to be correct. The only commit I didn't do that yet was the
The remaining generated |
And that's bad because Mac is a Unix platform but doesn't define those. |
|
This comment: #1641 (comment) |
Are you sure? I don't have an easily accessed mac next to me right now, but if you have one it's easy to check by doing: If macOS doesn't define those then it explicitly refuses to be recognized as an Unix platform and we should respect that… It borrows things from earlier MacOS, some BSD Unix stuff, GNU, NextSTEP and other things. Pre-installing a 20 years old bash (even not used as shell by default) doesn't make something an Unix. =) |
I confirm that none of the Unix defines appear from this command.
https://www.opengroup.org/openbrand/certificates/1205p.pdf Mac OS is universally recognized as a Unix-like system. You have said that the names are intended to be understood without reading anything, so it behooves us not to make one that directly contradicts its usual understanding. |
Some revamp of the
DaemonPlatform/DaemonArchitecture/DaemonCompiler/DaemonBuildInfohelper code for CMake.I want this framework to be reusable for other projects, the first user outside of the engine may be the NaCl loader itself, and I may use it for NetRadiant as well at some point. So I made the code fully autonomous and contained in a single folder (so it can be copied and kept it sync easily).
It happens that the endian stuff we did in the
DaemonCompilercode usingEndian.hwas useless (it was not doing better than what theqprocessordetection.hcode does anyway), so I removed it.I also renamed
GAME_PIEtoNACL_PIEbecause it's an NaCl option, it was namedGAME_PIEbecause we only build games as NaCl, but for a self-contained framework we better name the NaCl optionNACL. For now this code setsGAME_PIEto theNACL_PIEvalue but once the game is modified to useNACL_PIEthe code setting theGAME_PIEalias will be deleted.Edit: That framework now has its own name: Yokai.
Yokai is the name of that reusable generic CMake framework. CMake variables are prefixed with
YOKAI_, C variables and definitions are prefixed withYOKAI_as well, and the folder for generated files is prefixed withYokai.The name is inspired from that third race mod that was named Unvanquished, from which we already inherited the Dæmon name (Dæmon was the third team name along Humans and Aliens, the Yokai model was one of those Dæmons).