all repos — mgba @ 2f39a575672e95c5e073518fa0b91e8ac60cbd11

mGBA Game Boy Advance Emulator

src/platform/sdl/CMakeLists.txt (view raw)

 1set(SDL_VERSION "2" CACHE STRING "Version of SDL to use (1.2 or 2)")
 2
 3if (SDL_VERSION EQUAL "2")
 4	include(FindPkgConfig)
 5	pkg_search_module(SDL2 sdl2)
 6	if (SDL2_FOUND)
 7		set(SDL_INCLUDE_DIR ${SDL2_INCLUDE_DIRS})
 8		set(SDL_LIBRARY ${SDL2_LIBRARIES})
 9		set(SDLMAIN_LIBRARY "")
10	endif()
11endif()
12
13if(SDL_VERSION EQUAL "1.2" OR NOT SDL2_FOUND)
14	find_package(SDL 1.2 REQUIRED)
15endif()
16
17file(GLOB PLATFORM_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/sdl-*.c)
18set(PLATFORM_LIBRARY "${SDL_LIBRARY};${SDLMAIN_LIBRARY}")
19include_directories(${CMAKE_SOURCE_DIR}/src/platform/sdl)
20
21if(BUILD_RASPI)
22	add_definitions(-DBUILD_RASPI)
23	set(EGL_MAIN_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/egl-main.c)
24	set(EGL_LIBRARY "-lEGL -lGLESv2 -lbcm_host")
25	add_executable(${BINARY_NAME}-rpi ${PLATFORM_SRC} ${EGL_MAIN_SRC})
26	target_link_libraries(${BINARY_NAME}-rpi ${BINARY_NAME} ${PLATFORM_LIBRARY} ${EGL_LIBRARY})
27endif()
28
29if(BUILD_BBB OR BUILD_RASPI)
30	enable_language(ASM)
31	add_definitions(-DCOLOR_16_BIT -DCOLOR_5_6_5)
32	set(MAIN_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/sw-main.c)
33else()
34	set(MAIN_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/gl-main.c)
35	find_package(OpenGL REQUIRED)
36	include_directories(${SDL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
37endif()
38
39add_executable(${BINARY_NAME}-sdl WIN32 ${PLATFORM_SRC} ${MAIN_SRC})
40target_link_libraries(${BINARY_NAME}-sdl ${BINARY_NAME} ${PLATFORM_LIBRARY} ${OPENGL_LIBRARY})
41set_target_properties(${BINARY_NAME}-sdl PROPERTIES OUTPUT_NAME ${BINARY_NAME})