forked from Ports/goldeneye-pc-port
linux-build: port/shim/sched.h routes C++ TUs to the host <sched.h>
The decomp's src/sched.h (N64 OSSc* scheduler) is on the include path and shadows the system header. libstdc++'s <thread>/<mutex> gthr headers in the fast3d C++ TUs #include <sched.h> and need the real one (cpu_set_t, sched_yield) -- with -std=gnu++20 libstdc++ defines _GNU_SOURCE so <pthread.h> also references cpu_set_t. New shim: C++ -> generated hostsched.h (absolute path, hoststring pattern); C -> #include_next so src/sched.h still wins as before. Windows build verified green (240/241).
This commit is contained in:
1 parent
8eb2efa6ca
commit
fe7a34c56e
3 files changed
+36
No files matched your search
@@ -152,6 +152,15 @@ configure_file(
|
||||
"${CMAKE_SOURCE_DIR}/port/include/hoststring.h.in"
|
||||
"${CMAKE_BINARY_DIR}/port/include/hoststring.h" @ONLY)
|
||||
|
||||
# Host <sched.h> path for port/shim/sched.h. The decomp's src/sched.h is on
|
||||
# the include path and shadows the system header; libstdc++'s <thread>/gthr
|
||||
# headers in the fast3d C++ TUs need the real <sched.h> (cpu_set_t,
|
||||
# sched_yield). Both MinGW and Linux keep <sched.h> at bin/../include.
|
||||
get_filename_component(PORT_HOST_SCHED_H "${_PORT_GCC_DIR}/../include/sched.h" ABSOLUTE)
|
||||
configure_file(
|
||||
"${CMAKE_SOURCE_DIR}/port/include/hostsched.h.in"
|
||||
"${CMAKE_BINARY_DIR}/port/include/hostsched.h" @ONLY)
|
||||
|
||||
# Host <stdlib.h> path for port/shim/stdlib.h. The N64 include/stdlib.h
|
||||
# typedefs lldiv_t/ldiv_t, which conflict with the host's when both land in
|
||||
# one C++ TU (fast3d): MinGW's own sec_api/stdlib_s.h does `#include
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef PORT_HOSTSCHED_H
|
||||
#define PORT_HOSTSCHED_H
|
||||
/* Generated by CMake from hostsched.h.in — do not edit.
|
||||
* Includes the HOST <sched.h> by absolute path so that port/shim/sched.h can
|
||||
* give C++ TUs (fast3d, libstdc++'s <thread>/gthr headers) the real
|
||||
* <sched.h> — cpu_set_t, sched_yield — instead of the decomp's src/sched.h,
|
||||
* which sits on the include path and would otherwise shadow it. */
|
||||
#include "@PORT_HOST_SCHED_H@"
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* PC port shim for <sched.h>.
|
||||
*
|
||||
* The decomp ships src/sched.h (the N64 OSSc* scheduler client interface),
|
||||
* which is on the compiler include path. libstdc++'s <thread> / gthr headers
|
||||
* (pulled into the fast3d C++ TUs) do `#include <sched.h>` and need the HOST
|
||||
* header — cpu_set_t, sched_yield — so C++ TUs must be routed to the real
|
||||
* <sched.h> by absolute path (generated hostsched.h, same trick as
|
||||
* port/shim/string.h). C TUs keep resolving <sched.h> to the decomp's own
|
||||
* src/sched.h, exactly as on the console.
|
||||
*
|
||||
* Inert in the N64 build (port/shim is not on its include path).
|
||||
*/
|
||||
#if defined(__cplusplus)
|
||||
#include "hostsched.h"
|
||||
#else
|
||||
#include_next <sched.h>
|
||||
#endif
|
||||
Reference in new issue
Block a user