Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: Automatically detect raspberrypi 4 #12159

Merged
merged 1 commit into from
Jul 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions cmake/Toolchains/raspberry.armv7.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
if(NOT EXISTS "/opt/vc/include/bcm_host.h")
file(READ "/sys/firmware/devicetree/base/compatible" PPSSPP_PI_MODEL)

if(PPSSPP_PI_MODEL MATCHES "raspberrypi,4")
set(PPSSPP_PI_MODEL4 ON)
endif()

if(NOT PPSSPP_PI_MODEL4 AND NOT EXISTS "/opt/vc/include/bcm_host.h")
message(FATAL_ERROR "RaspberryPI platform not recognized")
endif()

Expand All @@ -8,21 +14,29 @@ include_directories(SYSTEM
/opt/vc/include/interface/vmcx_host/linux
)

add_definitions(
-DPPSSPP_PLATFORM_RPI=1
-U__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
)
if(NOT PPSSPP_PI_MODEL4)
add_definitions(
-DPPSSPP_PLATFORM_RPI=1
-U__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
)
endif()

set(ARCH_FLAGS "-mcpu=cortex-a7 -mfpu=neon -mfloat-abi=hard")
if(PPSSPP_PI_MODEL4)
set(ARCH_FLAGS "-march=armv7-a -mcpu=cortex-a72 -mtune=cortex-a72 -mfpu=neon-vfpv4 -mfloat-abi=hard")
else()
set(ARCH_FLAGS "-mcpu=cortex-a7 -mfpu=neon -mfloat-abi=hard")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARCH_FLAGS}" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_FLAGS}" CACHE STRING "" FORCE)
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ${ARCH_FLAGS}" CACHE STRING "" FORCE)

set(CMAKE_EXE_LINKER_FLAGS "-L/opt/vc/lib" CACHE STRING "" FORCE)

set(OPENGL_LIBRARIES brcmGLESv2 bcm_host)
set(EGL_LIBRARIES brcmEGL)
if(NOT PPSSPP_PI_MODEL4)
set(OPENGL_LIBRARIES brcmGLESv2 bcm_host)
set(EGL_LIBRARIES brcmEGL)
set(USING_FBDEV ON)
endif()
set(USING_GLES2 ON)
set(USING_FBDEV ON)
set(ARMV7 ON)
set(USE_WAYLAND_WSI OFF)