src/platform/qt/CMakeLists.txt (view raw)
1cmake_minimum_required(VERSION 2.8.8)
2project(mGBA-Qt)
3
4set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -Wall -Wextra --std=c++11")
5set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -Wall -Wextra --std=c++11")
6
7if(BUILD_SDL)
8 find_package(SDL 1.2 REQUIRED)
9 set(PLATFORM_LIBRARY "${PLATFORM_LIBRARY};${SDL_LIBRARY};${SDLMAIN_LIBRARY}")
10 set(PLATFORM_SRC ${PLATFORM_SRC} ${CMAKE_SOURCE_DIR}/src/platform/sdl/sdl-events.c)
11 include_directories(${SDL_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/src/platform/sdl)
12endif()
13
14set(CMAKE_AUTOMOC ON)
15set(CMAKE_INCLUDE_CURRENT_DIR ON)
16
17find_package(Qt5Widgets)
18find_package(OpenGL)
19
20if(NOT Qt5Widgets_FOUND OR NOT OPENGL_FOUND)
21 set(BUILD_QT OFF PARENT_SCOPE)
22 return()
23endif()
24
25set(SOURCE_FILES
26 AudioDevice.cpp
27 AudioProcessor.cpp
28 Display.cpp
29 GameController.cpp
30 LoadSaveState.cpp
31 LogView.cpp
32 SavestateButton.cpp
33 Window.cpp
34 VFileDevice.cpp)
35
36qt5_wrap_ui(UI_FILES
37 LoadSaveState.ui
38 LogView.ui)
39
40if(USE_GDB_STUB)
41 set(SOURCE_FILES ${PLATFORM_SRC} ${SOURCE_FILES} GDBController.cpp GDBWindow.cpp)
42endif()
43set(MACOSX_BUNDLE_ICON_FILE mgba.icns)
44set(MACOSX_BUNDLE_BUNDLE_VERSION ${LIB_VERSION_STRING})
45set_source_files_properties(${CMAKE_SOURCE_DIR}/res/mgba.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
46
47qt5_add_resources(RESOURCES resources.qrc)
48message(STATUS ${RESOURCES})
49add_executable(mGBA WIN32 MACOSX_BUNDLE main.cpp ${CMAKE_SOURCE_DIR}/res/mgba.icns ${SOURCE_FILES} ${UI_FILES} ${RESOURCES})
50
51qt5_use_modules(mGBA Widgets Multimedia OpenGL)
52target_link_libraries(mGBA ${PLATFORM_LIBRARY} ${OPENGL_LIBRARY} ${BINARY_NAME} Qt5::Widgets)