src/platform/qt/CMakeLists.txt (view raw)
1cmake_minimum_required(VERSION 2.8.8)
2project(mGBA-Qt)
3
4set(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -Wextra --std=c++11")
5set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -Wextra --std=c++11")
6
7if(APPLE)
8 set(CMAKE_PREFIX_PATH "/usr/local/opt/qt5") # Temporary stopgap measure
9endif()
10
11if(BUILD_SDL)
12 find_package(SDL 1.2 REQUIRED)
13 set(PLATFORM_LIBRARY "${PLATFORM_LIBRARY};${SDL_LIBRARY};${SDLMAIN_LIBRARY}")
14 set(PLATFORM_SRC ${PLATFORM_SRC} ${CMAKE_SOURCE_DIR}/src/platform/sdl/sdl-events.c)
15 include_directories(${SDL_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/src/platform/sdl)
16endif()
17
18set(CMAKE_AUTOMOC ON)
19set(CMAKE_INCLUDE_CURRENT_DIR ON)
20
21set(REQUIRES "Qt5Widgets")
22
23if(APPLE)
24 find_package(OpenGL REQUIRED)
25else()
26 list(APPEND REQUIRES "OpenGL")
27endif()
28
29find_feature(BUILD_QT ${REQUIRES})
30
31if(NOT BUILD_QT)
32 set(BUILD_QT OFF PARENT_SCOPE)
33 return()
34endif()
35
36set(SOURCE_FILES AudioDevice.cpp AudioProcessor.cpp Display.cpp GameController.cpp Window.cpp)
37
38if(USE_GDB_STUB)
39 set(SOURCE_FILES ${PLATFORM_SRC} ${SOURCE_FILES} GDBController.cpp GDBWindow.cpp)
40endif()
41set(MACOSX_BUNDLE_ICON_FILE mgba.icns)
42set(MACOSX_BUNDLE_BUNDLE_VERSION ${LIB_VERSION_STRING})
43set_source_files_properties(${CMAKE_SOURCE_DIR}/res/mgba.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
44
45add_executable(mGBA WIN32 MACOSX_BUNDLE main.cpp ${CMAKE_SOURCE_DIR}/res/mgba.icns ${SOURCE_FILES})
46
47qt5_use_modules(mGBA Widgets Multimedia OpenGL)
48target_link_libraries(mGBA ${PLATFORM_LIBRARY} ${OPENGL_LIBRARY} ${BINARY_NAME})