src/platform/sdl/CMakeLists.txt (view raw)
1find_package(SDL 1.2 REQUIRED)
2file(GLOB PLATFORM_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/sdl-*.c)
3set(PLATFORM_LIBRARY "${SDL_LIBRARY};${SDLMAIN_LIBRARY}")
4include_directories(${CMAKE_SOURCE_DIR}/src/platform/sdl)
5
6if(BUILD_RASPI AND BUILD_EGL)
7 set(MAIN_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/egl-main.c)
8 set(OPENGL_LIBRARY "-lEGL -lGLESv2 -lbcm_host")
9 set(OPENGL_INCLUDE_DIR "")
10 add_definitions(-DBUILD_RASPI)
11elseif(BUILD_BBB OR BUILD_RASPI)
12 enable_language(ASM)
13 add_definitions(-DCOLOR_16_BIT -DCOLOR_5_6_5)
14 set(MAIN_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/sw-main.c)
15else()
16 set(MAIN_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/gl-main.c)
17 find_package(OpenGL REQUIRED)
18 include_directories(${SDL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
19endif()
20
21add_executable(${BINARY_NAME}-sdl WIN32 ${PLATFORM_SRC} ${MAIN_SRC})
22target_link_libraries(${BINARY_NAME}-sdl ${BINARY_NAME} ${PLATFORM_LIBRARY} ${OPENGL_LIBRARY})
23set_target_properties(${BINARY_NAME}-sdl PROPERTIES OUTPUT_NAME ${BINARY_NAME})