2015-12-05 22:56:32 +01:00
|
|
|
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
|
|
|
|
2015-12-08 08:41:06 +01:00
|
|
|
# add project files
|
|
|
|
set(HEADER_FILES
|
|
|
|
application/main.h
|
|
|
|
application/utils.h
|
|
|
|
cli/clidownloadinteraction.h
|
|
|
|
cli/mainfeatures.h
|
|
|
|
model/downloadfinderresultsmodel.h
|
|
|
|
model/downloadmodel.h
|
|
|
|
network/authenticationcredentials.h
|
|
|
|
network/bitsharedownload.h
|
|
|
|
network/download.h
|
|
|
|
network/downloadrange.h
|
|
|
|
network/filenukedownload.h
|
|
|
|
network/finder/downloadfinder.h
|
|
|
|
network/finder/groovesharksearcher.h
|
|
|
|
network/finder/linkfinder.h
|
|
|
|
network/finder/youtubeplaylist.h
|
|
|
|
network/groovesharkdownload.h
|
|
|
|
network/httpdownload.h
|
|
|
|
network/httpdownloadwithinforequst.h
|
|
|
|
network/misc/contentdispositionparser.h
|
|
|
|
network/optiondata.h
|
|
|
|
network/permissionstatus.h
|
|
|
|
network/socksharedownload.h
|
|
|
|
network/spotifydownload.h
|
|
|
|
network/testdownload.h
|
|
|
|
network/vimeodownload.h
|
|
|
|
network/youtubedownload.h
|
|
|
|
)
|
|
|
|
set(SRC_FILES
|
|
|
|
application/main.cpp
|
|
|
|
application/utils.cpp
|
|
|
|
cli/clidownloadinteraction.cpp
|
|
|
|
cli/mainfeatures.cpp
|
|
|
|
model/downloadfinderresultsmodel.cpp
|
|
|
|
model/downloadmodel.cpp
|
|
|
|
network/bitsharedownload.cpp
|
|
|
|
network/download.cpp
|
|
|
|
network/downloadrange.cpp
|
|
|
|
network/filenukedownload.cpp
|
|
|
|
network/finder/downloadfinder.cpp
|
|
|
|
network/finder/groovesharksearcher.cpp
|
|
|
|
network/finder/linkfinder.cpp
|
|
|
|
network/finder/youtubeplaylist.cpp
|
|
|
|
network/groovesharkdownload.cpp
|
|
|
|
network/httpdownload.cpp
|
|
|
|
network/httpdownloadwithinforequst.cpp
|
|
|
|
network/misc/contentdispositionparser.cpp
|
|
|
|
network/optiondata.cpp
|
|
|
|
network/socksharedownload.cpp
|
|
|
|
network/spotifydownload.cpp
|
|
|
|
network/testdownload.cpp
|
|
|
|
network/vimeodownload.cpp
|
|
|
|
network/youtubedownload.cpp
|
|
|
|
|
|
|
|
)
|
|
|
|
set(WIDGETS_HEADER_FILES
|
|
|
|
gui/downloadwidget.h
|
|
|
|
gui/adddownloaddialog.h
|
|
|
|
gui/addmultipledownloadswizard.h
|
|
|
|
gui/downloadinteraction.h
|
|
|
|
gui/initiate.h
|
|
|
|
gui/mainwindow.h
|
|
|
|
gui/setrangedialog.h
|
|
|
|
gui/settings.h
|
|
|
|
model/downloadfinderresultsmodel.h
|
|
|
|
model/downloadmodel.h
|
|
|
|
)
|
|
|
|
set(WIDGETS_SRC_FILES
|
|
|
|
gui/adddownloaddialog.cpp
|
|
|
|
gui/addmultipledownloadswizard.cpp
|
|
|
|
gui/downloadinteraction.cpp
|
|
|
|
gui/downloadwidget.cpp
|
|
|
|
gui/initiate.cpp
|
|
|
|
gui/mainwindow.cpp
|
|
|
|
gui/setrangedialog.cpp
|
|
|
|
gui/settings.cpp
|
|
|
|
itemdelegates/comboboxitemdelegate.cpp
|
|
|
|
itemdelegates/progressbaritemdelegate.cpp
|
|
|
|
resources/icons.qrc
|
|
|
|
)
|
2016-01-25 19:03:29 +01:00
|
|
|
set(WIDGETS_UI_FILES
|
|
|
|
gui/adddownloaddialog.ui
|
|
|
|
gui/downloadwidget.ui
|
|
|
|
gui/setrangedialog.ui
|
|
|
|
gui/mainwindow.ui
|
|
|
|
gui/targetpage.ui
|
|
|
|
gui/proxypage.ui
|
|
|
|
gui/useragentpage.ui
|
|
|
|
)
|
2015-12-08 08:41:06 +01:00
|
|
|
#set(QUICK_HEADER_FILES
|
|
|
|
#)
|
|
|
|
#set(QUICK_SRC_FILES
|
|
|
|
#)
|
|
|
|
#set(TS_FILES
|
|
|
|
# translations/${META_PROJECT_NAME}_de_DE.ts
|
|
|
|
# translations/${META_PROJECT_NAME}_en_US.ts
|
|
|
|
#)
|
|
|
|
|
2015-12-05 22:56:32 +01:00
|
|
|
# meta data
|
|
|
|
set(META_PROJECT_NAME videodownloader)
|
|
|
|
set(META_APP_NAME "Video Downloader")
|
|
|
|
set(META_APP_AUTHOR "Martchus")
|
|
|
|
set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
|
2015-12-08 08:41:06 +01:00
|
|
|
set(META_APP_DESCRIPTION "A video downloader with Qt GUI (currently only YouTube and Vimeo are maintained).")
|
2015-12-05 22:56:32 +01:00
|
|
|
set(META_VERSION_MAJOR 1)
|
2015-12-27 22:51:59 +01:00
|
|
|
set(META_VERSION_MINOR 3)
|
2016-01-21 16:32:27 +01:00
|
|
|
set(META_VERSION_PATCH 1)
|
2015-12-05 22:56:32 +01:00
|
|
|
|
|
|
|
# stringification of meta data
|
|
|
|
set(META_PROJECT_NAME_STR "\"${META_PROJECT_NAME}\"")
|
|
|
|
set(META_APP_NAME_STR "\"${META_APP_NAME}\"")
|
|
|
|
set(META_APP_AUTHOR_STR "\"${META_APP_AUTHOR}\"")
|
|
|
|
set(META_APP_URL_STR "\"${META_APP_URL}\"")
|
2015-12-08 08:41:06 +01:00
|
|
|
set(META_APP_DESCRIPTION_STR "\"${META_APP_DESCRIPTION}\"")
|
|
|
|
set(META_APP_VERSION ${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH})
|
|
|
|
set(META_APP_VERSION_STR "\"${META_APP_VERSION}\"")
|
|
|
|
|
|
|
|
# define project
|
|
|
|
project(${META_PROJECT_NAME})
|
2015-12-05 22:56:32 +01:00
|
|
|
|
|
|
|
# add configuration header
|
2015-12-08 08:41:06 +01:00
|
|
|
configure_file(
|
|
|
|
"${PROJECT_SOURCE_DIR}/resources/config.h.in"
|
|
|
|
"${PROJECT_BINARY_DIR}/resources/config.h"
|
2015-12-05 22:56:32 +01:00
|
|
|
)
|
|
|
|
include_directories("${PROJECT_BINARY_DIR}")
|
|
|
|
|
2015-12-08 08:41:06 +01:00
|
|
|
# set "GUI-type" to WIN32 to hide console under windows
|
|
|
|
if(WIN32)
|
|
|
|
set(GUI_TYPE WIN32)
|
|
|
|
endif(WIN32)
|
2015-12-05 22:56:32 +01:00
|
|
|
|
2015-12-08 08:41:06 +01:00
|
|
|
# add windows resource file
|
|
|
|
if(MINGW)
|
|
|
|
# creation windows icon from png with ffmpeg if available
|
|
|
|
find_program(FFMPEG_BIN ffmpeg avconv)
|
|
|
|
if(FFMPEG_BIN)
|
|
|
|
set(PNG_ICON_PATH "${PROJECT_SOURCE_DIR}/resources/icons/hicolor/128x128/apps/${META_PROJECT_NAME}.png")
|
|
|
|
if(EXISTS ${PNG_ICON_PATH})
|
|
|
|
set(WINDOWS_ICON_PATH "${PROJECT_BINARY_DIR}/${META_PROJECT_NAME}.ico")
|
|
|
|
set(WINDOWS_ICON_RC_ENTRY "IDI_ICON1 ICON DISCARDABLE \"${WINDOWS_ICON_PATH}\"")
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT "${WINDOWS_ICON_PATH}"
|
|
|
|
COMMAND ${FFMPEG_BIN} -y -i "${PNG_ICON_PATH}" -vf crop=iw-20:ih-20:10:10,scale=64:64 "${WINDOWS_ICON_PATH}"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endif(FFMPEG_BIN)
|
|
|
|
# create windows rc file from template
|
|
|
|
set(WINDOWS_EXT "exe")
|
|
|
|
configure_file(
|
|
|
|
"${PROJECT_SOURCE_DIR}/resources/windows.rc.in"
|
|
|
|
"${PROJECT_BINARY_DIR}/resources/windows.rc"
|
|
|
|
)
|
|
|
|
# set windres as resource compiler
|
|
|
|
set(RES_FILES "${PROJECT_BINARY_DIR}/resources/windows.rc")
|
|
|
|
set(CMAKE_RC_COMPILER_INIT windres)
|
|
|
|
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
|
|
|
|
enable_language(RC)
|
|
|
|
endif(MINGW)
|
|
|
|
|
|
|
|
# enable Qt Widgets GUI
|
2015-12-13 20:47:53 +01:00
|
|
|
# disable new ABI (can't catch ios_base::failure with new ABI)
|
2015-12-08 08:41:06 +01:00
|
|
|
add_definitions(
|
|
|
|
-DGUI_QTWIDGETS
|
|
|
|
-DMODEL_UNDO_SUPPORT
|
2015-12-13 20:47:53 +01:00
|
|
|
-D_GLIBCXX_USE_CXX11_ABI=0
|
2015-12-08 08:41:06 +01:00
|
|
|
)
|
2015-12-05 22:56:32 +01:00
|
|
|
|
|
|
|
# check required Qt 5 modules
|
|
|
|
find_package(Qt5Core REQUIRED)
|
|
|
|
find_package(Qt5Gui REQUIRED)
|
|
|
|
find_package(Qt5Widgets REQUIRED)
|
2015-12-08 08:41:06 +01:00
|
|
|
find_package(Qt5LinguistTools REQUIRED)
|
2015-12-05 22:56:32 +01:00
|
|
|
find_package(Qt5Network REQUIRED)
|
|
|
|
|
|
|
|
# enable moc, uic and rcc
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
set(CMAKE_AUTOUIC ON)
|
|
|
|
set(CMAKE_AUTORCC ON)
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
|
2015-12-08 08:41:06 +01:00
|
|
|
# enable lrelease
|
|
|
|
qt5_add_translation(QM_FILES ${TS_FILES})
|
|
|
|
ADD_CUSTOM_TARGET(translations ALL DEPENDS ${QM_FILES})
|
|
|
|
|
2015-12-05 22:56:32 +01:00
|
|
|
# executable and linking
|
2016-01-25 19:03:29 +01:00
|
|
|
add_executable(${META_PROJECT_NAME} ${GUI_TYPE} ${HEADER_FILES} ${SRC_FILES} ${WIDGETS_HEADER_FILES} ${WIDGETS_SRC_FILES} ${WIDGETS_UI_FILES} ${QM_FILES} ${RES_FILES} ${WINDOWS_ICON_PATH})
|
2015-12-05 22:56:32 +01:00
|
|
|
target_link_libraries(${META_PROJECT_NAME} c++utilities qtutilities Qt5::Core Qt5::Widgets Qt5::Network)
|
2015-12-08 08:41:06 +01:00
|
|
|
set_target_properties(${META_PROJECT_NAME} PROPERTIES
|
|
|
|
CXX_STANDARD 11
|
|
|
|
)
|
2015-12-05 22:56:32 +01:00
|
|
|
|
|
|
|
# add install target
|
|
|
|
install(TARGETS ${META_PROJECT_NAME}
|
|
|
|
RUNTIME DESTINATION bin
|
2015-12-08 08:41:06 +01:00
|
|
|
COMPONENT binary
|
2015-12-05 22:56:32 +01:00
|
|
|
)
|
|
|
|
install(FILES resources/icons/hicolor/scalable/apps/${META_PROJECT_NAME}.svg
|
|
|
|
DESTINATION share/icons/hicolor/scalable/apps
|
2015-12-08 08:41:06 +01:00
|
|
|
COMPONENT desktop
|
2015-12-05 22:56:32 +01:00
|
|
|
)
|
|
|
|
install(FILES resources/desktop/applications/${META_PROJECT_NAME}.desktop
|
|
|
|
DESTINATION share/applications
|
2015-12-08 08:41:06 +01:00
|
|
|
COMPONENT desktop
|
|
|
|
)
|
|
|
|
install(FILES ${QM_FILES}
|
|
|
|
DESTINATION share/${META_PROJECT_NAME}/translations
|
|
|
|
COMPONENT localization
|
2015-12-05 22:56:32 +01:00
|
|
|
)
|
|
|
|
install(FILES resources/json/groovesharkauthenticationinfo.json
|
|
|
|
DESTINATION share/${META_PROJECT_NAME}/json
|
2015-12-08 08:41:06 +01:00
|
|
|
COMPONENT config
|
2015-12-05 22:56:32 +01:00
|
|
|
)
|
|
|
|
install(FILES resources/json/itaginfo.json
|
|
|
|
DESTINATION share/${META_PROJECT_NAME}/json
|
2015-12-08 08:41:06 +01:00
|
|
|
COMPONENT config
|
|
|
|
)
|
2016-01-21 16:32:27 +01:00
|
|
|
if(NOT TARGET install-binary)
|
|
|
|
add_custom_target(install-binary
|
|
|
|
DEPENDS ${META_PROJECT_NAME}
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=binary -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
if(NOT TARGET install-desktop)
|
|
|
|
add_custom_target(install-desktop
|
|
|
|
DEPENDS ${META_PROJECT_NAME}
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=desktop -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
if(NOT TARGET install-localization)
|
|
|
|
add_custom_target(install-localization
|
|
|
|
DEPENDS ${META_PROJECT_NAME}
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=localization -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
if(NOT TARGET install-config)
|
|
|
|
add_custom_target(install-config
|
|
|
|
DEPENDS ${META_PROJECT_NAME}
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_COMPONENT=config -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
if(NOT TARGET install-mingw-w64)
|
|
|
|
add_custom_target(install-mingw-w64
|
|
|
|
DEPENDS install-binary install-localization install-config
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
if(NOT TARGET install-binary-strip)
|
|
|
|
add_custom_target(install-binary-strip
|
|
|
|
DEPENDS ${META_PROJECT_NAME}
|
|
|
|
COMMAND "${CMAKE_COMMAND}" -DCMAKE_INSTALL_DO_STRIP=1 -DCMAKE_INSTALL_COMPONENT=binary -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
if(NOT TARGET install-mingw-w64-strip)
|
|
|
|
add_custom_target(install-mingw-w64-strip
|
|
|
|
DEPENDS install-binary-strip install-localization install-config
|
|
|
|
)
|
|
|
|
endif()
|