This commit is contained in:
RichardG867
2023-04-15 13:38:43 -03:00
6 changed files with 48 additions and 10 deletions

View File

@@ -11,3 +11,5 @@ vulkan-headers
MoltenVK MoltenVK
qt5 qt5
wget wget
fluidsynth
ghostscript

View File

@@ -159,7 +159,15 @@ bin_init(const char *filename, int *error)
tf->get_length = bin_get_length; tf->get_length = bin_get_length;
tf->close = bin_close; tf->close = bin_close;
} else { } else {
free(tf); /* From the check above, error may still be non-zero if opening a directory.
* The error is set for viso to try and open the directory following this function.
* However, we need to make sure the descriptor is closed. */
if ((tf->file != NULL) && ((stats.st_mode & S_IFMT) == S_IFDIR)) {
/* tf is freed by bin_close */
bin_close(tf);
} else {
free(tf);
}
tf = NULL; tf = NULL;
} }

View File

@@ -14,3 +14,10 @@
# #
add_library(print OBJECT png.c prt_cpmap.c prt_escp.c prt_text.c prt_ps.c) add_library(print OBJECT png.c prt_cpmap.c prt_escp.c prt_text.c prt_ps.c)
if(APPLE)
find_library(GHOSTSCRIPT_LIB gs)
if (NOT GHOSTSCRIPT_LIB)
message(WARNING "Could not find ghostscript. The library will not be bundled and any related features will not work.")
endif()
endif ()

View File

@@ -299,7 +299,7 @@ endif()
# loads a macro to install Qt5 plugins on macOS # 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 # 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) macro(install_qt5_plugin _qt_plugin_name _runtime_plugins_var _prefix)
get_target_property(_qt_plugin_path "${_qt_plugin_name}" LOCATION) get_target_property(_qt_plugin_path "${_qt_plugin_name}" LOCATION)
if(EXISTS "${_qt_plugin_path}") if(EXISTS "${_qt_plugin_path}")
get_filename_component(_qt_plugin_file "${_qt_plugin_path}" NAME) get_filename_component(_qt_plugin_file "${_qt_plugin_path}" NAME)
@@ -307,7 +307,7 @@ macro(install_qt5_plugin _qt_plugin_name _qt_plugins_var _prefix)
get_filename_component(_qt_plugin_type "${_qt_plugin_type}" NAME) get_filename_component(_qt_plugin_type "${_qt_plugin_type}" NAME)
set(_qt_plugin_dest "${_prefix}/PlugIns/${_qt_plugin_type}") set(_qt_plugin_dest "${_prefix}/PlugIns/${_qt_plugin_type}")
install(FILES "${_qt_plugin_path}" DESTINATION "${_qt_plugin_dest}") install(FILES "${_qt_plugin_path}" DESTINATION "${_qt_plugin_dest}")
list(APPEND ${_qt_plugins_var} "\${CMAKE_INSTALL_PREFIX_ABSOLUTE}/${_qt_plugin_dest}/${_qt_plugin_file}") list(APPEND ${_runtime_plugins_var} "\${CMAKE_INSTALL_PREFIX_ABSOLUTE}/${_qt_plugin_dest}/${_qt_plugin_file}")
else() else()
message(FATAL_ERROR "QT plugin ${_qt_plugin_name} not found") message(FATAL_ERROR "QT plugin ${_qt_plugin_name} not found")
endif() endif()
@@ -320,10 +320,25 @@ if (APPLE AND CMAKE_MACOSX_BUNDLE)
set(INSTALL_LIB_DIR "${prefix}/Frameworks") set(INSTALL_LIB_DIR "${prefix}/Frameworks")
# using the install_qt5_plugin to add Qt plugins into the macOS app bundle # using the install_qt5_plugin to add Qt plugins into the macOS app bundle
install_qt5_plugin("Qt${QT_MAJOR}::QCocoaIntegrationPlugin" QT_PLUGINS ${prefix}) install_qt5_plugin("Qt${QT_MAJOR}::QCocoaIntegrationPlugin" RUNTIME_PLUGINS ${prefix})
install_qt5_plugin("Qt${QT_MAJOR}::QMacStylePlugin" QT_PLUGINS ${prefix}) install_qt5_plugin("Qt${QT_MAJOR}::QMacStylePlugin" RUNTIME_PLUGINS ${prefix})
install_qt5_plugin("Qt${QT_MAJOR}::QICOPlugin" QT_PLUGINS ${prefix}) install_qt5_plugin("Qt${QT_MAJOR}::QICOPlugin" RUNTIME_PLUGINS ${prefix})
install_qt5_plugin("Qt${QT_MAJOR}::QICNSPlugin" QT_PLUGINS ${prefix}) install_qt5_plugin("Qt${QT_MAJOR}::QICNSPlugin" RUNTIME_PLUGINS ${prefix})
# Install libraries that are loaded at runtime and not linked
if (GHOSTSCRIPT_LIB)
set(GS_LIBRARY_NAME "libgs.dylib")
file(REAL_PATH ${GHOSTSCRIPT_LIB} GS_LIB_RESOLVED)
install(FILES ${GS_LIB_RESOLVED} DESTINATION ${INSTALL_LIB_DIR} RENAME ${GS_LIBRARY_NAME})
list(APPEND RUNTIME_PLUGINS "\${CMAKE_INSTALL_PREFIX_ABSOLUTE}/${INSTALL_LIB_DIR}/${GS_LIBRARY_NAME}")
endif ()
if (FLUIDSYNTH_LIB)
set(FLUIDSYNTH_LIBRARY_NAME "libfluidsynth.dylib")
file(REAL_PATH ${FLUIDSYNTH_LIB} FLUIDSYNTH_LIB_RESOLVED)
install(FILES ${FLUIDSYNTH_LIB_RESOLVED} DESTINATION ${INSTALL_LIB_DIR} RENAME ${FLUIDSYNTH_LIBRARY_NAME})
list(APPEND RUNTIME_PLUGINS "\${CMAKE_INSTALL_PREFIX_ABSOLUTE}/${INSTALL_LIB_DIR}/${FLUIDSYNTH_LIBRARY_NAME}")
endif ()
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
"[Paths]\nPlugins = PlugIns\n") "[Paths]\nPlugins = PlugIns\n")
@@ -345,7 +360,7 @@ if (APPLE AND CMAKE_MACOSX_BUNDLE)
install(CODE " install(CODE "
include(BundleUtilities) include(BundleUtilities)
get_filename_component(CMAKE_INSTALL_PREFIX_ABSOLUTE \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX} ABSOLUTE) get_filename_component(CMAKE_INSTALL_PREFIX_ABSOLUTE \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX} ABSOLUTE)
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX_ABSOLUTE}/86Box.app\" \"${QT_PLUGINS}\" \"${DIRS}\") fixup_bundle(\"\${CMAKE_INSTALL_PREFIX_ABSOLUTE}/86Box.app\" \"${RUNTIME_PLUGINS}\" \"${DIRS}\")
execute_process( execute_process(
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath \"@executable_path/../Frameworks/\" COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath \"@executable_path/../Frameworks/\"
\"\${CMAKE_INSTALL_PREFIX_ABSOLUTE}/${INSTALL_RUNTIME_DIR}/86Box\") \"\${CMAKE_INSTALL_PREFIX_ABSOLUTE}/${INSTALL_RUNTIME_DIR}/86Box\")

View File

@@ -168,8 +168,8 @@ private:
bool vnc_enabled = false; bool vnc_enabled = false;
/* Full screen ON and OFF signals */ /* Full screen ON and OFF signals */
static bool fs_on_signal = false; bool fs_on_signal = false;
static bool fs_off_signal = false; bool fs_off_signal = false;
friend class SpecifyDimensions; friend class SpecifyDimensions;
friend class ProgSettings; friend class ProgSettings;

View File

@@ -85,6 +85,12 @@ if(RTMIDI)
endif() endif()
if(FLUIDSYNTH) if(FLUIDSYNTH)
if(APPLE)
find_library(FLUIDSYNTH_LIB fluidsynth)
if (NOT FLUIDSYNTH_LIB)
message(WARNING "Could not find fluid synth. The library will not be bundled and any related features will not work.")
endif()
endif ()
target_compile_definitions(snd PRIVATE USE_FLUIDSYNTH) target_compile_definitions(snd PRIVATE USE_FLUIDSYNTH)
target_sources(snd PRIVATE midi_fluidsynth.c) target_sources(snd PRIVATE midi_fluidsynth.c)
endif() endif()