很多修改

This commit is contained in:
HP
2026-07-08 15:55:13 +08:00
parent d95ccc0c99
commit 1a194da7ec
32 changed files with 109868 additions and 26 deletions
+39 -2
View File
@@ -115,14 +115,50 @@ else()
endif()
if(UNIX AND NOT APPLE)
find_package(ALSA QUIET)
set(IMX6U_ALSA_INCLUDE_AFTER "")
if(TARGET_IMX)
set(IMX6U_BUNDLED_ALSA_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/third_party/arm-linux-gnueabihf/alsa")
set(IMX6U_BUNDLED_ALSA_INCLUDE_DIR "${IMX6U_BUNDLED_ALSA_ROOT}/include")
set(IMX6U_BUNDLED_ALSA_LIBRARY "${IMX6U_BUNDLED_ALSA_ROOT}/lib/libasound.so")
if(EXISTS "${IMX6U_BUNDLED_ALSA_LIBRARY}")
set(ALSA_FOUND TRUE)
set(ALSA_LIBRARIES "${IMX6U_BUNDLED_ALSA_LIBRARY}")
if(EXISTS "${IMX6U_BUNDLED_ALSA_INCLUDE_DIR}/alsa/asoundlib.h")
set(ALSA_INCLUDE_DIRS "${IMX6U_BUNDLED_ALSA_INCLUDE_DIR}")
elseif(EXISTS "/usr/include/alsa/asoundlib.h")
set(IMX6U_ALSA_INCLUDE_AFTER "/usr/include")
else()
message(FATAL_ERROR "TARGET_IMX requires ALSA headers. Install libasound2-dev:armhf or copy ALSA headers to third_party/arm-linux-gnueabihf/alsa/include.")
endif()
message(STATUS "Using bundled ARM ALSA library: ${IMX6U_BUNDLED_ALSA_LIBRARY}")
else()
find_package(ALSA QUIET)
if(NOT ALSA_FOUND)
message(FATAL_ERROR "TARGET_IMX requires ALSA. Copy board libasound.so* to third_party/arm-linux-gnueabihf/alsa/lib or provide a compatible ALSA package.")
endif()
endif()
else()
find_package(ALSA QUIET)
endif()
if(ALSA_FOUND)
target_compile_definitions(imx6u_core PUBLIC PLATFORM_HAS_ALSA)
target_include_directories(imx6u_core PUBLIC ${ALSA_INCLUDE_DIRS})
if(IMX6U_ALSA_INCLUDE_AFTER)
target_compile_options(imx6u_core PUBLIC -idirafter ${IMX6U_ALSA_INCLUDE_AFTER})
elseif(ALSA_INCLUDE_DIRS)
target_include_directories(imx6u_core PUBLIC ${ALSA_INCLUDE_DIRS})
elseif(ALSA_INCLUDE_DIR)
target_include_directories(imx6u_core PUBLIC ${ALSA_INCLUDE_DIR})
endif()
target_link_libraries(imx6u_core PUBLIC ${ALSA_LIBRARIES})
if(TARGET_IMX)
target_link_libraries(imx6u_core PUBLIC dl pthread rt m)
endif()
else()
message(STATUS "ALSA was not found; AlsaAudioInput and AlsaAudioOutput will be unavailable backends")
endif()
elseif(TARGET_IMX)
message(FATAL_ERROR "TARGET_IMX requires ALSA headers and libasound.")
endif()
if(MSVC)
@@ -160,6 +196,7 @@ function(imx6u_configure_app_target target_name)
endfunction()
add_subdirectory(src/Apps/Game)
add_subdirectory(src/Apps/Desktop)
add_subdirectory(src/Apps/Demo)
add_subdirectory(src/Apps/LightGame)