mirror of https://github.com/mgba-emu/mgba.git
All: Enable static linking for Windows
This commit is contained in:
parent
a0624b8b4f
commit
1559438deb
1
CHANGES
1
CHANGES
|
@ -42,6 +42,7 @@ Misc:
|
||||||
- All: Fix sanitize-deb script to set file permissions properly if run as (fake)root
|
- All: Fix sanitize-deb script to set file permissions properly if run as (fake)root
|
||||||
- GBA SIO: Add a dummy driver for Normal mode
|
- GBA SIO: Add a dummy driver for Normal mode
|
||||||
- GBA: GBARewind now returns how many states it has rewound
|
- GBA: GBARewind now returns how many states it has rewound
|
||||||
|
- All: Enable static linking for Windows
|
||||||
|
|
||||||
0.2.1: (2015-05-13)
|
0.2.1: (2015-05-13)
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
|
|
@ -102,7 +102,7 @@ else()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_target(version ALL touch ${CMAKE_SOURCE_DIR}/src/util/version.c.in
|
add_custom_target(version-info ALL touch ${CMAKE_SOURCE_DIR}/src/util/version.c.in
|
||||||
COMMAND ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
-DGIT_COMMIT=${GIT_COMMIT}
|
-DGIT_COMMIT=${GIT_COMMIT}
|
||||||
-DGIT_COMMIT_SHORT=${GIT_COMMIT_SHORT}
|
-DGIT_COMMIT_SHORT=${GIT_COMMIT_SHORT}
|
||||||
|
@ -368,15 +368,15 @@ if(BUILD_SHARED)
|
||||||
add_library(${BINARY_NAME}-static STATIC ${SRC})
|
add_library(${BINARY_NAME}-static STATIC ${SRC})
|
||||||
set_target_properties(${BINARY_NAME}-static PROPERTIES COMPILE_DEFINITIONS "${FEATURE_DEFINES}")
|
set_target_properties(${BINARY_NAME}-static PROPERTIES COMPILE_DEFINITIONS "${FEATURE_DEFINES}")
|
||||||
install(TARGETS ${BINARY_NAME}-static DESTINATION lib COMPONENT lib${BINARY_NAME})
|
install(TARGETS ${BINARY_NAME}-static DESTINATION lib COMPONENT lib${BINARY_NAME})
|
||||||
add_dependencies(${BINARY_NAME}-static version)
|
add_dependencies(${BINARY_NAME}-static version-info)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
add_library(${BINARY_NAME} STATIC ${SRC})
|
add_library(${BINARY_NAME} STATIC ${SRC})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_dependencies(${BINARY_NAME} version)
|
add_dependencies(${BINARY_NAME} version-info)
|
||||||
|
|
||||||
target_link_libraries(${BINARY_NAME} m ${DEBUGGER_LIB} ${OS_LIB} ${DEPENDENCY_LIB})
|
target_link_libraries(${BINARY_NAME} m ${DEBUGGER_LIB} ${DEPENDENCY_LIB} ${OS_LIB})
|
||||||
install(TARGETS ${BINARY_NAME} DESTINATION lib COMPONENT lib${BINARY_NAME})
|
install(TARGETS ${BINARY_NAME} DESTINATION lib COMPONENT lib${BINARY_NAME})
|
||||||
set_target_properties(${BINARY_NAME} PROPERTIES VERSION ${LIB_VERSION_STRING} SOVERSION ${LIB_VERSION_ABI} COMPILE_DEFINITIONS "${FEATURE_DEFINES}")
|
set_target_properties(${BINARY_NAME} PROPERTIES VERSION ${LIB_VERSION_STRING} SOVERSION ${LIB_VERSION_ABI} COMPILE_DEFINITIONS "${FEATURE_DEFINES}")
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ if(APPLE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(PLATFORM_SRC)
|
set(PLATFORM_SRC)
|
||||||
|
set(QT_STATIC OFF)
|
||||||
|
|
||||||
if(BUILD_SDL)
|
if(BUILD_SDL)
|
||||||
if(NOT SDL_FOUND AND NOT SDL2_FOUND)
|
if(NOT SDL_FOUND AND NOT SDL2_FOUND)
|
||||||
|
@ -38,6 +39,12 @@ if(NOT Qt5OpenGL_FOUND OR NOT Qt5Widgets_FOUND OR NOT OPENGL_FOUND)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
get_target_property(QT_TYPE Qt5::Core TYPE)
|
||||||
|
if(QT_TYPE STREQUAL STATIC_LIBRARY)
|
||||||
|
set(QT_STATIC ON)
|
||||||
|
add_definitions(-DQT_STATIC)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(SOURCE_FILES
|
set(SOURCE_FILES
|
||||||
AudioProcessor.cpp
|
AudioProcessor.cpp
|
||||||
CheatsModel.cpp
|
CheatsModel.cpp
|
||||||
|
@ -96,6 +103,9 @@ if(Qt5Multimedia_FOUND)
|
||||||
list(APPEND AUDIO_SRC
|
list(APPEND AUDIO_SRC
|
||||||
AudioProcessorQt.cpp
|
AudioProcessorQt.cpp
|
||||||
AudioDevice.cpp)
|
AudioDevice.cpp)
|
||||||
|
if (WIN32 AND QT_STATIC)
|
||||||
|
list(APPEND QT_LIBRARIES qtaudio_windows strmiids winmm)
|
||||||
|
endif()
|
||||||
list(APPEND QT_LIBRARIES Qt5::Multimedia)
|
list(APPEND QT_LIBRARIES Qt5::Multimedia)
|
||||||
add_definitions(-DBUILD_QT_MULTIMEDIA)
|
add_definitions(-DBUILD_QT_MULTIMEDIA)
|
||||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libqt5multimedia5")
|
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libqt5multimedia5")
|
||||||
|
@ -120,6 +130,9 @@ qt5_add_resources(RESOURCES resources.qrc)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/res/mgba.rc.in ${CMAKE_BINARY_DIR}/res/mgba.rc)
|
configure_file(${CMAKE_SOURCE_DIR}/res/mgba.rc.in ${CMAKE_BINARY_DIR}/res/mgba.rc)
|
||||||
list(APPEND RESOURCES ${CMAKE_BINARY_DIR}/res/mgba.rc)
|
list(APPEND RESOURCES ${CMAKE_BINARY_DIR}/res/mgba.rc)
|
||||||
|
if(QT_STATIC)
|
||||||
|
list(APPEND QT_LIBRARIES qwindows imm32)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
add_executable(${BINARY_NAME}-qt WIN32 MACOSX_BUNDLE main.cpp ${CMAKE_SOURCE_DIR}/res/mgba.icns ${SOURCE_FILES} ${PLATFORM_SRC} ${UI_FILES} ${AUDIO_SRC} ${RESOURCES})
|
add_executable(${BINARY_NAME}-qt WIN32 MACOSX_BUNDLE main.cpp ${CMAKE_SOURCE_DIR}/res/mgba.icns ${SOURCE_FILES} ${PLATFORM_SRC} ${UI_FILES} ${AUDIO_SRC} ${RESOURCES})
|
||||||
set_target_properties(${BINARY_NAME}-qt PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/res/info.plist.in COMPILE_DEFINITIONS "${FEATURE_DEFINES}")
|
set_target_properties(${BINARY_NAME}-qt PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/res/info.plist.in COMPILE_DEFINITIONS "${FEATURE_DEFINES}")
|
||||||
|
|
|
@ -6,6 +6,14 @@
|
||||||
#include "GBAApp.h"
|
#include "GBAApp.h"
|
||||||
#include "Window.h"
|
#include "Window.h"
|
||||||
|
|
||||||
|
#ifdef QT_STATIC
|
||||||
|
#include <QtPlugin>
|
||||||
|
#ifdef _WIN32
|
||||||
|
Q_IMPORT_PLUGIN (QWindowsIntegrationPlugin);
|
||||||
|
Q_IMPORT_PLUGIN (QWindowsAudioPlugin);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
QGBA::GBAApp application(argc, argv);
|
QGBA::GBAApp application(argc, argv);
|
||||||
return application.exec();
|
return application.exec();
|
||||||
|
|
|
@ -31,6 +31,10 @@ if(USE_PIXMAN)
|
||||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libpixman-1.0" PARENT_SCOPE)
|
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libpixman-1.0" PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
list(APPEND SDL_LIBRARY imm32 version winmm)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libsdl${SDL_VERSION_DEBIAN}" PARENT_SCOPE)
|
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libsdl${SDL_VERSION_DEBIAN}" PARENT_SCOPE)
|
||||||
|
|
||||||
file(GLOB PLATFORM_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/sdl-*.c)
|
file(GLOB PLATFORM_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/sdl-*.c)
|
||||||
|
|
Loading…
Reference in New Issue