mirror of https://github.com/mgba-emu/mgba.git
CMake: SDL cleanup
This commit is contained in:
parent
2f33926f64
commit
ff2fe501b8
|
@ -878,10 +878,6 @@ endif()
|
||||||
|
|
||||||
if(BUILD_SDL)
|
if(BUILD_SDL)
|
||||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/platform/sdl ${CMAKE_CURRENT_BINARY_DIR}/sdl)
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/platform/sdl ${CMAKE_CURRENT_BINARY_DIR}/sdl)
|
||||||
# The SDL platform CMakeLists could decide to disable SDL, so check again before adding the define.
|
|
||||||
if(BUILD_SDL)
|
|
||||||
add_definitions(-DBUILD_SDL)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(BUILD_QT)
|
if(BUILD_QT)
|
||||||
|
@ -936,7 +932,7 @@ if(BUILD_EXAMPLE)
|
||||||
target_link_libraries(${BINARY_NAME}-example-server ${BINARY_NAME})
|
target_link_libraries(${BINARY_NAME}-example-server ${BINARY_NAME})
|
||||||
set_target_properties(${BINARY_NAME}-example-server PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}")
|
set_target_properties(${BINARY_NAME}-example-server PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}")
|
||||||
|
|
||||||
if(BUILD_SDL)
|
if(FOUND_SDL)
|
||||||
add_executable(${BINARY_NAME}-example-client ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/example/client-server/client.c)
|
add_executable(${BINARY_NAME}-example-client ${CMAKE_CURRENT_SOURCE_DIR}/src/platform/example/client-server/client.c)
|
||||||
target_link_libraries(${BINARY_NAME}-example-client ${BINARY_NAME} ${SDL_LIBRARY} ${SDLMAIN_LIBRARY} ${OPENGL_LIBRARY} ${OPENGLES2_LIBRARY})
|
target_link_libraries(${BINARY_NAME}-example-client ${BINARY_NAME} ${SDL_LIBRARY} ${SDLMAIN_LIBRARY} ${OPENGL_LIBRARY} ${OPENGLES2_LIBRARY})
|
||||||
set_target_properties(${BINARY_NAME}-example-client PROPERTIES
|
set_target_properties(${BINARY_NAME}-example-client PROPERTIES
|
||||||
|
@ -1040,7 +1036,7 @@ if(BUILD_QT)
|
||||||
cpack_add_component(${BINARY_NAME}-qt GROUP qt DEPENDS base)
|
cpack_add_component(${BINARY_NAME}-qt GROUP qt DEPENDS base)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(BUILD_SDL)
|
if(FOUND_SDL)
|
||||||
cpack_add_component_group(sdl PARENT_GROUP base)
|
cpack_add_component_group(sdl PARENT_GROUP base)
|
||||||
cpack_add_component(${BINARY_NAME}-sdl GROUP sdl DEPENDS base)
|
cpack_add_component(${BINARY_NAME}-sdl GROUP sdl DEPENDS base)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -6,9 +6,7 @@ set(PLATFORM_SRC)
|
||||||
set(QT_STATIC OFF)
|
set(QT_STATIC OFF)
|
||||||
|
|
||||||
if(BUILD_SDL)
|
if(BUILD_SDL)
|
||||||
if(NOT SDL_FOUND AND NOT SDL2_FOUND)
|
add_definitions(-DBUILD_SDL)
|
||||||
find_package(SDL 1.2 REQUIRED)
|
|
||||||
endif()
|
|
||||||
if(SDL2_FOUND)
|
if(SDL2_FOUND)
|
||||||
link_directories(${SDL2_LIBDIR})
|
link_directories(${SDL2_LIBDIR})
|
||||||
endif()
|
endif()
|
||||||
|
@ -32,9 +30,9 @@ if(NOT BUILD_GL AND NOT BUILD_GLES2)
|
||||||
message(WARNING "OpenGL is recommended to build the Qt port")
|
message(WARNING "OpenGL is recommended to build the Qt port")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(FOUND_QT ${Qt5Widgets_FOUND} PARENT_SCOPE)
|
||||||
if(NOT Qt5Widgets_FOUND)
|
if(NOT Qt5Widgets_FOUND)
|
||||||
message(WARNING "Cannot find Qt modules")
|
message(WARNING "Cannot find Qt modules")
|
||||||
set(BUILD_QT OFF PARENT_SCOPE)
|
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,10 @@ Q_IMPORT_PLUGIN(AVFServicePlugin);
|
||||||
using namespace QGBA;
|
using namespace QGBA;
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
#if defined(BUILD_SDL) && SDL_VERSION_ATLEAST(2, 0, 0)
|
#ifdef BUILD_SDL
|
||||||
|
#if SDL_VERSION_ATLEAST(2, 0, 0) // CPP does not shortcut function lookup
|
||||||
SDL_SetMainReady();
|
SDL_SetMainReady();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ConfigController configController;
|
ConfigController configController;
|
||||||
|
|
|
@ -13,13 +13,15 @@ endif()
|
||||||
|
|
||||||
if(SDL_VERSION EQUAL "1.2" OR NOT SDL2_FOUND)
|
if(SDL_VERSION EQUAL "1.2" OR NOT SDL2_FOUND)
|
||||||
find_package(SDL 1.2)
|
find_package(SDL 1.2)
|
||||||
|
if(SDL_FOUND)
|
||||||
set(SDL_VERSION "1.2" PARENT_SCOPE)
|
set(SDL_VERSION "1.2" PARENT_SCOPE)
|
||||||
set(SDL_VERSION_DEBIAN "1.2debian")
|
set(SDL_VERSION_DEBIAN "1.2debian")
|
||||||
set(USE_PIXMAN ON)
|
set(USE_PIXMAN ON)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT SDL2_FOUND AND NOT SDL_FOUND)
|
if (NOT SDL2_FOUND AND NOT SDL_FOUND)
|
||||||
set(BUILD_SDL OFF PARENT_SCOPE)
|
set(SDL_FOUND OFF PARENT_SCOPE)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue