Merge branch 'master' of ssh://github.com/86Box/86Box into cleanup30
This commit is contained in:
@@ -32,26 +32,26 @@ include(CPack)
|
||||
include(CMakeDependentOption)
|
||||
|
||||
# Basic build options
|
||||
if(WIN32)
|
||||
if(VCPKG_TOOLCHAIN)
|
||||
# For vcpkg builds we have to respect the linking method used by the
|
||||
# specified triplet.
|
||||
set(NO_STATIC_OPTION ON)
|
||||
if(VCPKG_TARGET_TRIPLET MATCHES "-windows-static$")
|
||||
# `-static` triplet, use static linking
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
set(STATIC_BUILD ON)
|
||||
elseif(VCPKG_TARGET_TRIPLET MATCHES "-windows-static-md$")
|
||||
# `-static-md` triplet, use static linking with dynamic CRT
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
|
||||
set(STATIC_BUILD ON)
|
||||
elseif()
|
||||
# Regular triplet, use dynamic linking
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
|
||||
set(STATIC_BUILD OFF)
|
||||
endif()
|
||||
if(VCPKG_TOOLCHAIN)
|
||||
# For vcpkg builds we have to respect the linking method used by the
|
||||
# specified triplet.
|
||||
set(NO_STATIC_OPTION ON)
|
||||
if(VCPKG_TARGET_TRIPLET MATCHES "-static$")
|
||||
# `-static` triplet, use static linking
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
set(STATIC_BUILD ON)
|
||||
elseif(VCPKG_TARGET_TRIPLET MATCHES "-static-md$")
|
||||
# `-static-md` triplet, use static linking with dynamic CRT
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
|
||||
set(STATIC_BUILD ON)
|
||||
elseif()
|
||||
# Regular triplet, use dynamic linking
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
|
||||
set(STATIC_BUILD OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
# Prefer static builds on Windows
|
||||
set(PREFER_STATIC ON)
|
||||
|
||||
@@ -98,6 +98,7 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
|
||||
|
||||
# Optional features
|
||||
#
|
||||
|
@@ -89,8 +89,12 @@ endif()
|
||||
|
||||
if(OPENAL)
|
||||
find_package(OpenAL REQUIRED)
|
||||
include_directories(${OPENAL_INCLUDE_DIR})
|
||||
target_link_libraries(86Box ${OPENAL_LIBRARY})
|
||||
if(TARGET OpenAL::OpenAL)
|
||||
target_link_libraries(86Box OpenAL::OpenAL)
|
||||
else()
|
||||
include_directories(${OPENAL_INCLUDE_DIR})
|
||||
target_link_libraries(86Box ${OPENAL_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(SDL2 REQUIRED)
|
||||
@@ -155,84 +159,23 @@ else()
|
||||
install(TARGETS 86Box)
|
||||
endif()
|
||||
|
||||
# loads a macro to install Qt5 plugins on macOS
|
||||
# based on https://stackoverflow.com/questions/35612687/cmake-macos-x-bundle-with-bundleutiliies-for-qt-application
|
||||
macro(install_qt5_plugin _qt_plugin_name _qt_plugins_var _prefix)
|
||||
get_target_property(_qt_plugin_path "${_qt_plugin_name}" LOCATION)
|
||||
if(EXISTS "${_qt_plugin_path}")
|
||||
get_filename_component(_qt_plugin_file "${_qt_plugin_path}" NAME)
|
||||
get_filename_component(_qt_plugin_type "${_qt_plugin_path}" PATH)
|
||||
get_filename_component(_qt_plugin_type "${_qt_plugin_type}" NAME)
|
||||
set(_qt_plugin_dest "${_prefix}/PlugIns/${_qt_plugin_type}")
|
||||
install(FILES "${_qt_plugin_path}"
|
||||
DESTINATION "${_qt_plugin_dest}")
|
||||
set(${_qt_plugins_var}
|
||||
"${${_qt_plugins_var}};\$ENV{DEST_DIR}\${CMAKE_INSTALL_PREFIX}/${_qt_plugin_dest}/${_qt_plugin_file}")
|
||||
else()
|
||||
message(FATAL_ERROR "QT plugin ${_qt_plugin_name} not found")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Install our dependencies to the macOS bundle
|
||||
if(APPLE)
|
||||
if (QT)
|
||||
set(prefix "86Box.app/Contents")
|
||||
set(INSTALL_RUNTIME_DIR "${prefix}/MacOS")
|
||||
set(INSTALL_CMAKE_DIR "${prefix}/Resources")
|
||||
|
||||
# using the install_qt5_plugin to add Qt plugins into the macOS app bundle
|
||||
if (USE_QT6)
|
||||
install_qt5_plugin("Qt6::QCocoaIntegrationPlugin" QT_PLUGINS ${prefix})
|
||||
else()
|
||||
install_qt5_plugin("Qt5::QCocoaIntegrationPlugin" QT_PLUGINS ${prefix})
|
||||
install_qt5_plugin("Qt5::QMacStylePlugin" QT_PLUGINS ${prefix})
|
||||
install_qt5_plugin("Qt5::QICOPlugin" QT_PLUGINS ${prefix})
|
||||
install_qt5_plugin("Qt5::QICNSPlugin" QT_PLUGINS ${prefix})
|
||||
endif()
|
||||
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
|
||||
"[Paths]\nPlugins = ${_qt_plugin_dir}\n")
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
|
||||
DESTINATION "${INSTALL_CMAKE_DIR}")
|
||||
|
||||
# Note Mac specific extension .app
|
||||
set(APPS "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/86Box.app")
|
||||
|
||||
# Directories to look for dependencies
|
||||
set(DIRS "${CMAKE_BINARY_DIR}")
|
||||
|
||||
# Path used for searching by FIND_XXX(), with appropriate suffixes added
|
||||
if(CMAKE_PREFIX_PATH)
|
||||
foreach(dir ${CMAKE_PREFIX_PATH})
|
||||
list(APPEND DIRS "${dir}/bin" "${dir}/lib")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Append Qt's lib folder which is two levels above Qt5Widgets_DIR
|
||||
list(APPEND DIRS "${Qt5Widgets_DIR}/../..")
|
||||
|
||||
include(InstallRequiredSystemLibraries)
|
||||
|
||||
message(STATUS "APPS: ${APPS}")
|
||||
message(STATUS "QT_PLUGINS: ${QT_PLUGINS}")
|
||||
message(STATUS "DIRS: ${DIRS}")
|
||||
|
||||
install(CODE "include(BundleUtilities)
|
||||
fixup_bundle(\"${APPS}\" \"${QT_PLUGINS}\" \"${DIRS}\")")
|
||||
else()
|
||||
install(CODE "
|
||||
include(BundleUtilities)
|
||||
get_filename_component(CMAKE_INSTALL_PREFIX_ABSOLUTE \${CMAKE_INSTALL_PREFIX} ABSOLUTE)
|
||||
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX_ABSOLUTE}/86Box.app\" \"\" \"\")"
|
||||
COMPONENT Runtime)
|
||||
endif()
|
||||
|
||||
|
||||
# Install our dependencies if using vcpkg
|
||||
if(VCPKG_TOOLCHAIN)
|
||||
x_vcpkg_install_local_dependencies(TARGETS 86Box DESTINATION ".")
|
||||
endif()
|
||||
|
||||
|
||||
# Install other dependencies
|
||||
if(WIN32 OR (APPLE AND NOT QT))
|
||||
install(CODE "
|
||||
include(BundleUtilities)
|
||||
get_filename_component(CMAKE_INSTALL_PREFIX_ABSOLUTE \${CMAKE_INSTALL_PREFIX} ABSOLUTE)
|
||||
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX_ABSOLUTE}/$<TARGET_FILE_NAME:86Box>\" \"\" \"\")"
|
||||
COMPONENT Runtime)
|
||||
endif()
|
||||
|
||||
|
||||
# Install the PDB file on Windows builds
|
||||
if(MSVC)
|
||||
# CMake fully supports PDB files on MSVC-compatible compilers
|
||||
|
@@ -74,6 +74,7 @@ extern void ui_sb_update_icon_state(int tag, int active);
|
||||
extern void ui_sb_set_text_w(wchar_t *wstr);
|
||||
extern void ui_sb_set_text(char *str);
|
||||
extern void ui_sb_bugui(char *str);
|
||||
extern void ui_sb_mt32lcd(char *str);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -16,5 +16,14 @@
|
||||
add_library(net OBJECT network.c net_pcap.c net_slirp.c net_dp8390.c net_3c503.c
|
||||
net_ne2000.c net_pcnet.c net_wd8003.c net_plip.c)
|
||||
|
||||
add_subdirectory(slirp)
|
||||
target_link_libraries(86Box slirp)
|
||||
option(SLIRP_EXTERNAL "Link against the system-provided libslirp library" OFF)
|
||||
mark_as_advanced(SLIRP_EXTERNAL)
|
||||
|
||||
if(SLIRP_EXTERNAL)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(SLIRP REQUIRED IMPORTED_TARGET slirp)
|
||||
target_link_libraries(86Box PkgConfig::SLIRP)
|
||||
else()
|
||||
add_subdirectory(slirp)
|
||||
target_link_libraries(86Box slirp)
|
||||
endif()
|
@@ -16,7 +16,7 @@ endif()
|
||||
set(QT_STATIC ${STATIC_BUILD})
|
||||
|
||||
if(QT_STATIC AND MINGW)
|
||||
set(CMAKE_PREFIX_PATH "$ENV{MSYSTEM_PREFIX}/qt5-static")
|
||||
set(CMAKE_PREFIX_PATH "$ENV{MSYSTEM_PREFIX}/qt${QT_MAJOR}-static")
|
||||
endif()
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
@@ -189,6 +189,71 @@ if (WIN32)
|
||||
qt_import_plugins(plat INCLUDE Qt${QT_MAJOR}::QWindowsIntegrationPlugin Qt${QT_MAJOR}::QICOPlugin QWindowsVistaStylePlugin)
|
||||
endif()
|
||||
|
||||
# loads a macro to install Qt5 plugins on macOS
|
||||
# based on https://stackoverflow.com/questions/35612687/cmake-macos-x-bundle-with-bundleutiliies-for-qt-application
|
||||
macro(install_qt5_plugin _qt_plugin_name _qt_plugins_var _prefix)
|
||||
get_target_property(_qt_plugin_path "${_qt_plugin_name}" LOCATION)
|
||||
if(EXISTS "${_qt_plugin_path}")
|
||||
get_filename_component(_qt_plugin_file "${_qt_plugin_path}" NAME)
|
||||
get_filename_component(_qt_plugin_type "${_qt_plugin_path}" PATH)
|
||||
get_filename_component(_qt_plugin_type "${_qt_plugin_type}" NAME)
|
||||
set(_qt_plugin_dest "${_prefix}/PlugIns/${_qt_plugin_type}")
|
||||
install(FILES "${_qt_plugin_path}"
|
||||
DESTINATION "${_qt_plugin_dest}")
|
||||
set(${_qt_plugins_var}
|
||||
"${${_qt_plugins_var}};\$ENV{DEST_DIR}\${CMAKE_INSTALL_PREFIX}/${_qt_plugin_dest}/${_qt_plugin_file}")
|
||||
else()
|
||||
message(FATAL_ERROR "QT plugin ${_qt_plugin_name} not found")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
if (APPLE AND CMAKE_MACOSX_BUNDLE)
|
||||
set(prefix "$<TARGET_FILE_NAME:86Box>/Contents")
|
||||
set(INSTALL_RUNTIME_DIR "${prefix}/MacOS")
|
||||
set(INSTALL_CMAKE_DIR "${prefix}/Resources")
|
||||
|
||||
# using the install_qt5_plugin to add Qt plugins into the macOS app bundle
|
||||
if (USE_QT6)
|
||||
install_qt5_plugin("Qt6::QCocoaIntegrationPlugin" QT_PLUGINS ${prefix})
|
||||
else()
|
||||
install_qt5_plugin("Qt5::QCocoaIntegrationPlugin" QT_PLUGINS ${prefix})
|
||||
install_qt5_plugin("Qt5::QMacStylePlugin" QT_PLUGINS ${prefix})
|
||||
install_qt5_plugin("Qt5::QICOPlugin" QT_PLUGINS ${prefix})
|
||||
install_qt5_plugin("Qt5::QICNSPlugin" QT_PLUGINS ${prefix})
|
||||
endif()
|
||||
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
|
||||
"[Paths]\nPlugins = ${_qt_plugin_dir}\n")
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
|
||||
DESTINATION "${INSTALL_CMAKE_DIR}")
|
||||
|
||||
# Note Mac specific extension .app
|
||||
set(APPS "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/$<TARGET_FILE_NAME:86Box>")
|
||||
|
||||
# Directories to look for dependencies
|
||||
set(DIRS "${CMAKE_BINARY_DIR}")
|
||||
|
||||
# Path used for searching by FIND_XXX(), with appropriate suffixes added
|
||||
if(CMAKE_PREFIX_PATH)
|
||||
foreach(dir ${CMAKE_PREFIX_PATH})
|
||||
list(APPEND DIRS "${dir}/bin" "${dir}/lib")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Append Qt's lib folder which is two levels above Qt5Widgets_DIR
|
||||
list(APPEND DIRS "${Qt5Widgets_DIR}/../..")
|
||||
|
||||
include(InstallRequiredSystemLibraries)
|
||||
|
||||
message(STATUS "APPS: ${APPS}")
|
||||
message(STATUS "QT_PLUGINS: ${QT_PLUGINS}")
|
||||
message(STATUS "DIRS: ${DIRS}")
|
||||
|
||||
install(CODE "
|
||||
include(BundleUtilities)
|
||||
fixup_bundle(\"${APPS}\" \"${QT_PLUGINS}\" \"${DIRS}\")")
|
||||
endif()
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
find_package(X11 REQUIRED)
|
||||
target_link_libraries(ui PRIVATE X11::X11)
|
||||
|
@@ -28,7 +28,7 @@
|
||||
|
||||
MainWindow* main_window = nullptr;
|
||||
|
||||
static QString sb_text, sb_buguitext;
|
||||
static QString sb_text, sb_buguitext, sb_mt32lcdtext;
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -99,7 +99,13 @@ int ui_msgbox(int flags, void *message) {
|
||||
}
|
||||
|
||||
void ui_sb_update_text() {
|
||||
emit main_window->statusBarMessage(sb_text.isEmpty() ? sb_buguitext : sb_text);
|
||||
emit main_window->statusBarMessage( !sb_mt32lcdtext.isEmpty() ? sb_mt32lcdtext : sb_text.isEmpty() ? sb_buguitext : sb_text);
|
||||
}
|
||||
|
||||
void ui_sb_mt32lcd(char* str)
|
||||
{
|
||||
sb_mt32lcdtext = QString(str);
|
||||
ui_sb_update_text();
|
||||
}
|
||||
|
||||
void ui_sb_set_text_w(wchar_t *wstr) {
|
||||
|
@@ -33,8 +33,17 @@ if(MUNT)
|
||||
target_compile_definitions(snd PRIVATE USE_MUNT)
|
||||
target_sources(snd PRIVATE midi_mt32.c)
|
||||
|
||||
add_subdirectory(munt)
|
||||
target_link_libraries(86Box mt32emu)
|
||||
option(MUNT_EXTERNAL "Link against the system-provided MUNT library" OFF)
|
||||
mark_as_advanced(MUNT_EXTERNAL)
|
||||
|
||||
if(MUNT_EXTERNAL)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(MT32EMU REQUIRED IMPORTED_TARGET mt32emu)
|
||||
target_link_libraries(86Box PkgConfig::MT32EMU)
|
||||
else()
|
||||
add_subdirectory(munt)
|
||||
target_link_libraries(86Box mt32emu)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(PAS16)
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include <86box/mem.h>
|
||||
#include <86box/rom.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/ui.h>
|
||||
#include <86box/sound.h>
|
||||
#include <86box/midi.h>
|
||||
|
||||
@@ -18,6 +19,19 @@ extern void givealbuffer_midi(void *buf, uint32_t size);
|
||||
extern void al_set_midi(int freq, int buf_size);
|
||||
#endif
|
||||
|
||||
static void display_mt32_message(void *instance_data, const char *message)
|
||||
{
|
||||
int sz = 0;
|
||||
char* ui_msg = NULL;
|
||||
|
||||
sz = snprintf(NULL, 0, "MT-32: %s", message);
|
||||
ui_msg = calloc(sz + 1, 1);
|
||||
if (ui_msg)
|
||||
{
|
||||
snprintf(ui_msg, sz, "MT-32: %s", message);
|
||||
ui_sb_mt32lcd(ui_msg);
|
||||
}
|
||||
}
|
||||
static const mt32emu_report_handler_i_v0 handler_v0 = {
|
||||
/** Returns the actual interface version ID */
|
||||
NULL, //mt32emu_report_handler_version (*getVersionID)(mt32emu_report_handler_i i);
|
||||
@@ -28,7 +42,7 @@ static const mt32emu_report_handler_i_v0 handler_v0 = {
|
||||
NULL, //void (*onErrorControlROM)(void *instance_data);
|
||||
NULL, //void (*onErrorPCMROM)(void *instance_data);
|
||||
/** Callback for reporting about displaying a new custom message on LCD */
|
||||
NULL, //void (*showLCDMessage)(void *instance_data, const char *message);
|
||||
display_mt32_message, //void (*showLCDMessage)(void *instance_data, const char *message);
|
||||
/** Callback for reporting actual processing of a MIDI message */
|
||||
NULL, //void (*onMIDIMessagePlayed)(void *instance_data);
|
||||
/**
|
||||
|
@@ -54,4 +54,4 @@ else()
|
||||
endif()
|
||||
|
||||
target_link_libraries(86Box advapi32 comctl32 comdlg32 gdi32 shell32 iphlpapi
|
||||
dxguid imm32 hid setupapi uxtheme version winmm psapi)
|
||||
dxguid imm32 hid setupapi uxtheme version winmm psapi ws2_32)
|
||||
|
@@ -1073,3 +1073,9 @@ ui_sb_bugui(char *str)
|
||||
memset(sb_bugtext, 0x00, sizeof(sb_bugtext));
|
||||
ui_sb_update_text();
|
||||
}
|
||||
|
||||
/* API */
|
||||
void
|
||||
ui_sb_mt32lcd(char* str)
|
||||
{
|
||||
}
|
||||
|
Reference in New Issue
Block a user