add basic cmake support

This commit is contained in:
Eugene Shalygin 2015-11-06 19:03:18 +01:00 committed by Eugene Shalygin
parent 654c8edc6b
commit 64daecb266
26 changed files with 1242 additions and 0 deletions

65
CMakeLists.txt Normal file
View File

@ -0,0 +1,65 @@
cmake_minimum_required(VERSION 3.2)
cmake_policy(VERSION 3.2)
project(qBittorrent VERSION 3.4.0.0)
set(VER_MAJOR ${qBittorrent_VERSION_MAJOR})
set(VER_MINOR ${qBittorrent_VERSION_MINOR})
set(VER_BUGFIX ${qBittorrent_VERSION_PATCH})
set(VER_BUILD ${qBittorrent_VERSION_TWEAK})
set(VER_STATUS "alpha") # Should be empty for stable releases!
# Don't touch the rest part
set(PROJECT_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_BUGFIX}")
if (NOT VER_BUILD EQUAL 0)
set(PROJECT_VERSION "${PROJECT_VERSION}.${VER_BUILD}")
endif()
set(PROJECT_VERSION "${PROJECT_VERSION}${VER_STATUS}")
add_definitions(-DVERSION_MAJOR=${VER_MAJOR})
add_definitions(-DVERSION_MINOR=${VER_MINOR})
add_definitions(-DVERSION_BUGFIX=${VER_BUGFIX})
add_definitions(-DVERSION_BUILD=${VER_BUILD})
# os2 {
# DEFINES += VERSION=\'\"v$${PROJECT_VERSION}\"\'
# } else {
add_definitions(-DVERSION="v${PROJECT_VERSION}")
# }
list(APPEND CMAKE_MODULE_PATH ${qBittorrent_SOURCE_DIR}/cmake/Modules)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og")
if (UNIX AND NOT APPLE)
include(GNUInstallDirs)
endif (UNIX AND NOT APPLE)
if(WIN32)
include(winconf)
endif(WIN32)
# we need options here, because they are used not only in "src" subdir, but in the "dist" dir too
include(CMakeDependentOption)
option(QT5 "Compile using Qt5" ON)
option(SYSTEM_QTSINGLEAPPLICATION
"Use the system qtsingleapplication library or shipped one otherwise")
cmake_dependent_option(SYSTEM_QJSON
"Use the shipped qjson library or the system one (Qt4 only)" OFF "NOT QT5" OFF)
option(GUI "Allows to disable GUI for headless running. Disables QtDBus and the GeoIP Database" ON)
option(WEBUI "Allows to disable the WebUI." ON)
if (WIN32)
option(STACKTRACE_WIN "")
else (WIN32)
cmake_dependent_option(SYSTEMD "Install the systemd service file (headless only)" OFF
"NOT GUI" OFF)
cmake_dependent_option(DBUS "Enable use of QtDBus (GUI only)" ON "GUI" OFF)
endif(WIN32)
add_subdirectory(src)
add_subdirectory(dist)

View File

@ -0,0 +1,93 @@
# - Try to find libtorrent-rasterbar
#
# If not using pkg-config, you can pre-set LibtorrentRasterbar_CUSTOM_DEFINITIONS
# for definitions unrelated to Boost's separate compilation (which are already
# decided by the LibtorrentRasterbar_USE_STATIC_LIBS variable).
#
# Once done this will define
# LibtorrentRasterbar_FOUND - System has libtorrent-rasterbar
# LibtorrentRasterbar_INCLUDE_DIRS - The libtorrent-rasterbar include directories
# LibtorrentRasterbar_LIBRARIES - The libraries needed to use libtorrent-rasterbar
# LibtorrentRasterbar_DEFINITIONS - Compiler switches required for using libtorrent-rasterbar
# LibtorrentRasterbar_OPENSSL_ENABLED - libtorrent-rasterbar uses and links against OpenSSL
find_package(Threads REQUIRED)
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_LIBTORRENT_RASTERBAR QUIET libtorrent-rasterbar)
endif()
if(LibtorrentRasterbar_USE_STATIC_LIBS)
set(LibtorrentRasterbar_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()
if(PC_LIBTORRENT_RASTERBAR_FOUND)
set(LibtorrentRasterbar_DEFINITIONS ${PC_LIBTORRENT_RASTERBAR_CFLAGS})
else()
if(LibtorrentRasterbar_CUSTOM_DEFINITIONS)
set(LibtorrentRasterbar_DEFINITIONS ${LibtorrentRasterbar_CUSTOM_DEFINITIONS})
else()
# Without pkg-config, we can't possibly figure out the correct build flags.
# libtorrent is very picky about those. Let's take a set of defaults and
# hope that they apply. If not, you the user are on your own.
set(LibtorrentRasterbar_DEFINITIONS
-DTORRENT_USE_OPENSSL
-DTORRENT_DISABLE_GEO_IP
-DBOOST_ASIO_ENABLE_CANCELIO
-DUNICODE -D_UNICODE -D_FILE_OFFSET_BITS=64)
endif()
if(NOT LibtorrentRasterbar_USE_STATIC_LIBS)
list(APPEND LibtorrentRasterbar_DEFINITIONS
-DTORRENT_LINKING_SHARED
-DBOOST_SYSTEM_DYN_LINK -DBOOST_CHRONO_DYN_LINK)
endif()
endif()
message(STATUS "libtorrent definitions: ${LibtorrentRasterbar_DEFINITIONS}")
find_path(LibtorrentRasterbar_INCLUDE_DIR libtorrent
HINTS ${PC_LIBTORRENT_RASTERBAR_INCLUDEDIR} ${PC_LIBTORRENT_RASTERBAR_INCLUDE_DIRS}
PATH_SUFFIXES libtorrent-rasterbar)
find_library(LibtorrentRasterbar_LIBRARY NAMES torrent-rasterbar libtorrent
HINTS ${PC_LIBTORRENT_RASTERBAR_LIBDIR} ${PC_LIBTORRENT_RASTERBAR_LIBRARY_DIRS})
if(LibtorrentRasterbar_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${LibtorrentRasterbar_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
endif()
set(LibtorrentRasterbar_LIBRARIES ${LibtorrentRasterbar_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
set(LibtorrentRasterbar_INCLUDE_DIRS ${LibtorrentRasterbar_INCLUDE_DIR})
if(NOT Boost_SYSTEM_FOUND OR NOT Boost_CHRONO_FOUND OR NOT Boost_RANDOM_FOUND)
find_package(Boost REQUIRED COMPONENTS date_time system chrono random thread)
set(LibtorrentRasterbar_LIBRARIES
${LibtorrentRasterbar_LIBRARIES} ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
set(LibtorrentRasterbar_INCLUDE_DIRS
${LibtorrentRasterbar_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
endif()
list(FIND LibtorrentRasterbar_DEFINITIONS -DTORRENT_USE_OPENSSL LibtorrentRasterbar_ENCRYPTION_INDEX)
if(LibtorrentRasterbar_ENCRYPTION_INDEX GREATER -1)
find_package(OpenSSL REQUIRED)
set(LibtorrentRasterbar_LIBRARIES ${LibtorrentRasterbar_LIBRARIES} ${OPENSSL_LIBRARIES})
set(LibtorrentRasterbar_INCLUDE_DIRS ${LibtorrentRasterbar_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIRS})
set(LibtorrentRasterbar_OPENSSL_ENABLED ON)
endif()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LibtorrentRasterbar_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(LibtorrentRasterbar DEFAULT_MSG
LibtorrentRasterbar_LIBRARY
LibtorrentRasterbar_INCLUDE_DIR
Boost_SYSTEM_FOUND
Boost_CHRONO_FOUND
Boost_RANDOM_FOUND)
mark_as_advanced(LibtorrentRasterbar_INCLUDE_DIR LibtorrentRasterbar_LIBRARY
LibtorrentRasterbar_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES
LibtorrentRasterbar_ENCRYPTION_INDEX)

View File

@ -0,0 +1,76 @@
# - Try to find the QtSingleApplication includes and library
# which defines
#
# QTSINGLEAPPLICATION_FOUND - system has QtSingleApplication
# QTSINGLEAPPLICATION_INCLUDE_DIR - where to find header QtSingleApplication
# QTSINGLEAPPLICATION_LIBRARIES - the libraries to link against to use QtSingleApplication
# QTSINGLEAPPLICATION_LIBRARY - where to find the QtSingleApplication library (not for general use)
# copyright (c) 2013 TI_Eugene ti.eugene@gmail.com
#
# Redistribution and use is allowed according to the terms of the FreeBSD license.
SET(QTSINGLEAPPLICATION_FOUND FALSE)
IF(QT4_FOUND)
FIND_PATH(QTSINGLEAPPLICATION_INCLUDE_DIR QtSingleApplication
# standard locations
/usr/include
/usr/include/QtSolutions
# qt4 location except mac's frameworks
"${QT_INCLUDE_DIR}/QtSolutions"
# mac's frameworks
${FRAMEWORK_INCLUDE_DIR}/QtSolutions
)
SET(QTSINGLEAPPLICATION_NAMES ${QTSINGLEAPPLICATION_NAMES} QtSolutions_SingleApplication-2.6 libQtSolutions_SingleApplication-2.6)
FIND_LIBRARY(QTSINGLEAPPLICATION_LIBRARY
NAMES ${QTSINGLEAPPLICATION_NAMES}
PATHS ${QT_LIBRARY_DIR}
)
ELSEIF(Qt5Widgets_FOUND)
FOREACH(TOP_INCLUDE_PATH in ${Qt5Widgets_INCLUDE_DIRS} ${FRAMEWORK_INCLUDE_DIR})
FIND_PATH(QTSINGLEAPPLICATION_INCLUDE_DIR QtSingleApplication ${TOP_INCLUDE_PATH}/QtSolutions)
IF(QTSINGLEAPPLICATION_INCLUDE_DIR)
BREAK()
ENDIF()
ENDFOREACH()
SET(QTSINGLEAPPLICATION_NAMES ${QTSINGLEAPPLICATION_NAMES} QtSolutions_SingleApplication-2.6 libQtSolutions_SingleApplication-2.6)
GET_TARGET_PROPERTY(QT5_WIDGETSLIBRARY Qt5::Widgets LOCATION)
GET_FILENAME_COMPONENT(QT5_WIDGETSLIBRARYPATH ${QT5_WIDGETSLIBRARY} PATH)
FIND_LIBRARY(QTSINGLEAPPLICATION_LIBRARY
NAMES ${QTSINGLEAPPLICATION_NAMES}
PATHS ${QT5_WIDGETSLIBRARYPATH}
)
ENDIF()
IF (QTSINGLEAPPLICATION_LIBRARY AND QTSINGLEAPPLICATION_INCLUDE_DIR)
SET(QTSINGLEAPPLICATION_LIBRARIES ${QTSINGLEAPPLICATION_LIBRARY})
SET(QTSINGLEAPPLICATION_FOUND TRUE)
IF (CYGWIN)
IF(BUILD_SHARED_LIBS)
# No need to define QTSINGLEAPPLICATION_USE_DLL here, because it's default for Cygwin.
ELSE(BUILD_SHARED_LIBS)
SET (QTSINGLEAPPLICATION_DEFINITIONS -DQTSINGLEAPPLICATION_STATIC)
ENDIF(BUILD_SHARED_LIBS)
ENDIF (CYGWIN)
ENDIF (QTSINGLEAPPLICATION_LIBRARY AND QTSINGLEAPPLICATION_INCLUDE_DIR)
IF (QTSINGLEAPPLICATION_FOUND)
IF (NOT QtSingleApplication_FIND_QUIETLY)
MESSAGE(STATUS "Found QtSingleApplication: ${QTSINGLEAPPLICATION_LIBRARY}")
MESSAGE(STATUS " includes: ${QTSINGLEAPPLICATION_INCLUDE_DIR}")
ENDIF (NOT QtSingleApplication_FIND_QUIETLY)
ELSE (QTSINGLEAPPLICATION_FOUND)
IF (QtSingleApplication_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find QtSingleApplication library")
ENDIF (QtSingleApplication_FIND_REQUIRED)
ENDIF (QTSINGLEAPPLICATION_FOUND)
MARK_AS_ADVANCED(QTSINGLEAPPLICATION_INCLUDE_DIR QTSINGLEAPPLICATION_LIBRARY)

View File

@ -0,0 +1,23 @@
#######
# Find systemd service dir
# sets variables
# SYSTEMD_FOUND
# SYSTEMD_SERVICES_INSTALL_DIR
if (NOT SYSTEMD_FOUND)
pkg_check_modules(SYSTEMD "systemd")
endif(NOT SYSTEMD_FOUND)
if (SYSTEMD_FOUND AND "${SYSTEMD_SERVICES_INSTALL_DIR}" STREQUAL "")
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE}
--variable=systemdsystemunitdir systemd
OUTPUT_VARIABLE SYSTEMD_SERVICES_INSTALL_DIR)
string(REGEX REPLACE "[ \t\n]+" "" SYSTEMD_SERVICES_INSTALL_DIR
"${SYSTEMD_SERVICES_INSTALL_DIR}")
elseif (NOT SYSTEMD_FOUND AND SYSTEMD_SERVICES_INSTALL_DIR)
message (FATAL_ERROR "Variable SYSTEMD_SERVICES_INSTALL_DIR is\
defined, but we can't find systemd using pkg-config")
endif()
if (SYSTEMD_FOUND)
message(STATUS "systemd services install dir: ${SYSTEMD_SERVICES_INSTALL_DIR}")
endif(SYSTEMD_FOUND)

View File

@ -0,0 +1,38 @@
macro(configure_msvc_runtime)
if(MSVC)
# Default to statically-linked runtime.
if("${MSVC_RUNTIME}" STREQUAL "")
set(MSVC_RUNTIME "static")
endif()
# Set compiler options.
set(variables
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
)
if(${MSVC_RUNTIME} STREQUAL "static")
message(STATUS
"MSVC -> forcing use of statically-linked runtime."
)
foreach(variable ${variables})
if(${variable} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${variable} "${${variable}}")
endif()
endforeach()
else()
message(STATUS
"MSVC -> forcing use of dynamically-linked runtime."
)
foreach(variable ${variables})
if(${variable} MATCHES "/MT")
string(REGEX REPLACE "/MT" "/MD" ${variable} "${${variable}}")
endif()
endforeach()
endif()
endif()
endmacro()

View File

@ -0,0 +1,16 @@
# - macro similar to target_link_libraries, which links Qt components
# names of the components are pased in Qt4/Qt5 agnostic way (Core, DBus, Xml...)
# and the macro links Qt4 ones if QT4_FOUND is set or Qt5 ones if not
macro (target_link_qt_components target)
if (QT4_FOUND)
foreach(_cmp ${ARGN})
list(APPEND _QT_CMPNTS "Qt4::Qt${_cmp}")
endforeach()
else (QT4_FOUND)
foreach(_cmp ${ARGN})
list(APPEND _QT_CMPNTS "Qt5::${_cmp}")
endforeach()
endif (QT4_FOUND)
target_link_libraries(${target} ${_QT_CMPNTS})
endmacro()

View File

@ -0,0 +1,14 @@
if (STACKTRACE_WIN)
if ("${WINXXBITS}" NOT STREQUAL "Win64")
add_compile_options(-fno-omit-frame-pointer)
endif ("${WINXXBITS}" NOT STREQUAL "Win64")
link_libraries(libdbghelp -Wl,--export-all-symbols)
endif (STACKTRACE_WIN)
if (("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") OR ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo"))
link_libraries(-Wl,--dynamicbase)
endif()
# LIBS += libadvapi32 libshell32 libuser32
# LIBS += libcrypto.dll libssl.dll libwsock32 libws2_32 libz libiconv.dll
# LIBS += libpowrprof

View File

@ -0,0 +1,21 @@
if (STACKTRACE_WIN)
if ("${WINXXBITS}" STREQUAL "Win64")
add_compile_options(-Zi)
else ("${WINXXBITS}" STREQUAL "Win64")
# i686 arch requires frame pointer preservation
add_compile_options(-Oy-)
endif ("${WINXXBITS}" STREQUAL "Win64")
link_libraries(dbghelp.lib)
endif (STACKTRACE_WIN)
# Enable Wide characters
add_definitions(-DTORRENT_USE_WPATH)
if (NOT QT5)
# Qt4 does not detect it itself
add_definitions(-DQ_COMPILER_INITIALIZER_LISTS)
endif (NOT QT5)
include(MacroConfigureMSVCRuntime)
set(MSVC_RUNTIME "dynamic")
configure_msvc_runtime()

View File

@ -0,0 +1,86 @@
# Settings for compiling qBittorrent on Windows
# We want to link with static version of
# libtorrent
set(LibtorrentRasterbar_USE_STATIC_LIBS True)
set(LibtorrentRasterbar_CUSTOM_DEFINITIONS
-DBOOST_ALL_NO_LIB -DBOOST_ASIO_HASH_MAP_BUCKETS=1021
-DBOOST_ASIO_SEPARATE_COMPILATION
-DBOOST_EXCEPTION_DISABLE
-DBOOST_SYSTEM_STATIC_LINK=1
-DTORRENT_USE_OPENSSL
-DUNICODE
-D_UNICODE
-DWIN32
-D_WIN32
-DWIN32_LEAN_AND_MEAN
-D_WIN32_WINNT=0x0501
-D_WIN32_IE=0x0500
-D_CRT_SECURE_NO_DEPRECATE
-D_SCL_SECURE_NO_DEPRECATE
-D__USE_W32_SOCKETS
-D_FILE_OFFSET_BITS=64)
# and boost
set(Boost_USE_STATIC_LIBS True)
# set(Boost_USE_STATIC_RUNTIME True)
# Here we assume that all required libraries are installed into the same prefix
# with usual unix subdirectories (bin, lib, include)
# if so, we just need to set CMAKE_SYSTEM_PREFIX_PATH
# If it is not the case, individual paths need to be specified manually (see below)
set(COMMON_INSTALL_PREFIX "c:/usr")
list(APPEND CMAKE_SYSTEM_PREFIX_PATH "${COMMON_INSTALL_PREFIX}")
# If two version of Qt are installed, separate prefixes are needed most likely
set(QT4_INSTALL_PREFIX "${COMMON_INSTALL_PREFIX}/lib/qt4")
set(QT5_INSTALL_PREFIX "${COMMON_INSTALL_PREFIX}/lib/qt5")
# it is safe to set Qt dirs even if their files are directly in the prefix
# Qt4
if(NOT QT5)
LIST(APPEND CMAKE_PROGRAM_PATH "${QT4_INSTALL_PREFIX}/bin/")
endif(NOT QT5)
# Qt5
set(Qt5_DIR "${QT5_INSTALL_PREFIX}/lib/cmake/Qt5")
# And now we can set specific values for the Boost and libtorrent libraries.
# The following values are generated from the paths listed above just for an example
# they have to be set to actual locations
# Boost
# set(BOOST_ROOT "${COMMON_INSTALL_PREFIX}")
# set(Boost_version_suffix "1_59")
# if a link like boost-version/boost -> boost was created or the boost directory was renamed in the same way,
# the following needs adjustment
# set(BOOST_INCLUDEDIR "${COMMON_INSTALL_PREFIX}/include/boost-${Boost_version_suffix}")
# set(BOOST_LIBRARYDIR "${COMMON_INSTALL_PREFIX}/lib/")
# libtorrent
# set(PC_LIBTORRENT_RASTERBAR_INCLUDEDIR "${COMMON_INSTALL_PREFIX}")
# set(PC_LIBTORRENT_RASTERBAR_LIBDIR "${COMMON_INSTALL_PREFIX}/lib")
set(AUTOGEN_TARGETS_FOLDER "generated")
set(CMAKE_INSTALL_BINDIR ".")
# Test 32/64 bits
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
message(STATUS "Target is 64 bits")
if (WIN32)
set(WINXXBITS Win64)
endif(WIN32)
else("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
message(STATUS "Target is 32 bits")
if (WIN32)
set(WINXXBITS Win32)
endif(WIN32)
endif("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
if (MSVC)
include(winconf-msvc)
else (MSVC)
include(winconf-mingw)
endif (MSVC)

10
dist/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,10 @@
if (APPLE)
add_subdirectory(mac)
else (APPLE)
if (UNIX)
add_subdirectory(unix)
endif (UNIX)
if (WIN32)
add_subdirectory(windows)
endif (WIN32)
endif (APPLE)

37
dist/unix/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,37 @@
if (SYSTEMD)
find_package(Systemd)
if (SYSTEMD_FOUND)
set(EXPAND_BINDIR ${CMAKE_INSTALL_FULL_BINDIR})
configure_file(systemd/qbittorrent-nox.service.in ${CMAKE_CURRENT_BINARY_DIR}/qbittorrent-nox.service @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qbittorrent-nox.service
DESTINATION ${CMAKE_INSTALL_PREFIX}/${SYSTEMD_SERVICES_INSTALL_DIR}
COMPONENT data)
endif(SYSTEMD_FOUND)
endif(SYSTEMD)
if (GUI)
list(APPEND MAN_FILES ${qBittorrent_SOURCE_DIR}/doc/qbittorrent.1)
else (GUI)
list(APPEND MAN_FILES ${qBittorrent_SOURCE_DIR}/doc/qbittorrent.1)
endif (GUI)
install(FILES ${MAN_FILES}
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
COMPONENT doc)
install(DIRECTORY menuicons/
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor
FILES_MATCHING PATTERN "*.png")
install(FILES ${qBittorrent_SOURCE_DIR}/src/icons/qbittorrent.png
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pixmaps/
COMPONENT data)
install(FILES ${qBittorrent_SOURCE_DIR}/src/icons/qBittorrent.desktop
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications/
COMPONENT data)
install(FILES qBittorrent.appdata.xml
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/appdata/
COMPONENT data)

1
dist/windows/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1 @@
install(FILES qt.conf DESTINATION ${CMAKE_INSTALL_BINDIR})

109
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,109 @@
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_STANDARD "11")
add_definitions(-DBOOST_NO_CXX11_RVALUE_REFERENCES)
include(MacroLinkQtComponents)
find_package(LibtorrentRasterbar REQUIRED)
include_directories(SYSTEM ${LibtorrentRasterbar_INCLUDE_DIRS})
add_compile_options(${LibtorrentRasterbar_DEFINITIONS})
# Boost
set(Boost_USE_MULTITHREADED ON)
find_package(Boost 1.35 REQUIRED COMPONENTS system)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
# Qt
if (QT5)
add_definitions(-DQBT_USES_QT5)
list(APPEND QBT_QT_COMPONENTS Core Network Xml)
if (GUI)
list (APPEND QBT_QT_COMPONENTS Concurrent Gui Widgets)
endif (GUI)
if (DBUS)
list (APPEND QBT_QT_COMPONENTS DBus)
endif (DBUS)
find_package(Qt5 5.5.0 COMPONENTS ${QBT_QT_COMPONENTS} REQUIRED)
else (QT5)
list(APPEND QBT_QT_COMPONENTS QtCore QtNetwork QtXml)
if (GUI)
list (APPEND QBT_QT_COMPONENTS QtGui)
endif (GUI)
if (DBUS)
list (APPEND QBT_QT_COMPONENTS QtDBus)
endif (DBUS)
find_package(Qt4 4.8.7 COMPONENTS ${QBT_QT_COMPONENTS} REQUIRED)
include(${QT_USE_FILE})
endif (QT5)
set(CMAKE_AUTOMOC True)
list(APPEND CMAKE_AUTORCC_OPTIONS -compress 9 -threshold 5)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
# defines
add_definitions(-DQT_NO_CAST_TO_ASCII)
# Fast concatenation (Qt >= 4.6)
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
if (WIN32)
add_definitions(-DNOMINMAX)
endif (WIN32)
if (NOT GUI)
add_definitions(-DDISABLE_GUI -DDISABLE_COUNTRIES_RESOLUTION)
endif (NOT GUI)
if (NOT WEBUI)
add_definitions(-DDISABLE_WEBUI)
endif (NOT WEBUI)
if (STACKTRACE_WIN)
add_definitions(-DSTACKTRACE_WIN)
endif(STACKTRACE_WIN)
# nogui {
# TARGET = qbittorrent-nox
# } else {
# CONFIG(static) {
# DEFINES += QBT_STATIC_QT
# QTPLUGIN += qico
# }
# TARGET = qbittorrent
# }
if (UNIX AND NOT APPLE)
add_compile_options(-Wformat -Wformat-security)
endif ()
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Project is built in DEBUG mode.")
else (CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Project is built in RELEASE mode.")
message(STATUS "Disabling debug output.")
add_definitions(-DQT_NO_DEBUG_OUTPUT)
endif (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(QBT_USE_GUI ${GUI})
set(QBT_USE_WEBUI ${WEBUI})
set(QBT_USES_QT5 ${QT5})
configure_file(config.h.cmakein ${CMAKE_CURRENT_BINARY_DIR}/config.h)
add_subdirectory(base)
if (SYSTEM_QTSINGLEAPPLICATION)
find_package(QtSingleApplication REQUIRED)
include_directories(${QTSINGLEAPPLICATION_INCLUDE_DIR})
else (SYSTEM_QTSINGLEAPPLICATION)
include_directories(app/qtsingleapplication)
endif (SYSTEM_QTSINGLEAPPLICATION)
if (GUI)
add_subdirectory(gui)
endif (GUI)
if (WEBUI)
add_subdirectory(webui)
endif (WEBUI)
add_subdirectory(app)

122
src/app/CMakeLists.txt Normal file
View File

@ -0,0 +1,122 @@
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(QBT_APP_HEADERS
application.h
)
set(QBT_APP_SOURCES
application.cpp
main.cpp
)
# translations
file(GLOB QBT_TS_FILES ../lang/*.ts)
get_filename_component(QBT_QM_FILES_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/../lang" ABSOLUTE)
set_source_files_properties(${QBT_TS_FILES} PROPERTIES OUTPUT_LOCATION "${QBT_QM_FILES_BINARY_DIR}")
if (QT5)
find_package(Qt5 COMPONENTS LinguistTools REQUIRED)
qt5_add_translation(QBT_QM_FILES ${QBT_TS_FILES})
else (QT5)
qt4_add_translation(QBT_QM_FILES ${QBT_TS_FILES})
endif (QT5)
get_filename_component(_lang_qrc_src "${CMAKE_CURRENT_SOURCE_DIR}/../lang.qrc" ABSOLUTE)
get_filename_component(_lang_qrc_dst "${CMAKE_CURRENT_BINARY_DIR}/../lang.qrc" ABSOLUTE)
get_filename_component(_lang_qrc_dst_dir "${CMAKE_CURRENT_BINARY_DIR}/../" ABSOLUTE)
message(STATUS "copying ${_lang_qrc_src} -> ${_lang_qrc_dst}")
file(COPY ${_lang_qrc_src} DESTINATION ${_lang_qrc_dst_dir})
set_source_files_properties("${_lang_qrc_dst}" PROPERTIES GENERATED True)
foreach(qm_file ${QBT_QM_FILES})
set_source_files_properties("${_lang_qrc_dst}" PROPERTIES OBJECT_DEPENDS ${qm_file})
endforeach()
set(QBT_APP_RESOURCES
../icons.qrc
"${_lang_qrc_dst}"
)
# With AUTORCC rcc is ran by cmake before language files are generated,
# and thus we call rcc explicitly
if (QT5)
qt5_add_resources(QBT_APP_RESOURCE_SOURCE ${QBT_APP_RESOURCES})
else (QT5)
qt4_add_resources(QBT_APP_RESOURCE_SOURCE ${QBT_APP_RESOURCES})
endif (QT5)
if (WIN32)
if (MINGW)
list (APPEND QBT_APP_SOURCES ../qbittorrent_mingw.rc)
else (MINGW)
list (APPEND QBT_APP_SOURCES ../qbittorrent.rc)
endif (MINGW)
endif (WIN32)
if (UNIX)
list(APPEND QBT_APP_HEADERS stacktrace.h)
endif (UNIX)
if (STACKTRACE_WIN)
list(APPEND QBT_APP_HEADERS stacktrace_win.h)
if (GUI)
list(APPEND QBT_APP_HEADERS stacktrace_win_dlg.h)
endif (GUI)
endif (STACKTRACE_WIN)
# usesystemqtsingleapplication {
# nogui {
# CONFIG += qtsinglecoreapplication
# } else {
# CONFIG += qtsingleapplication
# }
# } else {
# nogui {
# include(qtsingleapplication/qtsinglecoreapplication.pri)
# } else {
# include(qtsingleapplication/qtsingleapplication.pri)
# }
# }
# upgrade code
list(APPEND QBT_APP_HEADERS upgrade.h)
list(APPEND QBT_TARGET_LIBRARIES qbt_base)
if (GUI)
set(QBT_TARGET_NAME qbittorrent)
list(APPEND QBT_TARGET_LIBRARIES qbt_searchengine qbt_gui)
include_directories(../gui
${CMAKE_CURRENT_BINARY_DIR}/../gui
)
else (GUI)
set(QBT_TARGET_NAME qbittorrent-nox)
endif (GUI)
if (WEBUI)
list(APPEND QBT_TARGET_LIBRARIES qbt_webui)
endif (WEBUI)
add_executable(${QBT_TARGET_NAME} ${QBT_APP_HEADERS} ${QBT_APP_SOURCES} ${QBT_QM_FILES} ${QBT_APP_RESOURCE_SOURCE})
set_target_properties(${QBT_TARGET_NAME} PROPERTIES AUTOUIC True)
if (GUI)
if (WIN32)
set_target_properties(${QBT_TARGET_NAME} PROPERTIES WIN32_EXECUTABLE True)
endif (WIN32)
if (APPLE)
set_target_properties(${QBT_TARGET_NAME} PROPERTIES MACOSX_BUNDLE True)
endif (APPLE)
endif (GUI)
target_link_libraries(${QBT_TARGET_NAME} ${QBT_TARGET_LIBRARIES})
if (SYSTEM_QTSINGLEAPPLICATION)
target_link_libraries(${QBT_TARGET_NAME} ${QTSINGLEAPPLICATION_LIBRARIES})
else (SYSTEM_QTSINGLEAPPLICATION)
add_subdirectory(qtsingleapplication)
target_link_libraries(${QBT_TARGET_NAME} qtsingleapplication)
endif (SYSTEM_QTSINGLEAPPLICATION)
# installation
install(TARGETS ${QBT_TARGET_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime)

View File

@ -0,0 +1,32 @@
set(QBT_QTSINGLEAPPLICATION_HEADERS
qtlocalpeer.h
)
set(QBT_QTSINGLEAPPLICATION_SOURCES
qtlocalpeer.cpp
)
if (GUI)
list(APPEND QBT_QTSINGLEAPPLICATION_HEADERS qtsingleapplication.h)
list(APPEND QBT_QTSINGLEAPPLICATION_SOURCES qtsingleapplication.cpp)
else (GUI)
list(APPEND QBT_QTSINGLEAPPLICATION_HEADERS qtsinglecoreapplication.h)
list(APPEND QBT_QTSINGLEAPPLICATION_SOURCES qtsinglecoreapplication.cpp)
endif (GUI)
add_library(qtsingleapplication ${QBT_QTSINGLEAPPLICATION_HEADERS} ${QBT_QTSINGLEAPPLICATION_SOURCES})
if (QT4_FOUND)
target_link_libraries(qtsingleapplication Qt4::QtNetwork)
else (QT4_FOUND)
target_link_libraries(qtsingleapplication Qt5::Network)
endif (QT4_FOUND)
if (GUI)
if (QT4_FOUND)
target_link_libraries(qtsingleapplication Qt4::QtGui)
else (QT4_FOUND)
target_link_libraries(qtsingleapplication Qt5::Widgets)
endif(QT4_FOUND)
endif (GUI)

124
src/base/CMakeLists.txt Normal file
View File

@ -0,0 +1,124 @@
find_package(ZLIB REQUIRED)
include_directories(SYSTEM ${ZLIB_INCLUDE_DIRS})
set(QBT_BASE_HEADERS
bittorrent/cachestatus.h
bittorrent/infohash.h
bittorrent/magneturi.h
bittorrent/peerinfo.h
bittorrent/private/bandwidthscheduler.h
bittorrent/private/filterparserthread.h
bittorrent/private/resumedatasavingmanager.h
bittorrent/private/speedmonitor.h
bittorrent/private/statistics.h
bittorrent/session.h
bittorrent/sessionstatus.h
bittorrent/torrentcreatorthread.h
bittorrent/torrenthandle.h
bittorrent/torrentinfo.h
bittorrent/tracker.h
bittorrent/trackerentry.h
http/connection.h
http/irequesthandler.h
http/requestparser.h
http/responsebuilder.h
http/responsegenerator.h
http/server.h
http/types.h
net/dnsupdater.h
net/downloadhandler.h
net/downloadmanager.h
net/geoipmanager.h
net/portforwarder.h
net/private/geoipdatabase.h
net/reverseresolution.h
net/smtp.h
rss/private/rssparser.h
rss/rssarticle.h
rss/rssdownloadrule.h
rss/rssdownloadrulelist.h
rss/rssfeed.h
rss/rssfile.h
rss/rssfolder.h
rss/rssmanager.h
utils/fs.h
utils/gzip.h
utils/misc.h
utils/string.h
filesystemwatcher.h
iconprovider.h
logger.h
preferences.h
qinisettings.h
scanfoldersmodel.h
searchengine.h
torrentfilter.h
tristatebool.h
types.h
unicodestrings.h
)
set(QBT_BASE_SOURCES
bittorrent/cachestatus.cpp
bittorrent/infohash.cpp
bittorrent/magneturi.cpp
bittorrent/peerinfo.cpp
bittorrent/private/bandwidthscheduler.cpp
bittorrent/private/filterparserthread.cpp
bittorrent/private/resumedatasavingmanager.cpp
bittorrent/private/speedmonitor.cpp
bittorrent/private/statistics.cpp
bittorrent/session.cpp
bittorrent/sessionstatus.cpp
bittorrent/torrentcreatorthread.cpp
bittorrent/torrenthandle.cpp
bittorrent/torrentinfo.cpp
bittorrent/tracker.cpp
bittorrent/trackerentry.cpp
http/connection.cpp
http/requestparser.cpp
http/responsebuilder.cpp
http/responsegenerator.cpp
http/server.cpp
net/dnsupdater.cpp
net/downloadhandler.cpp
net/downloadmanager.cpp
net/geoipmanager.cpp
net/portforwarder.cpp
net/private/geoipdatabase.cpp
net/reverseresolution.cpp
net/smtp.cpp
rss/private/rssparser.cpp
rss/rssarticle.cpp
rss/rssdownloadrule.cpp
rss/rssdownloadrulelist.cpp
rss/rssfeed.cpp
rss/rssfile.cpp
rss/rssfolder.cpp
rss/rssmanager.cpp
utils/fs.cpp
utils/gzip.cpp
utils/misc.cpp
utils/string.cpp
filesystemwatcher.cpp
iconprovider.cpp
logger.cpp
preferences.cpp
scanfoldersmodel.cpp
searchengine.cpp
torrentfilter.cpp
tristatebool.cpp
)
add_library(qbt_base STATIC ${QBT_BASE_HEADERS} ${QBT_BASE_SOURCES})
target_link_libraries(qbt_base ${ZLIB_LIBRARIES} ${LibtorrentRasterbar_LIBRARIES})
target_link_qt_components(qbt_base Core Network Xml)
if (QT4_FOUND)
if (GUI)
target_link_libraries(qbt_base Qt4::QtGui)
endif (GUI)
else (QT4_FOUND)
if (GUI)
target_link_libraries(qbt_base Qt5::Gui Qt5::Widgets)
endif (GUI)
endif (QT4_FOUND)

15
src/config.h.cmakein Normal file
View File

@ -0,0 +1,15 @@
#cmakedefine QBT_USES_QT5
#cmakedefine QBT_USE_GUI
#ifndef QBT_USE_GUI
#define DISABLE_GUI
#define DISABLE_COUNTRIES_RESOLUTION
#endif
#cmakedefine QBT_USE_WEBUI
#ifndef QBT_USE_WEBUI
#define DISABLE_WEBUI
#endif
#cmakedefine STACKTRACE_WIN

128
src/gui/CMakeLists.txt Normal file
View File

@ -0,0 +1,128 @@
set(CMAKE_AUTORCC True)
set(CMAKE_AUTOUIC True)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(lineedit)
add_subdirectory(properties)
add_subdirectory(powermanagement)
add_subdirectory(rss)
add_subdirectory(search)
if (UNIX AND NOT APPLE AND DBUS)
add_subdirectory(qtnotify)
include_directories(qtnotify)
list(APPEND QBT_GUI_OPTIONAL_LINK_LIBRARIES qbt_qtnotify)
endif (UNIX AND NOT APPLE AND DBUS)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}/properties
${CMAKE_CURRENT_BINARY_DIR}/rss
${CMAKE_CURRENT_BINARY_DIR}/search
lineedit/src
powermanagement
properties
rss
../app
)
set(QBT_GUI_HEADERS
about_imp.h
addnewtorrentdialog.h
advancedsettings.h
advancedsettings.h
autoexpandabledialog.h
deletionconfirmationdlg.h
downloadfromurldlg.h
executionlog.h
guiiconprovider.h
hidabletabwidget.h
ico.h
loglistwidget.h
mainwindow.h
messageboxraised.h
options_imp.h
previewlistdelegate.h
previewselect.h
scanfoldersdelegate.h
shutdownconfirm.h
speedlimitdlg.h
statsdialog.h
statusbar.h
torrentcontentfiltermodel.h
torrentcontentmodel.h
torrentcontentmodelfile.h
torrentcontentmodelfolder.h
torrentcontentmodelitem.h
torrentcontenttreeview.h
torrentcreatordlg.h
torrentimportdlg.h
torrentmodel.h
trackerlogin.h
transferlistdelegate.h
transferlistfilterswidget.h
transferlistsortmodel.h
transferlistwidget.h
updownratiodlg.h
)
set(QBT_GUI_SOURCES
addnewtorrentdialog.cpp
advancedsettings.cpp
autoexpandabledialog.cpp
executionlog.cpp
guiiconprovider.cpp
ico.cpp
loglistwidget.cpp
mainwindow.cpp
messageboxraised.cpp
options_imp.cpp
previewselect.cpp
scanfoldersdelegate.cpp
shutdownconfirm.cpp
speedlimitdlg.cpp
statsdialog.cpp
statusbar.cpp
torrentcontentfiltermodel.cpp
torrentcontentmodel.cpp
torrentcontentmodelfile.cpp
torrentcontentmodelfolder.cpp
torrentcontentmodelitem.cpp
torrentcontenttreeview.cpp
torrentcreatordlg.cpp
torrentimportdlg.cpp
torrentmodel.cpp
trackerlogin.cpp
transferlistdelegate.cpp
transferlistfilterswidget.cpp
transferlistsortmodel.cpp
transferlistwidget.cpp
updownratiodlg.cpp
)
if (WIN32 OR APPLE)
list(APPEND QBT_GUI_HEADERS programupdater.h)
list(APPEND QBT_GUI_SOURCES programupdater.cpp)
endif (WIN32 OR APPLE)
set(QBT_GUI_FORMS
mainwindow.ui
about.ui
preview.ui
login.ui
downloadfromurldlg.ui
bandwidth_limit.ui
updownratiodlg.ui
confirmdeletiondlg.ui
torrentimportdlg.ui
executionlog.ui
addnewtorrentdialog.ui
autoexpandabledialog.ui
statsdialog.ui
options.ui
torrentcreatordlg.ui
)
set(QBT_GUI_RESOURCES about.qrc)
add_library(qbt_gui STATIC ${QBT_GUI_HEADERS} ${QBT_GUI_SOURCES} ${QBT_GUI_RESOURCES})
target_link_libraries(qbt_gui qbt_lineedit qbt_powermanagement qbt_rss qbt_properties qbt_searchengine ${QBT_GUI_OPTIONAL_LINK_LIBRARIES} qbt_base)

View File

@ -0,0 +1,18 @@
set(QBT_LINEEDIT_SOURCES
src/lineedit.cpp
)
set(QBT_LINEEDIT_HEADERS
src/lineedit.h
)
set(QBT_LINEEDIT_RESOURCES
resources/lineeditimages.qrc
)
add_library(qbt_lineedit STATIC ${QBT_LINEEDIT_SOURCES} ${QBT_LINEEDIT_HEADERS} ${QBT_LINEEDIT_RESOURCES})
if (QT4_FOUND)
target_link_libraries(qbt_lineedit Qt4::QtGui)
else (QT4_FOUND)
target_link_libraries(qbt_lineedit Qt5::Widgets)
endif (QT4_FOUND)

View File

@ -0,0 +1,25 @@
set(QBT_POWERMANAGEMENT_HEADERS
powermanagement.h
)
set(QBT_POWERMANAGEMENT_SOURCES
powermanagement.cpp
)
if (UNIX AND DBUS)
find_package(X11)
if (X11_FOUND)
list(APPEND QBT_POWERMANAGEMENT_HEADERS powermanagement_x11.h)
list(APPEND QBT_POWERMANAGEMENT_SOURCES powermanagement_x11.cpp)
endif (X11_FOUND)
endif (UNIX AND DBUS)
add_library(qbt_powermanagement STATIC ${QBT_POWERMANAGEMENT_SOURCES} ${QBT_POWERMANAGEMENT_HEADERS})
set_target_properties(qbt_powermanagement PROPERTIES AUTOUIC False AUTORCC False)
target_link_qt_components(qbt_powermanagement Core)
if (X11_FOUND)
target_link_qt_components(qbt_powermanagement DBus)
endif (X11_FOUND)
if (WIN32)
target_link_libraries(qbt_powermanagement PowrProf)
endif (WIN32)

View File

@ -0,0 +1,47 @@
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
../lineedit/src/
)
set(QBT_PROPERTIES_FORMS
propertieswidget.ui
trackersadditiondlg.ui
peersadditiondlg.ui
)
set(QBT_PROPERTIES_HEADERS
propertieswidget.h
peerlistwidget.h
proplistdelegate.h
trackerlist.h
downloadedpiecesbar.h
peerlistdelegate.h
peerlistsortmodel.h
peersadditiondlg.h
trackersadditiondlg.h
pieceavailabilitybar.h
proptabbar.h
speedwidget.h
speedplotview.h
)
set(QBT_PROPERTIES_SOURCES
propertieswidget.cpp
proplistdelegate.cpp
peerlistwidget.cpp
trackerlist.cpp
peersadditiondlg.cpp
downloadedpiecesbar.cpp
trackersadditiondlg.cpp
pieceavailabilitybar.cpp
proptabbar.cpp
speedwidget.cpp
speedplotview.cpp
)
add_library(qbt_properties STATIC ${QBT_PROPERTIES_HEADERS} ${QBT_PROPERTIES_SOURCES})
target_link_libraries(qbt_properties qbt_base)
if (NOT QT4_FOUND)
target_link_libraries(qbt_properties Qt5::Widgets Qt5::Concurrent)
endif (NOT QT4_FOUND)

View File

@ -0,0 +1,11 @@
set(QBT_QTNOTIFY_SOURCES
notifications.cpp
)
set(QBT_QTNOTIFY_HEADERS
notifications.h
)
add_library(qbt_qtnotify STATIC ${QBT_QTNOTIFY_SOURCES} ${QBT_QTNOTIFY_HEADERS})
set_target_properties(qbt_qtnotify PROPERTIES AUTOUIC False AUTORCC False)
target_link_qt_components(qbt_qtnotify DBus)

View File

@ -0,0 +1,33 @@
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
set(QBT_RSS_HEADERS
automatedrssdownloader.h
cookiesdlg.h
feedlistwidget.h
htmlbrowser.h
rss_imp.h
rsssettingsdlg.h
)
set(QBT_RSS_SOURCE
automatedrssdownloader.cpp
cookiesdlg.cpp
feedlistwidget.cpp
htmlbrowser.cpp
rss_imp.cpp
rsssettingsdlg.cpp
)
set(QBT_RSS_FORMS
automatedrssdownloader.ui
cookiesdlg.ui
rss.ui
rsssettingsdlg.ui
)
add_library(qbt_rss STATIC ${QBT_RSS_HEADERS} ${QBT_RSS_SOURCE} ${QBT_RSS_FORMS})
if (QT4_FOUND)
target_link_libraries(qbt_rss Qt4::QtGui Qt4::QtNetwork)
else (QT4_FOUND)
target_link_libraries(qbt_rss Qt5::Gui Qt5::Widgets Qt5::Network)
endif (QT4_FOUND)

View File

@ -0,0 +1,38 @@
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/..
${CMAKE_CURRENT_SOURCE_DIR}/../lineedit/src
)
set(QBT_SEARCHENGINE_FORMS
pluginselectdlg.ui
pluginsourcedlg.ui
searchwidget.ui
)
set(QBT_SEARCHENGINE_HEADERS
pluginselectdlg.h
pluginsourcedlg.h
searchlistdelegate.h
searchsortmodel.h
searchtab.h
searchwidget.h
)
set(QBT_SEARCHENGINE_SOURCES
pluginselectdlg.cpp
pluginsourcedlg.cpp
searchlistdelegate.cpp
searchsortmodel.cpp
searchtab.cpp
searchwidget.cpp
../ico.cpp
)
set(QBT_SEARCHENGINE_RESOURCES
# search.qrc
)
add_library(qbt_searchengine STATIC ${QBT_SEARCHENGINE_HEADERS} ${QBT_SEARCHENGINE_SOURCES} ${QBT_SEARCHENGINE_RESOURCES} ${QBT_SEARCHENGINE_FORMS})
target_link_libraries(qbt_searchengine qbt_base)

35
src/webui/CMakeLists.txt Normal file
View File

@ -0,0 +1,35 @@
set(QBT_WEBUI_HEADERS
abstractwebapplication.h
btjson.h
extra_translations.h
jsonutils.h
prefjson.h
webapplication.h
websessiondata.h
webui.h
)
set(QBT_WEBUI_SOURCES
abstractwebapplication.cpp
btjson.cpp
prefjson.cpp
webapplication.cpp
webui.cpp
)
if (QT4_FOUND)
if (NOT SYSTEM_QJSON)
add_subdirectory(qjson)
else (NOT SYSTEM_QJSON)
find_package(QJSON REQUIRED)
add_definitions(-DUSE_SYSTEM_QJSON)
endif(NOT SYSTEM_QJSON)
endif (QT4_FOUND)
set(QBT_WEBUI_RESOURCES webui.qrc)
add_library(qbt_webui STATIC ${QBT_WEBUI_HEADERS} ${QBT_WEBUI_SOURCES} ${QBT_WEBUI_RESOURCES})
target_link_libraries(qbt_webui qbt_base)
if (QT4_FOUND)
target_link_libraries(qbt_webui qjson)
endif (QT4_FOUND)

View File

@ -0,0 +1,25 @@
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
set(QJSON_HEADERS
FlexLexer.h
stack.hh
position.hh
location.hh
json_parser.hh
json_scanner.h
parser.h
parser_p.h
qjson_debug.h
qjson_export.h
serializer.h
)
set(QJSON_SOURCES
json_parser.cc
json_scanner.cc
json_scanner.cpp
parser.cpp
serializer.cpp
)
add_library(qjson STATIC ${QJSON_HEADERS} ${QJSON_SOURCES})