all repos — mgba @ ad38ae63ec3615da4a9e485affe38b7371bf47ea

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 AND BUILD_EGL)
22	set(MAIN_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/egl-main.c)
23	set(OPENGL_LIBRARY "-lEGL -lGLESv2 -lbcm_host")
24	set(OPENGL_INCLUDE_DIR "")
25	add_definitions(-DBUILD_RASPI)
26elseif(BUILD_BBB OR BUILD_RASPI)
27	set(MAIN_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/sw-main.c)
28else()
29	set(MAIN_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/gl-main.c)
30	find_package(OpenGL REQUIRED)
31	include_directories(${SDL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
32endif()
33
34add_executable(${BINARY_NAME}-sdl WIN32 ${PLATFORM_SRC} ${MAIN_SRC})
35target_link_libraries(${BINARY_NAME}-sdl ${BINARY_NAME} ${PLATFORM_LIBRARY} ${OPENGL_LIBRARY})
36set_target_properties(${BINARY_NAME}-sdl PROPERTIES OUTPUT_NAME ${BINARY_NAME})