Skip to content

Commit

Permalink
migrate to cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
tamlok committed Apr 24, 2024
1 parent daa2fe1 commit 25b556a
Show file tree
Hide file tree
Showing 44 changed files with 406 additions and 912 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ GRTAGS
GTAGS
aqtinstall.log
tags
CMakeLists.txt.user
build
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cmake_minimum_required (VERSION 3.12)
project(VNote VERSION 3.17.0 LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

add_subdirectory(libs)
add_subdirectory(src)
# TODO: find a better way to organize tests
# add_subdirectory(tests)
2 changes: 2 additions & 0 deletions libs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
add_subdirectory(QHotKey)
add_subdirectory(vtextedit)
2 changes: 1 addition & 1 deletion libs/QHotkey
5 changes: 0 additions & 5 deletions libs/libs.pro

This file was deleted.

2 changes: 1 addition & 1 deletion libs/vtextedit
Submodule vtextedit updated 239 files
88 changes: 88 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
cmake_minimum_required(VERSION 3.16)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(QT_DEFAULT_MAJOR_VERSION 6 CACHE STRING "Qt version to use (5 or 6), defaults to 6")
find_package(Qt${QT_DEFAULT_MAJOR_VERSION} REQUIRED COMPONENTS Core Gui Network PrintSupport Sql Svg Widgets WebChannel WebEngineWidgets LinguistTools)
find_package(Qt${QT_DEFAULT_MAJOR_VERSION} OPTIONAL_COMPONENTS Core5Compat)

if ((QT_DEFAULT_MAJOR_VERSION GREATER 5))
qt_standard_project_setup()
else()
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
endif()

# Application icon on Windows
set(VX_APP_ICON_RC_WIN data/core/icons/vnote.rc)

# Application icon on macOS
set(MACOSX_BUNDLE_ICON_FILE vnote.icns)
set(VX_APP_ICON_MACOS data/core/icons/vnote.icns)
set_source_files_properties(${VX_APP_ICON_MACOS} PROPERTIES
MACOSX_PACKAGE_LOCATION "Resources")

# Translations
set(VX_TS_FILES data/core/translations/vnote_zh_CN.ts
data/core/translations/vnote_ja.ts)
set_source_files_properties(${VX_TS_FILES} PROPERTIES OUTPUT_LOCATION "data/core/translations")
qt_add_translation(VX_QM_FILES ${VX_TS_FILES})

# Resources
set(VX_RESOURCE_FILES data/core/core.qrc)
qt_add_binary_resources(VX_EXTRA_RESOURCE data/extra/extra.qrc DESTINATION vnote_extra.rcc)

add_executable(vnote WIN32 MACOSX_BUNDLE
application.cpp application.h
commandlineoptions.cpp commandlineoptions.h
fakeaccessible.cpp fakeaccessible.h
main.cpp
${VX_APP_ICON_RC_WIN} ${VX_APP_ICON_MACOS} ${VX_RESOURCE_FILES}
)

add_dependencies(vnote VX_EXTRA_RESOURCE)

set(VX_LIBS_FOLDER ../libs)
target_include_directories(vnote PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)

find_program(GOLD_LINKER "ld.gold")
if (NOT ${GOLD_LINKER} STREQUAL GOLD_LINKER-NOTFOUND)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
endif()

target_compile_definitions(vnote PRIVATE
QT_MESSAGELOGCONTEXT
)

add_subdirectory(core)
add_subdirectory(export)
add_subdirectory(imagehost)
add_subdirectory(search)
add_subdirectory(snippet)
add_subdirectory(task)
add_subdirectory(unitedentry)
add_subdirectory(utils)
add_subdirectory(widgets)

target_link_libraries(vnote PRIVATE
Qt::Core
Qt::Gui
Qt::Network
Qt::PrintSupport
Qt::Sql
Qt::Svg
Qt::WebChannel
Qt::WebEngineWidgets
Qt::Widgets
VTextEdit
qhotkey
)

if((QT_DEFAULT_MAJOR_VERSION GREATER 5))
target_link_libraries(vnote PRIVATE
Qt::Core5Compat
)
endif()
87 changes: 87 additions & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
target_sources(vnote PRIVATE
buffer/buffer.cpp buffer/buffer.h
buffer/bufferprovider.cpp buffer/bufferprovider.h
buffer/filebufferprovider.cpp buffer/filebufferprovider.h
buffer/filetypehelper.cpp buffer/filetypehelper.h
buffer/ibufferfactory.h
buffer/markdownbuffer.cpp buffer/markdownbuffer.h
buffer/markdownbufferfactory.cpp buffer/markdownbufferfactory.h
buffer/mindmapbuffer.cpp buffer/mindmapbuffer.h
buffer/mindmapbufferfactory.cpp buffer/mindmapbufferfactory.h
buffer/nodebufferprovider.cpp buffer/nodebufferprovider.h
buffer/pdfbuffer.cpp buffer/pdfbuffer.h
buffer/pdfbufferfactory.cpp buffer/pdfbufferfactory.h
buffer/textbuffer.cpp buffer/textbuffer.h
buffer/textbufferfactory.cpp buffer/textbufferfactory.h
buffer/urlbasedbufferprovider.h
buffermgr.cpp buffermgr.h
clipboarddata.cpp clipboarddata.h
configmgr.cpp configmgr.h
coreconfig.cpp coreconfig.h
editorconfig.cpp editorconfig.h
events.h
exception.h
externalfile.cpp externalfile.h
file.cpp file.h
filelocator.h
fileopenparameters.h
global.cpp global.h
historyitem.cpp historyitem.h
historymgr.cpp historymgr.h
htmltemplatehelper.cpp htmltemplatehelper.h
iconfig.h
location.h
logger.cpp logger.h
mainconfig.cpp mainconfig.h
markdowneditorconfig.cpp markdowneditorconfig.h
mindmapeditorconfig.cpp mindmapeditorconfig.h
namebasedserver.h
noncopyable.h
notebook/bundlenotebook.cpp notebook/bundlenotebook.h
notebook/bundlenotebookfactory.cpp notebook/bundlenotebookfactory.h
notebook/externalnode.cpp notebook/externalnode.h
notebook/historyi.h
notebook/inotebookfactory.h
notebook/node.cpp notebook/node.h
notebook/nodeparameters.cpp notebook/nodeparameters.h
notebook/notebook.cpp notebook/notebook.h
notebook/notebookdatabaseaccess.cpp notebook/notebookdatabaseaccess.h
notebook/notebookparameters.cpp notebook/notebookparameters.h
notebook/notebooktagmgr.cpp notebook/notebooktagmgr.h
notebook/tag.cpp notebook/tag.h
notebook/tagi.h
notebook/vxnode.cpp notebook/vxnode.h
notebook/vxnodefile.cpp notebook/vxnodefile.h
notebookbackend/inotebookbackend.cpp notebookbackend/inotebookbackend.h
notebookbackend/inotebookbackendfactory.h
notebookbackend/localnotebookbackend.cpp notebookbackend/localnotebookbackend.h
notebookbackend/localnotebookbackendfactory.cpp notebookbackend/localnotebookbackendfactory.h
notebookconfigmgr/bundlenotebookconfigmgr.cpp notebookconfigmgr/bundlenotebookconfigmgr.h
notebookconfigmgr/inotebookconfigmgr.cpp notebookconfigmgr/inotebookconfigmgr.h
notebookconfigmgr/inotebookconfigmgrfactory.h
notebookconfigmgr/notebookconfig.cpp notebookconfigmgr/notebookconfig.h
notebookconfigmgr/vxnodeconfig.cpp notebookconfigmgr/vxnodeconfig.h
notebookconfigmgr/vxnotebookconfigmgr.cpp notebookconfigmgr/vxnotebookconfigmgr.h
notebookconfigmgr/vxnotebookconfigmgrfactory.cpp notebookconfigmgr/vxnotebookconfigmgrfactory.h
notebookmgr.cpp notebookmgr.h
pdfviewerconfig.cpp pdfviewerconfig.h
quickaccesshelper.cpp quickaccesshelper.h
sessionconfig.cpp sessionconfig.h
singleinstanceguard.cpp singleinstanceguard.h
templatemgr.cpp templatemgr.h
texteditorconfig.cpp texteditorconfig.h
theme.cpp theme.h
thememgr.cpp thememgr.h
versioncontroller/dummyversioncontroller.cpp versioncontroller/dummyversioncontroller.h
versioncontroller/dummyversioncontrollerfactory.cpp versioncontroller/dummyversioncontrollerfactory.h
versioncontroller/iversioncontroller.h
versioncontroller/iversioncontrollerfactory.h
versioncontroller/versioncontrollerserver.cpp versioncontroller/versioncontrollerserver.h
vnotex.cpp vnotex.h
webresource.h
widgetconfig.cpp widgetconfig.h
)

target_include_directories(vnote PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)
31 changes: 0 additions & 31 deletions src/core/buffer/buffer.pri

This file was deleted.

76 changes: 0 additions & 76 deletions src/core/core.pri

This file was deleted.

30 changes: 0 additions & 30 deletions src/core/notebook/notebook.pri

This file was deleted.

10 changes: 0 additions & 10 deletions src/core/notebookbackend/notebookbackend.pri

This file was deleted.

16 changes: 0 additions & 16 deletions src/core/notebookconfigmgr/notebookconfigmgr.pri

This file was deleted.

11 changes: 0 additions & 11 deletions src/core/versioncontroller/versioncontroller.pri

This file was deleted.

1 change: 1 addition & 0 deletions src/data/core/icons/vnote.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IDI_ICON1 ICON DISCARDABLE "vnote.ico"
5 changes: 5 additions & 0 deletions src/export/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
target_sources(vnote PRIVATE
exportdata.cpp exportdata.h
exporter.cpp exporter.h
webviewexporter.cpp webviewexporter.h
)
Loading

0 comments on commit 25b556a

Please sign in to comment.