mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-21 08:09:35 +08:00
cmake: make it compile on OS X
This commit is contained in:
parent
1e9bbce249
commit
1d6a1db491
0
dist/mac/CMakeLists.txt
vendored
Normal file
0
dist/mac/CMakeLists.txt
vendored
Normal file
2
dist/mac/bundle.cmake
vendored
Normal file
2
dist/mac/bundle.cmake
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
include(BundleUtilities)
|
||||||
|
fixup_bundle("$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/qbittorrent.app" "" "")
|
@ -99,17 +99,65 @@ if (WEBUI)
|
|||||||
list(APPEND QBT_TARGET_LIBRARIES qbt_webui)
|
list(APPEND QBT_TARGET_LIBRARIES qbt_webui)
|
||||||
endif (WEBUI)
|
endif (WEBUI)
|
||||||
|
|
||||||
add_executable(${QBT_TARGET_NAME} ${QBT_APP_HEADERS} ${QBT_APP_SOURCES} ${QBT_QM_FILES} ${QBT_APP_RESOURCE_SOURCE})
|
# we have to include resources into the bundle
|
||||||
set_target_properties(${QBT_TARGET_NAME} PROPERTIES AUTOUIC True)
|
if (APPLE)
|
||||||
|
set(OSX_RES_SRC_DIR "${qBittorrent_SOURCE_DIR}/dist/mac")
|
||||||
|
list(APPEND QBT_APP_RESOURCE_SOURCE
|
||||||
|
"${OSX_RES_SRC_DIR}/qt.conf"
|
||||||
|
"${OSX_RES_SRC_DIR}/qBitTorrentDocument.icns"
|
||||||
|
"${OSX_RES_SRC_DIR}/qbittorrent_mac.icns")
|
||||||
|
set_source_files_properties(
|
||||||
|
"${OSX_RES_SRC_DIR}/qt.conf"
|
||||||
|
"${OSX_RES_SRC_DIR}/qBitTorrentDocument.icns"
|
||||||
|
"${OSX_RES_SRC_DIR}/qbittorrent_mac.icns"
|
||||||
|
PROPERTIES
|
||||||
|
MACOSX_PACKAGE_LOCATION Resources)
|
||||||
|
set(QT_TR_DIR "${qBittorrent_SOURCE_DIR}/dist/qt-translations")
|
||||||
|
set(QT_TRANSLATIONS
|
||||||
|
${QT_TR_DIR}/qt_ar.qm
|
||||||
|
${QT_TR_DIR}/qt_bg.qm
|
||||||
|
${QT_TR_DIR}/qt_ca.qm
|
||||||
|
${QT_TR_DIR}/qt_cs.qm
|
||||||
|
${QT_TR_DIR}/qt_da.qm
|
||||||
|
${QT_TR_DIR}/qt_de.qm
|
||||||
|
${QT_TR_DIR}/qt_es.qm
|
||||||
|
${QT_TR_DIR}/qt_eu.qm
|
||||||
|
${QT_TR_DIR}/qt_fi.qm
|
||||||
|
${QT_TR_DIR}/qt_fr.qm
|
||||||
|
${QT_TR_DIR}/qt_gl.qm
|
||||||
|
${QT_TR_DIR}/qt_he.qm
|
||||||
|
${QT_TR_DIR}/qt_hu.qm
|
||||||
|
${QT_TR_DIR}/qt_it.qm
|
||||||
|
${QT_TR_DIR}/qt_ja.qm
|
||||||
|
${QT_TR_DIR}/qt_ko.qm
|
||||||
|
${QT_TR_DIR}/qt_lt.qm
|
||||||
|
${QT_TR_DIR}/qt_nl.qm
|
||||||
|
${QT_TR_DIR}/qt_pl.qm
|
||||||
|
${QT_TR_DIR}/qt_pt.qm
|
||||||
|
${QT_TR_DIR}/qt_pt_BR.qm
|
||||||
|
${QT_TR_DIR}/qt_ru.qm
|
||||||
|
${QT_TR_DIR}/qt_sk.qm
|
||||||
|
${QT_TR_DIR}/qt_sv.qm
|
||||||
|
${QT_TR_DIR}/qt_tr.qm
|
||||||
|
${QT_TR_DIR}/qt_uk.qm
|
||||||
|
${QT_TR_DIR}/qt_zh_CN.qm
|
||||||
|
${QT_TR_DIR}/qt_zh_TW.qm
|
||||||
|
)
|
||||||
|
list(APPEND QBT_APP_RESOURCE_SOURCE ${QT_TRANSLATIONS})
|
||||||
|
set_source_files_properties(${QT_TRANSLATIONS}
|
||||||
|
PROPERTIES MACOSX_PACKAGE_LOCATION translations)
|
||||||
|
endif (APPLE)
|
||||||
|
|
||||||
if (GUI)
|
add_executable(${QBT_TARGET_NAME} ${QBT_APP_HEADERS} ${QBT_APP_SOURCES} ${QBT_QM_FILES} ${QBT_APP_RESOURCE_SOURCE})
|
||||||
if (WIN32)
|
set_target_properties(${QBT_TARGET_NAME}
|
||||||
set_target_properties(${QBT_TARGET_NAME} PROPERTIES WIN32_EXECUTABLE True)
|
PROPERTIES
|
||||||
endif (WIN32)
|
AUTOUIC True
|
||||||
if (APPLE)
|
MACOSX_BUNDLE True
|
||||||
set_target_properties(${QBT_TARGET_NAME} PROPERTIES MACOSX_BUNDLE True)
|
)
|
||||||
endif (APPLE)
|
|
||||||
endif (GUI)
|
if (GUI AND WIN32)
|
||||||
|
set_target_properties(${QBT_TARGET_NAME} PROPERTIES WIN32_EXECUTABLE True)
|
||||||
|
endif (GUI AND WIN32)
|
||||||
|
|
||||||
target_link_libraries(${QBT_TARGET_NAME} ${QBT_TARGET_LIBRARIES})
|
target_link_libraries(${QBT_TARGET_NAME} ${QBT_TARGET_LIBRARIES})
|
||||||
|
|
||||||
@ -120,5 +168,20 @@ else (SYSTEM_QTSINGLEAPPLICATION)
|
|||||||
target_link_libraries(${QBT_TARGET_NAME} qtsingleapplication)
|
target_link_libraries(${QBT_TARGET_NAME} qtsingleapplication)
|
||||||
endif (SYSTEM_QTSINGLEAPPLICATION)
|
endif (SYSTEM_QTSINGLEAPPLICATION)
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
set(qbt_BUNDLE_NAME "${CMAKE_PROJECT_NAME}")
|
||||||
|
set_target_properties(${QBT_TARGET_NAME} PROPERTIES
|
||||||
|
MACOSX_BUNDLE_BUNDLE_NAME "${qbt_BUNDLE_NAME}"
|
||||||
|
MACOSX_BUNDLE_INFO_PLIST ${qBittorrent_SOURCE_DIR}/dist/mac/Info.plist
|
||||||
|
)
|
||||||
|
endif (APPLE)
|
||||||
|
|
||||||
# installation
|
# installation
|
||||||
install(TARGETS ${QBT_TARGET_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime)
|
install(TARGETS ${QBT_TARGET_NAME}
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
BUNDLE DESTINATION .
|
||||||
|
COMPONENT runtime)
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
install(SCRIPT ${OSX_RES_SRC_DIR}/bundle.cmake)
|
||||||
|
endif (APPLE)
|
||||||
|
@ -124,3 +124,8 @@ else (QT4_FOUND)
|
|||||||
target_link_libraries(qbt_base Qt5::Gui Qt5::Widgets)
|
target_link_libraries(qbt_base Qt5::Gui Qt5::Widgets)
|
||||||
endif (GUI)
|
endif (GUI)
|
||||||
endif (QT4_FOUND)
|
endif (QT4_FOUND)
|
||||||
|
if (APPLE)
|
||||||
|
find_library(IOKit_LIBRARY IOKit)
|
||||||
|
find_library(Carbon_LIBRARY Carbon)
|
||||||
|
target_link_libraries(qbt_base ${Carbon_LIBRARY} ${IOKit_LIBRARY})
|
||||||
|
endif (APPLE)
|
||||||
|
Loading…
Reference in New Issue
Block a user