diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a78af8e4c..f9dd950c4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,17 +9,82 @@ on: pull_request: env: - QT_RELEASE_VER: 6.5 + QT_RELEASE_VER: 6.8 jobs: + cmake-build: + strategy: + fail-fast: false + matrix: + buildsystem: ["cmake"] + qt_version: ["5.15", "6.8"] + os: [ubuntu-22.04, windows-2022, macos-14] + + runs-on: ${{ matrix.config.os }} + + steps: + - uses: actions/checkout@v3 + with: + submodules: true + + - name: Install Qt + uses: jurplel/install-qt-action@v3 + with: + version: ${{ matrix.config.qt_version }} + modules: ${{ matrix.config.modules }} + + - name: Install Ninja + uses: seanmiddleditch/gha-setup-ninja@master + + - name: Setup (Linux) + if: startsWith (matrix.config.os, 'ubuntu') + run: | + echo "DISTRIBUTION=AppImage" >> "$GITHUB_ENV" + sudo apt-get install libxkbcommon-dev libxkbcommon-x11-0 fuse libxcb-cursor-dev libcups2-dev + + - name: Setup VS tools (Windows) + if: startsWith (matrix.config.os, 'windows') + uses: egor-tensin/vs-shell@v2 + with: + arch: x64 + + - name: Compile + run: | + cmake -S . -B cbuild -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC=ON + cmake --build cbuild + + - name: Create App Image + if: startsWith (matrix.config.os, 'ubuntu') + run: | + cmake --install cbuild --prefix=${{ github.workspace }}/cbuild/AppDir/usr/ + cd cbuild + + wget --no-verbose "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage" + wget --no-verbose "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage" + chmod +x linuxdeploy*.AppImage + + export OUTPUT=NotepadNext-x86_64.AppImage + export LD_LIBRARY_PATH=AppDir/usr/lib/:$LD_LIBRARY_PATH + export DEBUG=1 + ./linuxdeploy-x86_64.AppImage --appdir AppDir --plugin qt --output appimage + + - name: Upload AppImage + if: startsWith (matrix.config.os, 'ubuntu') + uses: actions/upload-artifact@v3 + with: + name: NotepadNext-Linux-Qt${{ matrix.config.qt_version }}-cmake-AppImage + path: ${{ github.workspace }}/cbuild/NotepadNext-x86_64.AppImage + build: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, windows-latest, macos-latest] + os: [ubuntu-20.04, windows-latest, macos-latest, osx-latest] qt_version: ["5.15", "6.5", "6.6"] exclude: - os: macos-latest + qt_version: "6.8" + - os: osx-latest qt_version: "5.15" runs-on: ${{ matrix.os }} diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..68b033155 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,56 @@ +cmake_minimum_required(VERSION 3.20) + +project(NotepadNext) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +include(CPM.cmake) + +# setup SingleApplication +set(QAPPLICATION_CLASS QApplication) +set(QT_DEFAULT_MAJOR_VERSION 6) + +# setup QDS +set(BUILD_EXAMPLES OFF) + +# setup uchardet +set(BUILD_BINARY OFF) +set(BUILD_STATICCACHE OFF) +set(BUILD_SHARED_LIBS OFF) + +# SHA1 bd983ca108a1c493465270702c02bbbe792ea0ed +# When building in debug mode, ucharder requests address santizer, it's not needed by us +# Solution add this in the CPMAddPackage command +# OPTIONS "CMAKE_BUILD_TYPE Release" +# SHA1 8118133e0017c4e1b3ddc9fad104c0ba19692cd7 +# Introduced something that breaks on MSVC +# SHA1 15fc8f0a0f55d6ec9373cf16ed96ebf6b35feef3 +# Last working version +CPMAddPackage(NAME uchardet + GIT_REPOSITORY https://gitlab.freedesktop.org/uchardet/uchardet + GIT_TAG 15fc8f0a0f55d6ec9373cf16ed96ebf6b35feef3 +) +CPMAddPackage("gh:vinniefalco/LuaBridge#5d21e35633a1f87ed08af115b07d3386096f792b") +CPMAddPackage("gh:githubuser0xFFFF/Qt-Advanced-Docking-System#4.3.1") +CPMAddPackage("gh:itay-grudev/SingleApplication#v3.5.1") +CPMAddPackage("gh:editorconfig/editorconfig-core-qt#ee967262db4fdbd735f9971cc0c90cf4f3100d3a") +CPMAddPackage("gh:alex-spataru/QSimpleUpdater#911727370d90001077f93ea94545099e197400a0") + +# the following libraries have no upstream cmake support, +# so we do own own locally (internally they clone the upstream repo) +include(lua.cmake) + +# This is scintilla - which upstream uses mercurial, and as part of the build +# they need python. This fork uses github, and has auto-generated files as +# part of the repo. +# +CPMAddPackage( + NAME scintilla-code + GITHUB_REPOSITORY diegoiast/scintilla-code + GIT_TAG rel-5-5-3-cmake2 + GIT_SHALLOW ON +) +# CPMAddPackage("gh:diegoiast/lexilla#7de1d32b62dfb60aca9ad3b4a194f6333f044f60") +include(lexilla.cmake) + +add_subdirectory(src/NotepadNext) diff --git a/CPM.cmake b/CPM.cmake new file mode 100644 index 000000000..baf2d8c34 --- /dev/null +++ b/CPM.cmake @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: MIT +# +# SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors + +set(CPM_DOWNLOAD_VERSION 0.40.2) +set(CPM_HASH_SUM "c8cdc32c03816538ce22781ed72964dc864b2a34a310d3b7104812a5ca2d835d") + +if(CPM_SOURCE_CACHE) + set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") +elseif(DEFINED ENV{CPM_SOURCE_CACHE}) + set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") +else() + set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") +endif() + +# Expand relative path. This is important if the provided path contains a tilde (~) +get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE) + +file(DOWNLOAD + https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake + ${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM} +) + +include(${CPM_DOWNLOAD_LOCATION}) diff --git a/doc/Building.md b/doc/Building.md index a93d81eed..e18598d61 100644 --- a/doc/Building.md +++ b/doc/Building.md @@ -40,8 +40,12 @@ This section specifically describes how to build Notepad Next using Microsoft's Using a fresh Ubuntu 21.10 setup, the following script will install the needed dependencies and build the executable: +Note - that while Qt5 can be built, we are not longer effectively supporting it, +nor recommending it. Please build using Qt6 only. Qt5 is not effectively removed +but it is not used, so code base might rot - and not work/compile. + ``` -sudo apt install qtbase5-dev qt5-qmake qtbase5-dev-tools qttools5-dev-tools qtbase5-private-dev libqt5x11extras5-dev build-essential git +sudo apt install qtbase6-dev qt6-qmake qtbase6-dev-tools qtbase6-private-dev qt6-5compat-dev build-essential git git clone --recurse-submodules https://github.com/dail8859/NotepadNext.git cd NotepadNext mkdir build @@ -49,3 +53,29 @@ cd build qmake ../src/NotepadNext.pro make -j$(nproc) ``` + +# CMake support + +To build this project using CMake (currently the official way is QMake), you should type this +on the command line (tested on Linux, but should work on Windows as well as OSX): + +``` +cmake -S . -B cbuild -G Ninja +cmake --build cbuild +``` + +If you are using Visual Studio - you can open the directory containing the source +and then use CMake directly on Visual Studio, no addons needed (as Visual Studio 2019 +and above have really good support for CMake). + +Using CLion should be similar - just open the directory inside CLion and you +should be ready to code. + +Currently CMake uses [CPM](https://github.com/cpm-cmake/CPM.cmake) to pull all 3rd parties (originally 3rd parties where +a mix of submodules and in-repo code). The initial config should take a large time +(the main time consumer is cloning of scintilla). + +A future goal is to move all 3rd party dependencies to conan or vcpkg (or some +other package manager). This will also give us pre-compiled 3rd parties which +will reduce compile times as we will use pre-compiled binaries - and will ease the +ability to gain build-reproducability. diff --git a/lexilla.cmake b/lexilla.cmake new file mode 100644 index 000000000..7ef37cb0b --- /dev/null +++ b/lexilla.cmake @@ -0,0 +1,173 @@ +CPMAddPackage("gh:ScintillaOrg/lexilla#master") + +if (lexilla_ADDED) + add_library(lexilla + ${lexilla_SOURCE_DIR}/access/LexillaAccess.cxx + ${lexilla_SOURCE_DIR}/access/LexillaAccess.h + ${lexilla_SOURCE_DIR}/lexers/LexA68k.cxx + ${lexilla_SOURCE_DIR}/lexers/LexAbaqus.cxx + ${lexilla_SOURCE_DIR}/lexers/LexAda.cxx + ${lexilla_SOURCE_DIR}/lexers/LexAPDL.cxx + ${lexilla_SOURCE_DIR}/lexers/LexAsciidoc.cxx + ${lexilla_SOURCE_DIR}/lexers/LexAsm.cxx + ${lexilla_SOURCE_DIR}/lexers/LexAsn1.cxx + ${lexilla_SOURCE_DIR}/lexers/LexASY.cxx + ${lexilla_SOURCE_DIR}/lexers/LexAU3.cxx + ${lexilla_SOURCE_DIR}/lexers/LexAVE.cxx + ${lexilla_SOURCE_DIR}/lexers/LexAVS.cxx + ${lexilla_SOURCE_DIR}/lexers/LexBaan.cxx + ${lexilla_SOURCE_DIR}/lexers/LexBash.cxx + ${lexilla_SOURCE_DIR}/lexers/LexBasic.cxx + ${lexilla_SOURCE_DIR}/lexers/LexBatch.cxx + ${lexilla_SOURCE_DIR}/lexers/LexBibTeX.cxx + ${lexilla_SOURCE_DIR}/lexers/LexBullant.cxx + ${lexilla_SOURCE_DIR}/lexers/LexCaml.cxx + ${lexilla_SOURCE_DIR}/lexers/LexCIL.cxx + ${lexilla_SOURCE_DIR}/lexers/LexCLW.cxx + ${lexilla_SOURCE_DIR}/lexers/LexCmake.cxx + ${lexilla_SOURCE_DIR}/lexers/LexCOBOL.cxx + ${lexilla_SOURCE_DIR}/lexers/LexCoffeeScript.cxx + ${lexilla_SOURCE_DIR}/lexers/LexConf.cxx + ${lexilla_SOURCE_DIR}/lexers/LexCPP.cxx + ${lexilla_SOURCE_DIR}/lexers/LexCrontab.cxx + ${lexilla_SOURCE_DIR}/lexers/LexCsound.cxx + ${lexilla_SOURCE_DIR}/lexers/LexCSS.cxx + ${lexilla_SOURCE_DIR}/lexers/LexDart.cxx + ${lexilla_SOURCE_DIR}/lexers/LexDataflex.cxx + ${lexilla_SOURCE_DIR}/lexers/LexD.cxx + ${lexilla_SOURCE_DIR}/lexers/LexDiff.cxx + ${lexilla_SOURCE_DIR}/lexers/LexDMAP.cxx + ${lexilla_SOURCE_DIR}/lexers/LexDMIS.cxx + ${lexilla_SOURCE_DIR}/lexers/LexECL.cxx + ${lexilla_SOURCE_DIR}/lexers/LexEDIFACT.cxx + ${lexilla_SOURCE_DIR}/lexers/LexEiffel.cxx + ${lexilla_SOURCE_DIR}/lexers/LexErlang.cxx + ${lexilla_SOURCE_DIR}/lexers/LexErrorList.cxx + ${lexilla_SOURCE_DIR}/lexers/LexEScript.cxx + ${lexilla_SOURCE_DIR}/lexers/LexFlagship.cxx + ${lexilla_SOURCE_DIR}/lexers/LexForth.cxx + ${lexilla_SOURCE_DIR}/lexers/LexFortran.cxx + ${lexilla_SOURCE_DIR}/lexers/LexFSharp.cxx + ${lexilla_SOURCE_DIR}/lexers/LexGAP.cxx + ${lexilla_SOURCE_DIR}/lexers/LexGDScript.cxx + ${lexilla_SOURCE_DIR}/lexers/LexGui4Cli.cxx + ${lexilla_SOURCE_DIR}/lexers/LexHaskell.cxx + ${lexilla_SOURCE_DIR}/lexers/LexHex.cxx + ${lexilla_SOURCE_DIR}/lexers/LexHollywood.cxx + ${lexilla_SOURCE_DIR}/lexers/LexHTML.cxx + ${lexilla_SOURCE_DIR}/lexers/LexIndent.cxx + ${lexilla_SOURCE_DIR}/lexers/LexInno.cxx + ${lexilla_SOURCE_DIR}/lexers/LexJSON.cxx + ${lexilla_SOURCE_DIR}/lexers/LexJulia.cxx + ${lexilla_SOURCE_DIR}/lexers/LexKix.cxx + ${lexilla_SOURCE_DIR}/lexers/LexKVIrc.cxx + ${lexilla_SOURCE_DIR}/lexers/LexLaTeX.cxx + ${lexilla_SOURCE_DIR}/lexers/LexLisp.cxx + ${lexilla_SOURCE_DIR}/lexers/LexLout.cxx + ${lexilla_SOURCE_DIR}/lexers/LexLua.cxx + ${lexilla_SOURCE_DIR}/lexers/LexMagik.cxx + ${lexilla_SOURCE_DIR}/lexers/LexMake.cxx + ${lexilla_SOURCE_DIR}/lexers/LexMarkdown.cxx + ${lexilla_SOURCE_DIR}/lexers/LexMatlab.cxx + ${lexilla_SOURCE_DIR}/lexers/LexMaxima.cxx + ${lexilla_SOURCE_DIR}/lexers/LexMetapost.cxx + ${lexilla_SOURCE_DIR}/lexers/LexMMIXAL.cxx + ${lexilla_SOURCE_DIR}/lexers/LexModula.cxx + ${lexilla_SOURCE_DIR}/lexers/LexMPT.cxx + ${lexilla_SOURCE_DIR}/lexers/LexMSSQL.cxx + ${lexilla_SOURCE_DIR}/lexers/LexMySQL.cxx + ${lexilla_SOURCE_DIR}/lexers/LexNim.cxx + ${lexilla_SOURCE_DIR}/lexers/LexNimrod.cxx + ${lexilla_SOURCE_DIR}/lexers/LexNix.cxx + ${lexilla_SOURCE_DIR}/lexers/LexNsis.cxx + ${lexilla_SOURCE_DIR}/lexers/LexNull.cxx + ${lexilla_SOURCE_DIR}/lexers/LexOpal.cxx + ${lexilla_SOURCE_DIR}/lexers/LexOScript.cxx + ${lexilla_SOURCE_DIR}/lexers/LexPascal.cxx + ${lexilla_SOURCE_DIR}/lexers/LexPB.cxx + ${lexilla_SOURCE_DIR}/lexers/LexPerl.cxx + ${lexilla_SOURCE_DIR}/lexers/LexPLM.cxx + ${lexilla_SOURCE_DIR}/lexers/LexPO.cxx + ${lexilla_SOURCE_DIR}/lexers/LexPOV.cxx + ${lexilla_SOURCE_DIR}/lexers/LexPowerPro.cxx + ${lexilla_SOURCE_DIR}/lexers/LexPowerShell.cxx + ${lexilla_SOURCE_DIR}/lexers/LexProgress.cxx + ${lexilla_SOURCE_DIR}/lexers/LexProps.cxx + ${lexilla_SOURCE_DIR}/lexers/LexPS.cxx + ${lexilla_SOURCE_DIR}/lexers/LexPython.cxx + ${lexilla_SOURCE_DIR}/lexers/LexRaku.cxx + ${lexilla_SOURCE_DIR}/lexers/LexR.cxx + ${lexilla_SOURCE_DIR}/lexers/LexRebol.cxx + ${lexilla_SOURCE_DIR}/lexers/LexRegistry.cxx + ${lexilla_SOURCE_DIR}/lexers/LexRuby.cxx + ${lexilla_SOURCE_DIR}/lexers/LexRust.cxx + ${lexilla_SOURCE_DIR}/lexers/LexSAS.cxx + ${lexilla_SOURCE_DIR}/lexers/LexScriptol.cxx + ${lexilla_SOURCE_DIR}/lexers/LexSmalltalk.cxx + ${lexilla_SOURCE_DIR}/lexers/LexSML.cxx + ${lexilla_SOURCE_DIR}/lexers/LexSorcus.cxx + ${lexilla_SOURCE_DIR}/lexers/LexSpecman.cxx + ${lexilla_SOURCE_DIR}/lexers/LexSpice.cxx + ${lexilla_SOURCE_DIR}/lexers/LexSQL.cxx + ${lexilla_SOURCE_DIR}/lexers/LexStata.cxx + ${lexilla_SOURCE_DIR}/lexers/LexSTTXT.cxx + ${lexilla_SOURCE_DIR}/lexers/LexTACL.cxx + ${lexilla_SOURCE_DIR}/lexers/LexTADS3.cxx + ${lexilla_SOURCE_DIR}/lexers/LexTAL.cxx + ${lexilla_SOURCE_DIR}/lexers/LexTCL.cxx + ${lexilla_SOURCE_DIR}/lexers/LexTCMD.cxx + ${lexilla_SOURCE_DIR}/lexers/LexTeX.cxx + ${lexilla_SOURCE_DIR}/lexers/LexTOML.cxx + ${lexilla_SOURCE_DIR}/lexers/LexTroff.cxx + ${lexilla_SOURCE_DIR}/lexers/LexTxt2tags.cxx + ${lexilla_SOURCE_DIR}/lexers/LexVB.cxx + ${lexilla_SOURCE_DIR}/lexers/LexVerilog.cxx + ${lexilla_SOURCE_DIR}/lexers/LexVHDL.cxx + ${lexilla_SOURCE_DIR}/lexers/LexVisualProlog.cxx + ${lexilla_SOURCE_DIR}/lexers/LexX12.cxx + ${lexilla_SOURCE_DIR}/lexers/LexYAML.cxx + ${lexilla_SOURCE_DIR}/lexers/LexZig.cxx + ${lexilla_SOURCE_DIR}/lexlib/Accessor.cxx + ${lexilla_SOURCE_DIR}/lexlib/Accessor.h + ${lexilla_SOURCE_DIR}/lexlib/CatalogueModules.h + ${lexilla_SOURCE_DIR}/lexlib/CharacterCategory.cxx + ${lexilla_SOURCE_DIR}/lexlib/CharacterCategory.h + ${lexilla_SOURCE_DIR}/lexlib/CharacterSet.cxx + ${lexilla_SOURCE_DIR}/lexlib/CharacterSet.h + ${lexilla_SOURCE_DIR}/lexlib/DefaultLexer.cxx + ${lexilla_SOURCE_DIR}/lexlib/DefaultLexer.h + ${lexilla_SOURCE_DIR}/lexlib/InList.cxx + ${lexilla_SOURCE_DIR}/lexlib/InList.h + ${lexilla_SOURCE_DIR}/lexlib/LexAccessor.cxx + ${lexilla_SOURCE_DIR}/lexlib/LexAccessor.h + ${lexilla_SOURCE_DIR}/lexlib/LexerBase.cxx + ${lexilla_SOURCE_DIR}/lexlib/LexerBase.h + ${lexilla_SOURCE_DIR}/lexlib/LexerModule.cxx + ${lexilla_SOURCE_DIR}/lexlib/LexerModule.h + ${lexilla_SOURCE_DIR}/lexlib/LexerSimple.cxx + ${lexilla_SOURCE_DIR}/lexlib/LexerSimple.h + ${lexilla_SOURCE_DIR}/lexlib/OptionSet.h + ${lexilla_SOURCE_DIR}/lexlib/PropSetSimple.cxx + ${lexilla_SOURCE_DIR}/lexlib/PropSetSimple.h + ${lexilla_SOURCE_DIR}/lexlib/SparseState.h + ${lexilla_SOURCE_DIR}/lexlib/StringCopy.h + ${lexilla_SOURCE_DIR}/lexlib/StyleContext.cxx + ${lexilla_SOURCE_DIR}/lexlib/StyleContext.h + ${lexilla_SOURCE_DIR}/lexlib/SubStyles.h + ${lexilla_SOURCE_DIR}/lexlib/WordList.cxx + ${lexilla_SOURCE_DIR}/lexlib/WordList.h + ${lexilla_SOURCE_DIR}/src/Lexilla.cxx + ) + + target_link_libraries(lexilla PRIVATE scintilla-qt-edit) + target_include_directories(lexilla PUBLIC + ${lexilla_SOURCE_DIR}/include/ + ) + target_include_directories(lexilla PRIVATE + ${lexilla_SOURCE_DIR}/access/ + ${lexilla_SOURCE_DIR}/lexlib/ + ${lexilla_SOURCE_DIR}/include/ + ) + set_property(TARGET lexilla PROPERTY VERSION "${CMAKE_PROJECT_VERSION}") + set_property(TARGET lexilla PROPERTY SOVERSION 5 ) +endif() diff --git a/lua.cmake b/lua.cmake new file mode 100644 index 000000000..6bf390eb0 --- /dev/null +++ b/lua.cmake @@ -0,0 +1,16 @@ +CPMAddPackage("gh:lua/lua#50c7c915ee2fa239043d5456237f5145d064089b") + +if (lua_ADDED) + set(CMAKE_C_STANDARD 99) + FILE(GLOB lua_sources ${lua_SOURCE_DIR}/*.c) + list(REMOVE_ITEM lua_sources "${lua_SOURCE_DIR}/lua.c" "${lua_SOURCE_DIR}/luac.c" "${lua_SOURCE_DIR}/onelua.c") + add_library(lua STATIC ${lua_sources}) + target_include_directories(lua PUBLIC $) + #target_compile_options("$<$:/utf-8>") + + if (WINDOWS) + target_compile_definitions(lua PRIVATE "-DLUA_USE_WINDOWS") + endif() + + target_compile_definitions(lua PRIVATE "-DLUA_COMPAT_5_2") +endif() diff --git a/src/NotepadNext/CMakeLists.txt b/src/NotepadNext/CMakeLists.txt new file mode 100644 index 000000000..7ba2385d3 --- /dev/null +++ b/src/NotepadNext/CMakeLists.txt @@ -0,0 +1,227 @@ +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets PrintSupport REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets PrintSupport ) +if (Qt6_FOUND) + find_package(Qt6 REQUIRED COMPONENTS Core5Compat) +endif() + +set(CMAKE_INCLUDE_CURRENT_DIR ON) +add_compile_definitions(APP_DISTRIBUTION="local") + +add_executable(NotepadNext + ApplicationSettings.cpp + ColorPickerDelegate.cpp + ColorPickerDelegate.h + ComboBoxDelegate.cpp + ComboBoxDelegate.h + Converter.cpp + Converter.h + DockedEditor.cpp + DockedEditor.h + DebugManager.cpp + DockedEditorTitleBar.h + EditorHexViewerTableModel.cpp + EditorManager.h + EditorManager.cpp + EditorPrintPreviewRenderer.h + EditorPrintPreviewRenderer.cpp + FadingIndicator.cpp + Finder.cpp + Finder.h + FileDialogHelpers.cpp + FileDialogHelpers.h + FocusWatcher.h + HtmlConverter.cpp + HtmlConverter.h + IFaceTable.cpp + IFaceTable.h + IFaceTableMixer.cpp + IFaceTableMixer.h + ISearchResultsHandler.h + LanguageStylesModel.cpp + LanguageStylesModel.h + LuaExtension.cpp + LuaExtension.h + LuaState.cpp + LuaState.h + main.cpp + Macro.cpp + MacroManager.cpp + MacroRecorder.cpp + MacroRecorder.h + MacroStep.cpp + MacroStepTableModel.cpp + MacroListModel.cpp + NotepadNextApplication.cpp + NotepadNextApplication.h + NppImporter.cpp + NppImporter.h + QRegexSearch.cpp + QRegexSearch.h + QuickFindWidget.h + QuickFindWidget.cpp + QuickFindWidget.ui + RangeAllocator.h + RangeAllocator.cpp + RecentFilesListManager.cpp + RecentFilesListManager.h + RecentFilesListMenuBuilder.cpp + RecentFilesListMenuBuilder.h + RtfConverter.cpp + RtfConverter.h + resources.qrc + SciIFaceTable.cpp + SearchResultsCollector.h + SearchResultsCollector.cpp + ScintillaNext.cpp + ScintillaNext.h + SciIFaceTable.h + ScintillaCommenter.h + ScintillaCommenter.cpp + SelectionTracker.h + SessionManager.h + SessionManager.cpp + SelectionTracker.cpp + SpinBoxDelegate.h + SpinBoxDelegate.cpp + scripts.qrc + TranslationManager.cpp + UndoAction.h + UndoAction.cpp + ZoomEventWatcher.h + ZoomEventWatcher.cpp + + decorators/ApplicationDecorator.cpp + decorators/ApplicationDecorator.h + decorators/AutoCompletion.h + decorators/AutoIndentation.h + decorators/AutoCompletion.cpp + decorators/AutoIndentation.cpp + decorators/BetterMultiSelection.h + decorators/BetterMultiSelection.cpp + decorators/BookMarkDecorator.h + decorators/BookMarkDecorator.cpp + decorators/BraceMatch.h + decorators/BraceMatch.cpp + decorators/EditorConfigAppDecorator.cpp + decorators/EditorConfigAppDecorator.h + decorators/EditorDecorator.cpp + decorators/EditorDecorator.h + decorators/LineNumbers.h + decorators/LineNumbers.cpp + decorators/HighlightedScrollBar.cpp + decorators/HighlightedScrollBar.h + decorators/SmartHighlighter.h + decorators/SurroundSelection.h + decorators/SurroundSelection.cpp + decorators/SmartHighlighter.cpp + decorators/URLFinder.cpp + decorators/URLFinder.h + + dialogs/ColumnEditorDialog.h + dialogs/ColumnEditorDialog.ui + dialogs/ColumnEditorDialog.cpp + dialogs/FindReplaceDialog.cpp + dialogs/FindReplaceDialog.h + dialogs/FindReplaceDialog.ui + dialogs/MacroEditorDialog.cpp + dialogs/MacroEditorDialog.h + dialogs/MacroEditorDialog.ui + dialogs/MacroRunDialog.cpp + dialogs/MacroRunDialog.h + dialogs/MacroRunDialog.ui + dialogs/MacroSaveDialog.cpp + dialogs/MacroSaveDialog.h + dialogs/MacroSaveDialog.ui + dialogs/MainWindow.cpp + dialogs/MainWindow.h + dialogs/MainWindow.ui + dialogs/PreferencesDialog.cpp + dialogs/PreferencesDialog.h + dialogs/PreferencesDialog.ui + + docks/DebugLogDock.cpp + docks/EditorInspectorDock.cpp + docks/EditorInspectorDock.h + docks/EditorInspectorDock.ui + docks/FileListDock.cpp + docks/FileListDock.h + docks/FileListDock.ui + docks/FolderAsWorkspaceDock.cpp + docks/FolderAsWorkspaceDock.h + docks/FolderAsWorkspaceDock.ui + docks/LanguageInspectorDock.cpp + docks/LanguageInspectorDock.h + docks/LanguageInspectorDock.ui + docks/LuaConsoleDock.cpp + docks/LuaConsoleDock.ui + docks/LuaConsoleDock.h + docks/HexViewerDock.cpp + docks/SearchResultsDock.cpp + docks/SearchResultsDock.h + docks/SearchResultsDock.ui + + widgets/EditorInfoStatusBar.cpp + widgets/EditorInfoStatusBar.h + widgets/StatusLabel.cpp + widgets/StatusLabel.h +) + +target_link_libraries(NotepadNext Qt::Widgets Qt::PrintSupport + libuchardet + lua + LuaBridge + qt6advanceddocking + SingleApplication + QSimpleUpdater + editorconfig-core-qt + scintilla-qt-edit + lexilla +) + +if (Qt6_FOUND) + target_link_libraries(NotepadNext Qt6::Core5Compat) +endif() + +target_include_directories(NotepadNext PRIVATE decorators dialogs docks widgets src) +target_compile_definitions(NotepadNext PRIVATE APP_VERSION="0.5.6") +target_compile_definitions(NotepadNext PRIVATE APP_COPYRIGHT="Copyright 2019-2022 Justin Dailey") +target_compile_definitions(NotepadNext PRIVATE CMAKE_EXPERIMENTAL) + +if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + target_compile_options(NotepadNext PRIVATE -Wall -Wextra -pedantic --warn-no-unused-variable -Wformat -Wformat-security) +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + target_compile_options(NotepadNext PRIVATE -Wall -Wextra -pedantic --warn-no-unused-variable -Wformat -Wformat-security) +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + MESSAGE("Intel") +elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + target_compile_options(NotepadNext PRIVATE /utf-8 /guard:cf) + target_link_options(NotepadNext PRIVATE /guard:cf) +endif() + +# For some reason - this library slips the linking part. +if(UNIX AND NOT APPLE) + target_link_libraries(NotepadNext xcb) +endif() + +if(APPLE) + set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13) + set(MACOSX_BUNDLE_BUNDLE_NAME "NotepadNext") +# set(MACOSX_BUNDLE_BUNDLE_VERSION ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}) +# set(MACOSX_BUNDLE_LONG_VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}) +# set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION}) + set(MACOSX_BUNDLE_ICON_FILE ../icon/NotepadNext.icns) + set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.github.dail8859.NotepadNext") +endif() + +include(GNUInstallDirs) +install(TARGETS NotepadNext) +install(FILES ${CMAKE_SOURCE_DIR}/deploy/linux/NotepadNext.desktop + DESTINATION share/applications) +install(FILES ${CMAKE_SOURCE_DIR}/icon/NotepadNext.svg + DESTINATION share/icons/hicolor/scalable/mimetypes) +install(FILES ${CMAKE_SOURCE_DIR}/icon/NotepadNext.svg + DESTINATION share/icons/hicolor/scalable/apps/) diff --git a/src/NotepadNext/MacroStepTableModel.h b/src/NotepadNext/MacroStepTableModel.h index 430e84858..bc763465e 100644 --- a/src/NotepadNext/MacroStepTableModel.h +++ b/src/NotepadNext/MacroStepTableModel.h @@ -16,6 +16,7 @@ * along with Notepad Next. If not, see . */ +#pragma once #include diff --git a/src/NotepadNext/NotepadNextApplication.cpp b/src/NotepadNext/NotepadNextApplication.cpp index 3e79b55df..c4533dc66 100644 --- a/src/NotepadNext/NotepadNextApplication.cpp +++ b/src/NotepadNext/NotepadNextApplication.cpp @@ -29,7 +29,19 @@ #include "LuaState.h" #include "lua.hpp" + +// This is the only fix needed for CMake. +// When you include a CMake project, properly, the includes will get +// subdirectory to avoid name collision (imagine two sub-projects having +// an "assert.h" file). +// Some of the 3rd parties have been fixed manually to avoid this, but as +// the internal code/git-sub-modules will get removed - these kind of hacks +// will get removed, and all includes will have a prefix. +#if defined(CMAKE_EXPERIMENTAL) +#include "LuaBridge/LuaBridge.h" +#else #include "LuaBridge.h" +#endif #include "EditorConfigAppDecorator.h" diff --git a/src/NotepadNext/lua.hpp b/src/NotepadNext/lua.hpp new file mode 100644 index 000000000..a90b62948 --- /dev/null +++ b/src/NotepadNext/lua.hpp @@ -0,0 +1,14 @@ +// lua.hpp +// Lua header files for C++ +// <> not supplied automatically because Lua also compiles as C++ + +extern "C" { +#include +#include +#include +} + +// This got removed in LUA v5.4.4 +#ifndef LUA_QL +#define LUA_QL(x) "'" x "'" +#endif