Add Mac support
This commit is contained in:
1 parent
ad0d7376b3
commit
2568f9089b
4 files changed
+108
-8
No files matched your search
+28
-7
@@ -26,6 +26,13 @@ find_package(Qt6 OPTIONAL_COMPONENTS Pdf DBus)
|
||||
# Third-party libraries
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(UCHARDET REQUIRED IMPORTED_TARGET uchardet)
|
||||
|
||||
# Homebrew's uchardet pkg-config sets includedir=…/include/uchardet (one level too deep),
|
||||
# causing #include <uchardet/uchardet.h> to fail. Strip the trailing /uchardet if present.
|
||||
get_target_property(_uchardet_inc PkgConfig::UCHARDET INTERFACE_INCLUDE_DIRECTORIES)
|
||||
list(TRANSFORM _uchardet_inc REPLACE "/uchardet$" "")
|
||||
set_target_properties(PkgConfig::UCHARDET PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_uchardet_inc}")
|
||||
|
||||
find_package(Iconv REQUIRED)
|
||||
pkg_check_modules(MINIZIP REQUIRED IMPORTED_TARGET minizip)
|
||||
|
||||
@@ -75,7 +82,9 @@ set(SOURCES
|
||||
)
|
||||
|
||||
|
||||
list(APPEND SOURCES src/asteria.rc)
|
||||
if(WIN32)
|
||||
list(APPEND SOURCES src/asteria.rc)
|
||||
endif()
|
||||
|
||||
|
||||
# Executable
|
||||
@@ -90,6 +99,16 @@ if(WIN32)
|
||||
$<$<NOT:$<CONFIG:Debug>>:-mwindows>)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(asteria-qt PROPERTIES
|
||||
MACOSX_BUNDLE TRUE
|
||||
MACOSX_BUNDLE_BUNDLE_NAME "Asteria"
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER "com.asteria-bookreader.asteria-qt"
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_VERSION}"
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}"
|
||||
)
|
||||
endif()
|
||||
|
||||
target_include_directories(asteria-qt PRIVATE src)
|
||||
|
||||
target_link_libraries(asteria-qt PRIVATE
|
||||
@@ -174,12 +193,14 @@ qt_add_qml_module(asteria-qt
|
||||
|
||||
# Install rules
|
||||
install(TARGETS asteria-qt DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
install(FILES packaging/asteria-qt.desktop
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
|
||||
foreach(SIZE 16 32 48 64 128 256 512)
|
||||
install(FILES packaging/icons/${SIZE}x${SIZE}/asteria-qt.png
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/${SIZE}x${SIZE}/apps)
|
||||
endforeach()
|
||||
if(UNIX AND NOT APPLE)
|
||||
install(FILES packaging/asteria-qt.desktop
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
|
||||
foreach(SIZE 16 32 48 64 128 256 512)
|
||||
install(FILES packaging/icons/${SIZE}x${SIZE}/asteria-qt.png
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/${SIZE}x${SIZE}/apps)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# Testing
|
||||
enable_testing()
|
||||
|
||||
Reference in new issue
Block a user