[cmake] more parenthesis cleanups, linker gc module, more same-line stuff

I may have gotten carried away.

- I missed some stuff for end parenthesis because I accidentally
  searched within project files instead of the entire directory (so some
  thunk/test/windows stuff was missed), cleaned those up.
- `INTERFACE`, `PUBLIC`, `PRIVATE`, `RUNTIME`, `LIBRARY` should be on
  the same line as the target name. (I should really invest in making a
  style guide...)
- Some short statements were unnecessarily split across multiple
  lines--cleaned those up
- Made a common `LinkerGC` module that applies gc-sections etc. to a
  target in Release mode
- Usually for functions you want to have something on the first line,
  e.g. `FILES`/`DIRECTORY` for install, or the target/a positional
  argument, etc etc. Not always though, notably for some custom_command
  calls

TODO:
- What's with the `list(APPEND LIBS...)` stuff? It's used really
  inconsistently, sometimes not at all, sometimes it looks like there're
  duplicates? A more thorough cleanup is in order there.

Signed-off-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
crueter committed 2025-12-29 15:44:18 -05:00
1 parent 51f6722277
commit 872aec20b8
42 files changed
+216 -378

No files matched your search

+10 -15
View File
@@ -1,8 +1,7 @@
add_library(FEXHeaderUtils INTERFACE)
# Check for syscall support here
check_cxx_source_compiles(
"
check_cxx_source_compiles("
#include <sched.h>
int main() {
return ::getcpu(nullptr, nullptr);
@@ -11,10 +10,9 @@ check_cxx_source_compiles(
if (HAS_SYSCALL_GETCPU)
message(STATUS "Has getcpu helper")
target_compile_definitions(FEXHeaderUtils INTERFACE HAS_SYSCALL_GETCPU=1)
endif ()
endif()
check_cxx_source_compiles(
"
check_cxx_source_compiles("
#include <unistd.h>
int main() {
return ::gettid();
@@ -23,10 +21,9 @@ check_cxx_source_compiles(
if (HAS_SYSCALL_GETTID)
message(STATUS "Has gettid helper")
target_compile_definitions(FEXHeaderUtils INTERFACE HAS_SYSCALL_GETTID=1)
endif ()
endif()
check_cxx_source_compiles(
"
check_cxx_source_compiles("
#include <signal.h>
int main() {
return ::tgkill(0, 0, 0);
@@ -35,10 +32,9 @@ check_cxx_source_compiles(
if (HAS_SYSCALL_TGKILL)
message(STATUS "Has tgkill helper")
target_compile_definitions(FEXHeaderUtils INTERFACE HAS_SYSCALL_TGKILL=1)
endif ()
endif()
check_cxx_source_compiles(
"
check_cxx_source_compiles("
#include <sys/stat.h>
int main() {
return ::statx(0, nullptr, 0, 0, nullptr);
@@ -47,10 +43,9 @@ check_cxx_source_compiles(
if (HAS_SYSCALL_STATX)
message(STATUS "Has statx helper")
target_compile_definitions(FEXHeaderUtils INTERFACE HAS_SYSCALL_STATX=1)
endif ()
endif()
check_cxx_source_compiles(
"
check_cxx_source_compiles("
#include <stdio.h>
int main() {
return ::renameat2(0, nullptr, 0, nullptr, 0);
@@ -59,6 +54,6 @@ check_cxx_source_compiles(
if (HAS_SYSCALL_RENAMEAT2)
message(STATUS "Has renameat2 helper")
target_compile_definitions(FEXHeaderUtils INTERFACE HAS_SYSCALL_RENAMEAT2=1)
endif ()
endif()
target_include_directories(FEXHeaderUtils INTERFACE .)