mirror of
https://github.com/zealdocs/zeal.git
synced 2024-08-17 02:00:25 +03:00
parent
43d8dd1680
commit
89b9d91938
12
.gitignore
vendored
12
.gitignore
vendored
@ -1,5 +1,4 @@
|
||||
# C++ objects and libs
|
||||
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
@ -10,8 +9,7 @@
|
||||
*.dll
|
||||
*.dylib
|
||||
|
||||
# Qt-es
|
||||
|
||||
# qmake
|
||||
/.qmake.cache
|
||||
/.qmake.stash
|
||||
*.pro.user
|
||||
@ -23,10 +21,12 @@ ui_*.h
|
||||
Makefile*
|
||||
*-build-*
|
||||
|
||||
# QtCreator
|
||||
|
||||
# Qt Creator
|
||||
*.autosave
|
||||
|
||||
#QtCtreator Qml
|
||||
# Qt Ctreator QML
|
||||
*.qmlproject.user
|
||||
*.qmlproject.user.*
|
||||
|
||||
# CMake
|
||||
CMakeLists.txt.user
|
||||
|
28
CMakeLists.txt
Normal file
28
CMakeLists.txt
Normal file
@ -0,0 +1,28 @@
|
||||
cmake_minimum_required(VERSION 3.5.1)
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||
|
||||
project(Zeal VERSION 0.3.1)
|
||||
|
||||
# Project information.
|
||||
if(APPLE)
|
||||
set(PROJECT_OUTPUT_NAME "Zeal")
|
||||
else()
|
||||
set(PROJECT_OUTPUT_NAME "zeal")
|
||||
endif()
|
||||
|
||||
set(PROJECT_COMPANY_NAME "ZealDocs")
|
||||
|
||||
# CMake <= 3.8.0 doesn't support Unicode on Windows:
|
||||
# https://gitlab.kitware.com/cmake/cmake/commit/335a29cb07a8d014a9ed4d4dbf25e49da3a78b33
|
||||
# Comparing with 3.8.1 to catch 3.8.0-rc1: https://gitlab.kitware.com/cmake/cmake/issues/16656
|
||||
if(WIN32 AND CMAKE_VERSION VERSION_LESS 3.8.1)
|
||||
string(TIMESTAMP PROJECT_COPYRIGHT "(C) 2015-%Y Oleg Shparber" UTC)
|
||||
else()
|
||||
string(TIMESTAMP PROJECT_COPYRIGHT "© 2015-%Y Oleg Shparber" UTC)
|
||||
endif()
|
||||
|
||||
set(PROJECT_DESCRIPTION "A simple documentation browser.")
|
||||
set(PROJECT_URL "https://zealdocs.org")
|
||||
|
||||
add_subdirectory(assets)
|
||||
add_subdirectory(src)
|
17
assets/CMakeLists.txt
Normal file
17
assets/CMakeLists.txt
Normal file
@ -0,0 +1,17 @@
|
||||
if(UNIX AND NOT APPLE)
|
||||
find_package(ECM REQUIRED NO_MODULE)
|
||||
set(CMAKE_MODULE_PATH ${ECM_KDE_MODULE_DIR})
|
||||
include(KDEInstallDirs)
|
||||
|
||||
foreach(_i 16 24 32 64 128)
|
||||
install(FILES "freedesktop/appicons/${_i}/zeal.png"
|
||||
DESTINATION "${KDE_INSTALL_ICONDIR}/hicolor/${_i}x${_i}/apps"
|
||||
# TODO: Use `RENAME zeal.png` and get rid of subdirectories.
|
||||
)
|
||||
endforeach()
|
||||
|
||||
# TODO: Generate via zeal.desktop.in.
|
||||
install(FILES "freedesktop/zeal.desktop"
|
||||
DESTINATION ${KDE_INSTALL_APPDIR}
|
||||
)
|
||||
endif()
|
38
cmake/FindSQLite.cmake
Normal file
38
cmake/FindSQLite.cmake
Normal file
@ -0,0 +1,38 @@
|
||||
# FindSQLite
|
||||
# ----------
|
||||
#
|
||||
# Finds SQLite headers and libraries.
|
||||
#
|
||||
# SQLite_FOUND - True if SQLite is found.
|
||||
# SQLite_INCLUDE_DIR - Path to SQLite header files.
|
||||
# SQLite_LIBRARY - SQLite library to link to.
|
||||
# SQLite_VERSION_STRING - The version of SQLite found.
|
||||
|
||||
# A simple fallback to pkg-config.
|
||||
if(NOT WIN32)
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_search_module(PC_SQLITE QUIET sqlite3)
|
||||
endif()
|
||||
|
||||
find_path(SQLite_INCLUDE_DIR NAMES sqlite3.h
|
||||
PATHS
|
||||
${PC_SQLITE_INCLUDEDIR}
|
||||
${PC_SQLITE_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
find_library(SQLite_LIBRARY NAMES sqlite3
|
||||
PATHS
|
||||
${PC_SQLITE_LIBDIR}
|
||||
${PC_SQLITE_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
# TODO: Set version when library is found not via pkg-config.
|
||||
set(SQLite_VERSION_STRING ${PC_SQLITE_VERSION})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SQLite
|
||||
REQUIRED_VARS SQLite_LIBRARY SQLite_INCLUDE_DIR
|
||||
VERSION_VAR SQLite_VERSION_STRING
|
||||
)
|
||||
|
||||
mark_as_advanced(SQLite_INCLUDE_DIR SQLite_LIBRARY)
|
36
cmake/MacOSXBundleInfo.plist.in
Normal file
36
cmake/MacOSXBundleInfo.plist.in
Normal file
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleLongVersionString</key>
|
||||
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
31
src/CMakeLists.txt
Normal file
31
src/CMakeLists.txt
Normal file
@ -0,0 +1,31 @@
|
||||
# Only C++11
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Find includes in corresponding build directories.
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
## Build options
|
||||
option(ZEAL_PORTABLE_BUILD "Build portable version")
|
||||
if(ZEAL_PORTABLE_BUILD)
|
||||
add_definitions(-DPORTABLE_BUILD)
|
||||
endif()
|
||||
|
||||
## Macro
|
||||
add_definitions(-DZEAL_VERSION="${Zeal_VERSION}")
|
||||
|
||||
# QString options
|
||||
add_definitions(-DQT_USE_QSTRINGBUILDER)
|
||||
add_definitions(-DQT_RESTRICTED_CAST_FROM_ASCII)
|
||||
add_definitions(-DQT_NO_CAST_TO_ASCII)
|
||||
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
|
||||
|
||||
## Handle moc, uic, and rcc files.
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
include_directories(libs)
|
||||
add_subdirectory(libs)
|
||||
|
||||
add_subdirectory(app)
|
45
src/app/CMakeLists.txt
Normal file
45
src/app/CMakeLists.txt
Normal file
@ -0,0 +1,45 @@
|
||||
# TODO: Move zeal.qrc one level up to rely on CMAKE_AUTORCC.
|
||||
find_package(Qt5Core REQUIRED)
|
||||
qt5_add_resources(App_RESOURCES resources/zeal.qrc)
|
||||
|
||||
if(APPLE)
|
||||
list(APPEND App_RESOURCES resources/zeal.icns)
|
||||
elseif(WIN32)
|
||||
configure_file(versioninfo.rc.in ${CMAKE_CURRENT_BINARY_DIR}/versioninfo.rc)
|
||||
list(APPEND App_RESOURCES ${CMAKE_CURRENT_BINARY_DIR}/versioninfo.rc)
|
||||
endif()
|
||||
|
||||
add_executable(App
|
||||
main.cpp
|
||||
${App_RESOURCES}
|
||||
)
|
||||
|
||||
target_link_libraries(App Core Util)
|
||||
|
||||
find_package(Qt5 COMPONENTS Concurrent Widgets REQUIRED)
|
||||
target_link_libraries(App Qt5::Concurrent Qt5::Widgets)
|
||||
|
||||
set_target_properties(App PROPERTIES
|
||||
OUTPUT_NAME ${PROJECT_OUTPUT_NAME}
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
|
||||
)
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(App PROPERTIES
|
||||
MACOSX_BUNDLE TRUE
|
||||
MACOSX_BUNDLE_BUNDLE_NAME ${PROJECT_NAME}
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER "org.zealdocs.zeal"
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
||||
MACOSX_BUNDLE_LONG_VERSION_STRING ${PROJECT_VERSION}
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
|
||||
MACOSX_BUNDLE_ICON_FILE "zeal.icns"
|
||||
MACOSX_BUNDLE_COPYRIGHT ${PROJECT_COPYRIGHT}
|
||||
RESOURCE "resources/zeal.icns"
|
||||
)
|
||||
elseif(UNIX)
|
||||
find_package(ECM REQUIRED NO_MODULE)
|
||||
set(CMAKE_MODULE_PATH ${ECM_KDE_MODULE_DIR})
|
||||
include(KDEInstallDirs)
|
||||
|
||||
install(TARGETS App DESTINATION ${KDE_INSTALL_BINDIR})
|
||||
endif()
|
56
src/app/versioninfo.rc.in
Normal file
56
src/app/versioninfo.rc.in
Normal file
@ -0,0 +1,56 @@
|
||||
#include <winver.h>
|
||||
|
||||
IDI_ICON1 ICON DISCARDABLE "resources/zeal.ico"
|
||||
|
||||
#define VER_COMPANYNAME_STR "${PROJECT_COMPANY_NAME}"
|
||||
#define VER_FILEDESCRIPTION_STR "${PROJECT_DESCRIPTION}"
|
||||
#define VER_FILEVERSION ${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},${PROJECT_VERSION_PATCH}
|
||||
#define VER_FILEVERSION_STR "${PROJECT_VERSION}"
|
||||
#define VER_INTERNALNAME_STR "${PROJECT_NAME}"
|
||||
#define VER_LEGALCOPYRIGHT_STR "${PROJECT_COPYRIGHT}"
|
||||
#define VER_LEGALTRADEMARKS1_STR ""
|
||||
#define VER_LEGALTRADEMARKS2_STR ""
|
||||
#define VER_ORIGINALFILENAME_STR "${PROJECT_OUTPUT_NAME}.exe"
|
||||
#define VER_PRODUCTNAME_STR "${PROJECT_NAME}"
|
||||
#define VER_PRODUCTVERSION ${PROJECT_VERSION_MAJOR},${PROJECT_VERSION_MINOR},${PROJECT_VERSION_PATCH}
|
||||
#define VER_PRODUCTVERSION_STR "${PROJECT_VERSION}"
|
||||
|
||||
#ifndef DEBUG
|
||||
#define VER_DEBUG 0
|
||||
#else
|
||||
#define VER_DEBUG VS_FF_DEBUG
|
||||
#endif
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION VER_FILEVERSION
|
||||
PRODUCTVERSION VER_PRODUCTVERSION
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
//TODO: Set file flags.
|
||||
//FILEFLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG)
|
||||
FILEFLAGS 0
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE VFT2_UNKNOWN
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904E4"
|
||||
BEGIN
|
||||
VALUE "CompanyName", VER_COMPANYNAME_STR
|
||||
VALUE "FileDescription", VER_FILEDESCRIPTION_STR
|
||||
VALUE "FileVersion", VER_FILEVERSION_STR
|
||||
VALUE "InternalName", VER_INTERNALNAME_STR
|
||||
VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
|
||||
VALUE "LegalTrademarks1", VER_LEGALTRADEMARKS1_STR
|
||||
VALUE "LegalTrademarks2", VER_LEGALTRADEMARKS2_STR
|
||||
VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
|
||||
VALUE "ProductName", VER_PRODUCTNAME_STR
|
||||
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
|
||||
END
|
||||
END
|
||||
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1252
|
||||
END
|
||||
END
|
4
src/libs/CMakeLists.txt
Normal file
4
src/libs/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(registry)
|
||||
add_subdirectory(ui)
|
||||
add_subdirectory(util)
|
16
src/libs/core/CMakeLists.txt
Normal file
16
src/libs/core/CMakeLists.txt
Normal file
@ -0,0 +1,16 @@
|
||||
add_library(Core
|
||||
application.cpp
|
||||
extractor.cpp
|
||||
localserver.cpp
|
||||
networkaccessmanager.cpp
|
||||
settings.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(Core Registry Ui)
|
||||
|
||||
find_package(Qt5 COMPONENTS Network WebKit Widgets REQUIRED)
|
||||
target_link_libraries(Core Qt5::Network Qt5::WebKit Qt5::Widgets)
|
||||
|
||||
find_package(LibArchive REQUIRED)
|
||||
include_directories(${LibArchive_INCLUDE_DIRS})
|
||||
target_link_libraries(Core ${LibArchive_LIBRARIES})
|
13
src/libs/registry/CMakeLists.txt
Normal file
13
src/libs/registry/CMakeLists.txt
Normal file
@ -0,0 +1,13 @@
|
||||
add_library(Registry
|
||||
cancellationtoken.cpp
|
||||
docset.cpp
|
||||
docsetmetadata.cpp
|
||||
docsetregistry.cpp
|
||||
listmodel.cpp
|
||||
searchmodel.cpp
|
||||
searchquery.cpp
|
||||
searchresult.h # Only for Qt Creator to see it.
|
||||
)
|
||||
|
||||
find_package(Qt5 COMPONENTS Concurrent Gui Network REQUIRED)
|
||||
target_link_libraries(Registry Util Qt5::Concurrent Qt5::Gui Qt5::Network)
|
25
src/libs/ui/CMakeLists.txt
Normal file
25
src/libs/ui/CMakeLists.txt
Normal file
@ -0,0 +1,25 @@
|
||||
add_subdirectory(qxtglobalshortcut)
|
||||
|
||||
list(APPEND Widgets_SOURCES
|
||||
widgets/searchablewebview.cpp
|
||||
widgets/searchedit.cpp
|
||||
widgets/shortcutedit.cpp
|
||||
widgets/toolbarframe.cpp
|
||||
widgets/webview.cpp
|
||||
)
|
||||
|
||||
add_library(Ui
|
||||
aboutdialog.cpp
|
||||
docsetlistitemdelegate.cpp
|
||||
docsetsdialog.cpp
|
||||
mainwindow.cpp
|
||||
progressitemdelegate.cpp
|
||||
searchitemdelegate.cpp
|
||||
settingsdialog.cpp
|
||||
${Widgets_SOURCES}
|
||||
)
|
||||
|
||||
target_link_libraries(Ui QxtGlobalShortcut Registry)
|
||||
|
||||
find_package(Qt5 COMPONENTS WebKitWidgets REQUIRED)
|
||||
target_link_libraries(Ui Qt5::WebKitWidgets)
|
41
src/libs/ui/qxtglobalshortcut/CMakeLists.txt
Normal file
41
src/libs/ui/qxtglobalshortcut/CMakeLists.txt
Normal file
@ -0,0 +1,41 @@
|
||||
list(APPEND QxtGlobalShortcut_SOURCES
|
||||
qxtglobalshortcut.cpp
|
||||
)
|
||||
|
||||
if(APPLE)
|
||||
list(APPEND QxtGlobalShortcut_SOURCES
|
||||
qxtglobalshortcut_mac.cpp
|
||||
)
|
||||
elseif(UNIX)
|
||||
find_package(X11)
|
||||
if(X11_FOUND)
|
||||
list(APPEND QxtGlobalShortcut_SOURCES
|
||||
qxtglobalshortcut_x11.cpp
|
||||
)
|
||||
endif()
|
||||
elseif(WIN32)
|
||||
list(APPEND QxtGlobalShortcut_SOURCES
|
||||
qxtglobalshortcut_win.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(QxtGlobalShortcut ${QxtGlobalShortcut_SOURCES})
|
||||
|
||||
find_package(Qt5Gui REQUIRED)
|
||||
target_link_libraries(QxtGlobalShortcut Qt5::Gui)
|
||||
|
||||
if(APPLE)
|
||||
find_library(CARBON_LIBRARY Carbon)
|
||||
target_link_libraries(QxtGlobalShortcut ${CARBON_LIBRARY})
|
||||
elseif(UNIX AND X11_FOUND)
|
||||
target_link_libraries(QxtGlobalShortcut ${X11_LIBRARIES})
|
||||
|
||||
find_package(Qt5 COMPONENTS X11Extras REQUIRED)
|
||||
target_link_libraries(QxtGlobalShortcut Qt5::X11Extras)
|
||||
|
||||
find_package(ECM REQUIRED NO_MODULE)
|
||||
set(CMAKE_MODULE_PATH ${ECM_FIND_MODULE_DIR})
|
||||
|
||||
find_package(XCB COMPONENTS XCB KEYSYMS REQUIRED)
|
||||
target_link_libraries(QxtGlobalShortcut XCB::XCB XCB::KEYSYMS)
|
||||
endif()
|
18
src/libs/util/CMakeLists.txt
Normal file
18
src/libs/util/CMakeLists.txt
Normal file
@ -0,0 +1,18 @@
|
||||
# Nothing to moc here, so avoid empty build units.
|
||||
set(CMAKE_AUTOMOC OFF)
|
||||
|
||||
add_library(Util
|
||||
plist.cpp
|
||||
sqlitedatabase.cpp
|
||||
version.cpp
|
||||
)
|
||||
|
||||
find_package(Qt5Core REQUIRED)
|
||||
target_link_libraries(Util Qt5::Core)
|
||||
|
||||
find_package(SQLite REQUIRED)
|
||||
include_directories(${SQLite_INCLUDE_DIR})
|
||||
target_link_libraries(Util ${SQLite_LIBRARY})
|
||||
|
||||
# TODO: Do not export SQLite headers.
|
||||
target_include_directories(Util PUBLIC ${SQLite_INCLUDE_DIR})
|
Loading…
Reference in New Issue
Block a user