mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 03:45:50 +08:00
build(sim): fix macOS XQuartz include and library paths for sim:fb
macOS does not ship X11 headers and libraries in the default system search paths, so sim:fb fails to build unless the XQuartz installation prefix is detected explicitly. Probe /opt/X11 first and fall back to /usr/X11 so the simulator can find the required X11 headers and libs on common macOS setups. This fixes the sim:fb build failure on macOS hosts that rely on XQuartz for X11 development files. Signed-off-by: Peter Bee <bijunda@bytedance.com>
This commit is contained in:
@@ -190,7 +190,13 @@ endif
|
|||||||
ifeq ($(CONFIG_SIM_X11FB),y)
|
ifeq ($(CONFIG_SIM_X11FB),y)
|
||||||
HOSTSRCS += sim_x11framebuffer.c
|
HOSTSRCS += sim_x11framebuffer.c
|
||||||
ifeq ($(CONFIG_HOST_MACOS),y)
|
ifeq ($(CONFIG_HOST_MACOS),y)
|
||||||
STDLIBS += -L/opt/X11/lib
|
ifneq ($(wildcard /opt/X11/include/X11/Xlib.h),)
|
||||||
|
HOSTCFLAGS += -I/opt/X11/include
|
||||||
|
STDLIBS += -L/opt/X11/lib
|
||||||
|
else ifneq ($(wildcard /usr/X11/include/X11/Xlib.h),)
|
||||||
|
HOSTCFLAGS += -I/usr/X11/include
|
||||||
|
STDLIBS += -L/usr/X11/lib
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
STDLIBS += -lX11 -lXext
|
STDLIBS += -lX11 -lXext
|
||||||
ifeq ($(CONFIG_SIM_TOUCHSCREEN),y)
|
ifeq ($(CONFIG_SIM_TOUCHSCREEN),y)
|
||||||
|
|||||||
@@ -190,10 +190,20 @@ endif()
|
|||||||
if(CONFIG_SIM_X11FB)
|
if(CONFIG_SIM_X11FB)
|
||||||
list(APPEND HOSTSRCS sim_x11framebuffer.c)
|
list(APPEND HOSTSRCS sim_x11framebuffer.c)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
find_package(X11 REQUIRED)
|
find_package(X11)
|
||||||
|
|
||||||
if(X11_FOUND)
|
if(X11_FOUND)
|
||||||
target_include_directories(nuttx PRIVATE ${X11_INCLUDE_DIR})
|
target_include_directories(nuttx PRIVATE ${X11_INCLUDE_DIR})
|
||||||
target_link_libraries(nuttx PRIVATE ${X11_LIBRARIES})
|
target_link_libraries(nuttx PRIVATE ${X11_LIBRARIES})
|
||||||
|
else()
|
||||||
|
foreach(x11_prefix /opt/X11 /usr/X11)
|
||||||
|
if(EXISTS ${x11_prefix}/include/X11/Xlib.h)
|
||||||
|
target_include_directories(nuttx PRIVATE ${x11_prefix}/include)
|
||||||
|
target_link_directories(nuttx PRIVATE ${x11_prefix}/lib)
|
||||||
|
target_link_libraries(nuttx PRIVATE X11 Xext)
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
list(APPEND STDLIBS X11 Xext)
|
list(APPEND STDLIBS X11 Xext)
|
||||||
|
|||||||
Reference in New Issue
Block a user