diff --git a/CMakeLists.txt b/CMakeLists.txt index ff4eaf0b9..0ff46fcf1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,15 @@ cmake_minimum_required(VERSION 3.16) +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) message(FATAL_ERROR "Prevented in-tree build. Please create a build directory outside of the amiberry source code and run \"cmake -S ${CMAKE_SOURCE_DIR} -B .\" from there") endif () -set(VERSION 6.3.5) +## Determine proper semantic version +set(VERSION_MAJOR "7") +set(VERSION_MINOR "0") +set(VERSION_PATCH "0") + +set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(PROJECT_NAME "Amiberry") @@ -56,9 +62,6 @@ if (WITH_LTO) set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) endif () -# Needed so that cmake uses our find modules. -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) - if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if (CMAKE_SYSTEM_PROCESSOR MATCHES "arm64") include_directories("/opt/homebrew/include") @@ -69,6 +72,8 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") endif () endif () +include(FindHelper) + # Define the list of source files set(SOURCE_FILES src/a2065.cpp @@ -480,9 +485,10 @@ find_package(FLAC REQUIRED) find_package(mpg123 REQUIRED) find_package(PNG REQUIRED) find_package(ZLIB REQUIRED) -find_library(LIBSERIALPORT_LIBRARIES serialport REQUIRED) -find_library(PORTMIDI_LIBRARIES portmidi REQUIRED) -find_library(LIBMPEG2 mpeg2 REQUIRED) +find_helper(LIBSERIALPORT libserialport libserialport.h serialport) +find_helper(PORTMIDI portmidi portmidi.h portmidi) +find_helper(LIBMPEG2_CONVERT libmpeg2convert mpeg2convert.h mpeg2convert) +find_helper(LIBMPEG2 libmpeg2 mpeg2.h mpeg2) set(libmt32emu_SHARED FALSE) add_subdirectory(external/mt32emu) @@ -495,7 +501,7 @@ add_dependencies(${PROJECT_NAME} mt32emu floppybridge capsimage guisan) target_compile_options(${PROJECT_NAME} PRIVATE -fno-pie) target_include_directories(${PROJECT_NAME} PRIVATE src src/osdep src/include src/threaddep src/archivers src/ppc/pearpc external/libguisan/include external/mt32emu/src external/floppybridge/src) -target_link_libraries(${PROJECT_NAME} PRIVATE SDL2 SDL2_image SDL2_ttf guisan mt32emu ${DBUS_LIBRARIES} FLAC portmidi png MPG123::libmpg123 mpeg2convert mpeg2 serialport z pthread dl) +target_link_libraries(${PROJECT_NAME} PRIVATE SDL2 SDL2_image SDL2_ttf guisan mt32emu ${DBUS_LIBRARIES} FLAC ${PORTMIDI_LIBRARIES} png MPG123::libmpg123 ${LIBMPEG2_LIBRARIES} ${LIBMPEG2_CONVERT_LIBRARIES} ${LIBSERIALPORT_LIBRARIES} z pthread dl) target_link_options(${PROJECT_NAME} PRIVATE -no-pie) if (USE_OPENGL) @@ -616,13 +622,15 @@ else() # Install icon install(FILES ${CMAKE_SOURCE_DIR}/data/amiberry.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps) - # Install Debian files + install(FILES ${CMAKE_SOURCE_DIR}/debian/changelog.gz DESTINATION ${CMAKE_INSTALL_DOCDIR}) install(FILES ${CMAKE_SOURCE_DIR}/debian/copyright DESTINATION ${CMAKE_INSTALL_DOCDIR}) install(FILES ${CMAKE_SOURCE_DIR}/docs/amiberry.1.gz DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) + install(FILES ${CMAKE_SOURCE_DIR}/data/Amiberry.metainfo.xml + DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo) endif() # Base package settings diff --git a/cmake/FindHelper.cmake b/cmake/FindHelper.cmake new file mode 100644 index 000000000..38e2c14db --- /dev/null +++ b/cmake/FindHelper.cmake @@ -0,0 +1,53 @@ +# +# - Try to find a library using pkg-config if available, +# than portable macros FIND_PATH and FIND_LIBRARY +# +# The following variables will be set : +# +# ${prefix}_FOUND - set to 1 or TRUE if found +# ${prefix}_INCLUDE_DIRS - to be used in INCLUDE_DIRECTORIES(...) +# ${prefix}_LIBRARIES - to be used in TARGET_LINK_LIBRARIES(...) +# +# Copyright (c) 2009-2017, Jérémy Zurcher, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +macro(FIND_HELPER prefix pkg_name header lib) + if(${prefix}_INCLUDE_DIRS AND ${prefix}_LIBRARIES) + # use cached variables + set(${prefix}_FIND_QUIETLY TRUE) + set(${prefix}_FOUND TRUE) + else() + # use pkg-config if available to set find_path and find_library hints + find_package(PkgConfig) + if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_${prefix} ${pkg_name}) + else() + message(STATUS "Checking for module '${pkg_name}' without pkgconfig") + endif() + # find_path + find_path(${prefix}_INCLUDE_DIRS + NAMES ${header} + HINTS ${PC_${prefix}_INCLUDEDIR} ${PC_${prefix}_INCLUDE_DIRS} + ENV ${prefix}_INCLUDE + ) + # find_library + find_library(${prefix}_LIBRARIES + NAMES ${lib} + HINTS ${PC_${prefix}_LIBDIR} ${PC_${prefix}_LIBRARY_DIRS} + ENV ${prefix}_PATH + ) + include(FindPackageHandleStandardArgs) + if ("${${prefix}_INCLUDE_DIRS}" STREQUAL "") + set(${prefix}_INCLUDE_DIRS "/usr/include") + endif () + find_package_handle_standard_args(${prefix} DEFAULT_MSG ${prefix}_LIBRARIES ${prefix}_INCLUDE_DIRS) + if(NOT "${PC_${prefix}_INCLUDE_DIRS}" STREQUAL "") + set(${prefix}_INCLUDE_DIRS "${${prefix}_INCLUDE_DIRS};${PC_${prefix}_INCLUDE_DIRS}") + endif() + # Update variables in the cache (these are set by find_path/find_library) after modifying + set(${prefix}_INCLUDE_DIRS "${${prefix}_INCLUDE_DIRS}" CACHE PATH "Path to ${pkg_name} include files" FORCE) + set(${prefix}_LIBRARIES "${${prefix}_LIBRARIES}" CACHE FILEPATH "Path to ${pkg_name} libraries" FORCE) + endif() +endmacro() \ No newline at end of file diff --git a/data/Amiberry.desktop b/data/Amiberry.desktop index df49f18d1..07b706ac3 100644 --- a/data/Amiberry.desktop +++ b/data/Amiberry.desktop @@ -15,8 +15,8 @@ GenericName = Amiga Emulator Comment = Optimized Amiga Emulator # The executable of the application, possibly with arguments -Exec = /usr/bin/amiberry %f -TryExec = /usr/bin/amiberry +Exec = amiberry %f +TryExec = amiberry # The name of the icon that will be used to display this entry Icon = amiberry diff --git a/flatpak/com.blitterstudio.amiberry.metainfo.xml b/data/Amiberry.metainfo.xml similarity index 94% rename from flatpak/com.blitterstudio.amiberry.metainfo.xml rename to data/Amiberry.metainfo.xml index 8b54dd599..d216a7d48 100644 --- a/flatpak/com.blitterstudio.amiberry.metainfo.xml +++ b/data/Amiberry.metainfo.xml @@ -1,10 +1,10 @@ - com.blitterstudio.amiberry - com.blitterstudio.amiberry.desktop + amiberry + Amiberry.desktop Amiberry BlitterStudio - An Amiga emulator for Linux + A multi-platform Amiga emulator FSFAP diff --git a/flatpak/com.blitterstudio.amiberry.desktop b/flatpak/com.blitterstudio.amiberry.desktop deleted file mode 100644 index b7dc6a1e9..000000000 --- a/flatpak/com.blitterstudio.amiberry.desktop +++ /dev/null @@ -1,33 +0,0 @@ -[Desktop Entry] - -# The type of the Desktop Entry, usually Application -Type = Application - -# The version of the Desktop Entry specification to which this file complies -Version = 1.0 - -# The name of the application -Name = Amiberry - -GenericName = Amiga Emulator - -# A comment which can/will be used as a tooltip -Comment = Optimized Amiga Emulator - -# The executable of the application, possibly with arguments -Exec = /usr/bin/amiberry %f -TryExec = /usr/bin/amiberry - -# The name of the icon that will be used to display this entry -Icon = com.blitterstudio.Amiberry - -# Describes whether this application needs to be run in a terminal or not -Terminal = false - -# Describes the categories in which this entry should be shown -Categories = Game;Emulator; - -MimeType=application/x-amiga-disk-image;application/x-cue;application/octet-stream; - -# Describes the encoding for the desktop entry -Encoding=UTF-8 diff --git a/flatpak/com.blitterstudio.amiberry.yml b/flatpak/com.blitterstudio.amiberry.yml index b0993436c..27adc9a2f 100644 --- a/flatpak/com.blitterstudio.amiberry.yml +++ b/flatpak/com.blitterstudio.amiberry.yml @@ -1,8 +1,10 @@ app-id: com.blitterstudio.amiberry runtime: org.freedesktop.Platform -runtime-version: "23.08" +runtime-version: "24.08" sdk: org.freedesktop.Sdk command: amiberry +rename-desktop-file: Amiberry.desktop +rename-appdata-file: Amiberry.metainfo.xml rename-icon: amiberry finish-args: - --device=all @@ -58,11 +60,11 @@ modules: - -DCMAKE_BUILD_TYPE=Release sources: - type: git - url: https://github.com/PortMidi/PortMidi + url: https://github.com/PortMidi/portmidi.git tag: v2.0.4 commit: b808babecdc5d05205467dab5c1006c5ac0fdfd4 cleanup: - - /bin + - /lib/cmake - /lib/pkgconfig - /include - '*.a' @@ -71,12 +73,7 @@ modules: - name: amiberry buildsystem: cmake-ninja builddir: true - post-install: - - install -D -m644 -t /app/share/applications/ flatpak/${FLATPAK_ID}.desktop - - install -D -m644 -t /app/share/metainfo/ flatpak/${FLATPAK_ID}.metainfo.xml - sources: - type: git url: https://github.com/BlitterStudio/amiberry - tag: flatpak-preview - commit: 7882b2c8fc77b1540d886eb39b8742f86d0b6032 + branch: fix-flatpak