2022-09-14 21:58:23 +00:00
|
|
|
add_library(FEXHeaderUtils INTERFACE)
|
|
|
|
|
2021-12-24 23:43:25 +00:00
|
|
|
# Check for syscall support here
|
|
|
|
check_cxx_source_compiles(
|
2022-09-14 21:58:23 +00:00
|
|
|
"
|
|
|
|
#include <sched.h>
|
|
|
|
int main() {
|
|
|
|
return ::getcpu(nullptr, nullptr);
|
|
|
|
}"
|
2023-09-19 00:05:40 +00:00
|
|
|
HAS_SYSCALL_GETCPU)
|
|
|
|
if (HAS_SYSCALL_GETCPU)
|
2021-12-24 23:43:25 +00:00
|
|
|
message(STATUS "Has getcpu helper")
|
2022-09-14 21:58:23 +00:00
|
|
|
target_compile_definitions(FEXHeaderUtils INTERFACE HAS_SYSCALL_GETCPU=1)
|
2021-12-24 23:43:25 +00:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
check_cxx_source_compiles(
|
2022-09-14 21:58:23 +00:00
|
|
|
"
|
|
|
|
#include <unistd.h>
|
|
|
|
int main() {
|
|
|
|
return ::gettid();
|
|
|
|
}"
|
2023-09-19 00:05:40 +00:00
|
|
|
HAS_SYSCALL_GETTID)
|
|
|
|
if (HAS_SYSCALL_GETTID)
|
2021-12-24 23:43:25 +00:00
|
|
|
message(STATUS "Has gettid helper")
|
2022-09-14 21:58:23 +00:00
|
|
|
target_compile_definitions(FEXHeaderUtils INTERFACE HAS_SYSCALL_GETTID=1)
|
2021-12-24 23:43:25 +00:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
check_cxx_source_compiles(
|
2022-09-14 21:58:23 +00:00
|
|
|
"
|
|
|
|
#include <signal.h>
|
|
|
|
int main() {
|
|
|
|
return ::tgkill(0, 0, 0);
|
|
|
|
}"
|
2023-09-19 00:05:40 +00:00
|
|
|
HAS_SYSCALL_TGKILL)
|
|
|
|
if (HAS_SYSCALL_TGKILL)
|
2021-12-24 23:43:25 +00:00
|
|
|
message(STATUS "Has tgkill helper")
|
2022-09-14 21:58:23 +00:00
|
|
|
target_compile_definitions(FEXHeaderUtils INTERFACE HAS_SYSCALL_TGKILL=1)
|
2021-12-24 23:43:25 +00:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
check_cxx_source_compiles(
|
2022-09-14 21:58:23 +00:00
|
|
|
"
|
|
|
|
#include <sys/stat.h>
|
|
|
|
int main() {
|
|
|
|
return ::statx(0, nullptr, 0, 0, nullptr);
|
|
|
|
}"
|
2023-09-19 00:05:40 +00:00
|
|
|
HAS_SYSCALL_STATX)
|
|
|
|
if (HAS_SYSCALL_STATX)
|
2021-12-24 23:43:25 +00:00
|
|
|
message(STATUS "Has statx helper")
|
2022-09-14 21:58:23 +00:00
|
|
|
target_compile_definitions(FEXHeaderUtils INTERFACE HAS_SYSCALL_STATX=1)
|
2021-12-24 23:43:25 +00:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
check_cxx_source_compiles(
|
2022-09-14 21:58:23 +00:00
|
|
|
"
|
|
|
|
#include <stdio.h>
|
|
|
|
int main() {
|
|
|
|
return ::renameat2(0, nullptr, 0, nullptr, 0);
|
|
|
|
}"
|
2023-09-19 00:05:40 +00:00
|
|
|
HAS_SYSCALL_RENAMEAT2)
|
|
|
|
if (HAS_SYSCALL_RENAMEAT2)
|
2021-12-24 23:43:25 +00:00
|
|
|
message(STATUS "Has renameat2 helper")
|
2022-09-14 21:58:23 +00:00
|
|
|
target_compile_definitions(FEXHeaderUtils INTERFACE HAS_SYSCALL_RENAMEAT2=1)
|
2022-07-15 05:44:07 +00:00
|
|
|
endif ()
|
|
|
|
|
2022-09-14 21:58:23 +00:00
|
|
|
target_include_directories(FEXHeaderUtils INTERFACE .)
|