Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 64 additions & 64 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
- main
workflow_dispatch:

env:
APP_NAME: codepointer

jobs:
build-cmake:
name: Build ${{ matrix.config.name }} Qt ${{ matrix.qt_version }}
Expand Down Expand Up @@ -76,120 +79,117 @@ jobs:
platform: x64
- name: Install missing packages (linux)
if: matrix.config.os == 'ubuntu-22.04'
run: sudo apt install libcups2-dev
run: sudo apt install -y libcups2-dev
- name: Setup MSVC (Windows)
if: ${{ matrix.config.cxx == 'cl' }}
if: matrix.config.cxx == 'cl'
uses: ilammy/msvc-dev-cmd@v1
- name: Configure
working-directory: ${{ github.workspace }}
id: runcmake
run: cmake -B "build/${{ matrix.config.build_dir }}" -G "${{ matrix.generators }}" -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" -DCMAKE_C_COMPILER=${{ matrix.config.cc }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DBUILD_VERSION=OFFICIAL
run: >
cmake
-B build/${{ matrix.config.build_dir }}
-G "${{ matrix.generators }}"
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_C_COMPILER=${{ matrix.config.cc }}
-DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }}
-DBUILD_VERSION=OFFICIAL
- name: Build
working-directory: ${{ github.workspace }}
id: runcmakebuild
run: |
cmake --build "build/${{ matrix.config.build_dir }}" --parallel --verbose
run: cmake --build build/${{ matrix.config.build_dir }} --parallel --verbose
- name: Install
working-directory: ${{ github.workspace }}
id: runcmakeinstall
run: |
cmake --install "build/${{ matrix.config.build_dir }}" --prefix="dist/${{ matrix.config.build_dir }}/usr"

run: >
cmake --install build/${{ matrix.config.build_dir }}
--prefix dist/${{ matrix.config.build_dir }}/usr
- name: Set version tag or commit SHA
id: version
shell: bash
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
echo "version=${GITHUB_REF##refs/tags/}" >> $GITHUB_ENV
else
echo "version=${GITHUB_SHA::7}" >> $GITHUB_ENV
fi
shell: bash

- name: Create TGZ archive (Linux)
if: matrix.config.os == 'ubuntu-22.04' && matrix.config.cc == 'gcc'
run: |
mkdir -p dist/qtedit4/
ln -s ../${{ matrix.config.build_dir }}/usr/ "dist/qtedit4/qtedit4-${{ matrix.config.build_dir }}-${{ env.version }}"
tar -czhf "dist/qtedit4-${{ matrix.config.build_dir }}-qt${{ matrix.qt_version }}-${{ env.version }}.tar.gz" -C "dist/qtedit4/" .
shell: bash
run: |
mkdir -p dist/${{ env.APP_NAME }}
ln -s ../${{ matrix.config.build_dir }}/usr \
dist/${{ env.APP_NAME }}/${{ env.APP_NAME }}-${{ matrix.config.build_dir }}-${{ env.version }}
tar -czhf \
dist/${{ env.APP_NAME }}-${{ matrix.config.build_dir }}-qt${{ matrix.qt_version }}-${{ env.version }}.tar.gz \
-C dist/${{ env.APP_NAME }} .

- name: Create AppImage (Linux)
if: matrix.config.os == 'ubuntu-22.04' && matrix.config.cc == 'gcc'
run: |
mkdir -p "dist/${{ matrix.config.build_dir }}/usr/plugins/iconengines/"
mkdir -p "dist/${{ matrix.config.build_dir }}/usr/plugins/platforms/"
cp -arv ${QT_ROOT_DIR}/plugins/iconengines/* "dist/${{ matrix.config.build_dir }}/usr/plugins/iconengines/"
cp -arv ${QT_ROOT_DIR}/plugins/platforms/libqwayland*.so "dist/${{ matrix.config.build_dir }}/usr/plugins/platforms/"

sudo apt install -y fuse libxkbcommon-x11-0 libxcb-cursor-dev libxkbcommon-dev
mkdir -p dist/${{ matrix.config.build_dir }}/usr/plugins/{iconengines,platforms}
cp -av ${QT_ROOT_DIR}/plugins/iconengines/* dist/${{ matrix.config.build_dir }}/usr/plugins/iconengines/
cp -av ${QT_ROOT_DIR}/plugins/platforms/libqwayland*.so dist/${{ matrix.config.build_dir }}/usr/plugins/platforms/
export LD_LIBRARY_PATH=dist/${{ matrix.config.build_dir }}/usr/lib:$LD_LIBRARY_PATH
export OUTPUT=build/qtedit4-${{ env.version }}-x86_64.AppImage

sudo apt install fuse libxkbcommon-x11-0 libxcb-cursor-dev libxkbcommon-dev

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"

export OUTPUT=build/${{ env.APP_NAME }}-${{ env.version }}-x86_64.AppImage
wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
wget -q https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
chmod +x linuxdeploy*.AppImage

./linuxdeploy-x86_64.AppImage --appdir "dist/${{ matrix.config.build_dir }}" --plugin qt --output appimage
./linuxdeploy-x86_64.AppImage \
--appdir dist/${{ matrix.config.build_dir }} \
--plugin qt \
--output appimage

- name: Upload AppImage (Linux)
if: matrix.config.os == 'ubuntu-22.04' && matrix.config.cc == 'gcc'
uses: actions/upload-artifact@v4
with:
name: qtedit4-${{ env.version }}-x86_64.AppImage
path: build/qtedit4-${{ env.version }}-x86_64.AppImage
name: ${{ env.APP_NAME }}-${{ env.version }}-x86_64.AppImage
path: build/${{ env.APP_NAME }}-${{ env.version }}-x86_64.AppImage

- name: Upload TGZ archive (Linux)
if: matrix.config.os == 'ubuntu-22.04' && matrix.config.cc == 'gcc'
uses: actions/upload-artifact@v4
with:
name: qtedit4-${{ matrix.config.build_dir }}-qt${{ matrix.qt_version }}-${{ env.version }}.tar.gz
path: "dist/qtedit4-${{ matrix.config.build_dir }}-qt${{ matrix.qt_version }}-${{ env.version }}.tar.gz"
name: ${{ env.APP_NAME }}-${{ matrix.config.build_dir }}-qt${{ matrix.qt_version }}-${{ env.version }}.tar.gz
path: dist/${{ env.APP_NAME }}-${{ matrix.config.build_dir }}-qt${{ matrix.qt_version }}-${{ env.version }}.tar.gz

- name: windeployqt (Windows)
working-directory: ${{ github.workspace }}
if: matrix.config.os == 'windows-2022' && matrix.config.cc == 'cl'
shell: cmd
run: |
windeployqt --release --no-translations --no-system-d3d-compiler --no-compiler-runtime --no-opengl-sw dist/${{ matrix.config.build_dir }}/usr/bin/qtedit4.exe
windeployqt --release --no-translations --no-system-d3d-compiler --no-compiler-runtime --no-opengl-sw dist/${{ matrix.config.build_dir }}/usr/bin/${{ env.APP_NAME }}.exe

- name: Create setup (Windows)
if: matrix.config.os == 'windows-2022' && matrix.config.cc == 'cl'
uses: Minionguyjpro/Inno-Setup-Action@v1.2.7
with:
path: "setup_script.iss"
path: setup_script.iss
options: /O+

- name: Rename and upload setup (Windows)
if: matrix.config.os == 'windows-2022' && matrix.config.cc == 'cl'
run: |
copy dist\qtedit4-win64.exe dist\qtedit4-${{ env.version }}-x86_64.exe
shell: cmd
run: |
copy dist\${{ env.APP_NAME }}-win64.exe dist\${{ env.APP_NAME }}-${{ env.version }}-x86_64.exe

- name: Upload renamed setup (Windows)
if: matrix.config.os == 'windows-2022' && matrix.config.cc == 'cl'
uses: actions/upload-artifact@v4
with:
name: qtedit4-${{ env.version }}-x86_64.exe
path: dist/qtedit4-${{ env.version }}-x86_64.exe
name: ${{ env.APP_NAME }}-${{ env.version }}-x86_64.exe
path: dist/${{ env.APP_NAME }}-${{ env.version }}-x86_64.exe

create-release:
name : Draft GitHub Release
needs : build-cmake
runs-on : ubuntu-latest
env :
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps :
- uses : actions/checkout@v4
- name : Download all artifacts
uses : actions/download-artifact@v4
with :
merge-multiple : true
path : ./artifacts
- name : Create Draft Release
run : |
gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --generate-notes --draft
- name : Upload assets to release
run : |
gh release upload ${{ github.ref_name }} ./artifacts/*
name: Draft GitHub Release
needs: build-cmake
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: ./artifacts
- name: Create Draft Release
run: gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --generate-notes --draft
- name: Upload assets to release
run: gh release upload ${{ github.ref_name }} ./artifacts/*
89 changes: 44 additions & 45 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
cmake_minimum_required(VERSION 3.20)
project (qtedit4)
project (codepointer)

set(BUILD_VERSION "DEV" CACHE STRING "Build version (DEV, CE, OFFICIAL)")
set_property(CACHE BUILD_VERSION PROPERTY STRINGS DEV CE OFFICIAL)

if(BUILD_VERSION STREQUAL "DEV")
set(APP_SUFFIX "-dev")
set(ICON_NAME "qtedit4-dev")
set(BUILD_APP_NAME "qtedit4-dev")
set(ICON_NAME "codepointer-dev")
set(BUILD_APP_NAME "codepointer-dev")
elseif(BUILD_VERSION STREQUAL "CE")
set(APP_SUFFIX "-ce")
set(ICON_NAME "qtedit4-ce")
set(BUILD_APP_NAME "qtedit4-ce")
set(ICON_NAME "codepointer-ce")
set(BUILD_APP_NAME "codepointer-ce")
else()
set(APP_SUFFIX "")
set(ICON_NAME "qtedit4")
set(BUILD_APP_NAME "qtedit4")
set(ICON_NAME "codepointer")
set(BUILD_APP_NAME "codepointer")
endif()

set(QTEDIT4_APP_NAME "${BUILD_APP_NAME}")
set(QTEDIT4_BINARY "qtedit4${APP_SUFFIX}")
set(QTEDIT4_ICON "${ICON_NAME}")
set(QTEDIT4_MACHINE_NAME "${MACHINE_IDENTIFIER}")
set(CODEPOINTER_APP_NAME "${BUILD_APP_NAME}")
set(CODEPOINTER_BINARY "codepointer${APP_SUFFIX}")
set(CODEPOINTER_ICON "${ICON_NAME}")
set(CODEPOINTER_MACHINE_NAME "${MACHINE_IDENTIFIER}")

set(CMAKE_VERBOSE_MAKEFILE OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
Expand All @@ -39,9 +39,9 @@ set(QUTEPART_USE_CMAKEFORMAT OFF)
set(QHEXVIEW_ENABLE_DIALOGS ON)
set(COMMAND_PALLETE_ENABLE_TESTS OFF)

option(QTEDIT4_WORK_OFFLINE OFF)
option(CODEPOINTER_WORK_OFFLINE OFF)

if (QTEDIT4_WORK_OFFLINE)
if (CODEPOINTER_WORK_OFFLINE)
# For this to work, you need to make these libraries available yourself.
# On Linux/macOS, you can run the script `get-code.sh`. This might work on Windows using
# git-bash, but is untested.
Expand Down Expand Up @@ -72,7 +72,7 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

set(qtedit4_sources
set(codepointer_sources
${qmdilib_SOURCE_DIR}/demos/common/common.qrc
${qmdilib_SOURCE_DIR}/demos/plugin-demo/iplugin.cpp
${qmdilib_SOURCE_DIR}/demos/plugin-demo/pluginmodel.cpp
Expand Down Expand Up @@ -155,44 +155,44 @@ set(qtedit4_sources
src/AnsiToHTML.cpp
src/AnsiToHTML.hpp
src/main.cpp
${CMAKE_BINARY_DIR}/qtedit4.qrc
${CMAKE_BINARY_DIR}/codepointer.qrc
)

file(COPY "${CMAKE_SOURCE_DIR}/${ICON_NAME}.svg" DESTINATION "${CMAKE_BINARY_DIR}")
file(COPY "${CMAKE_SOURCE_DIR}/${ICON_NAME}.ico" DESTINATION "${CMAKE_BINARY_DIR}")

configure_file(qtedit4.qrc.in ${CMAKE_BINARY_DIR}/qtedit4.qrc)
configure_file(qtedit4.desktop.in ${CMAKE_BINARY_DIR}/${QTEDIT4_APP_NAME}.desktop)
configure_file(codepointer.qrc.in ${CMAKE_BINARY_DIR}/codepointer.qrc)
configure_file(codepointer.desktop.in ${CMAKE_BINARY_DIR}/${CODEPOINTER_APP_NAME}.desktop)

if (WIN32)
add_executable(qtedit4 WIN32 ${qtedit4_sources} qtedit4.rc)
add_executable(codepointer WIN32 ${codepointer_sources} codepointer.rc)
else()
add_executable(qtedit4 ${qtedit4_sources})
add_executable(codepointer ${codepointer_sources})
endif()

if (!MINGW)
set_property(TARGET qtedit4PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
set_property(TARGET codepointerPROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()

target_compile_definitions(qtedit4 PRIVATE -DQTEDIT4_APP_NAME="${QTEDIT4_APP_NAME}")
target_compile_definitions(qtedit4 PRIVATE -DQTEDIT4_ICON=":${QTEDIT4_ICON}.ico")
target_compile_definitions(qtedit4 PRIVATE -DQTEDIT4_SVG_ICON=":${QTEDIT4_ICON}.svg")
target_compile_definitions(qtedit4 PRIVATE -DQTEDIT4_MACHINE_NAME="${QTEDIT4_MACHINE_NAME}")
target_compile_definitions(codepointer PRIVATE -DCODEPOINTER_APP_NAME="${CODEPOINTER_APP_NAME}")
target_compile_definitions(codepointer PRIVATE -DCODEPOINTER_ICON=":${CODEPOINTER_ICON}.ico")
target_compile_definitions(codepointer PRIVATE -DCODEPOINTER_SVG_ICON=":${CODEPOINTER_ICON}.svg")
target_compile_definitions(codepointer PRIVATE -DCODEPOINTER_MACHINE_NAME="${CODEPOINTER_MACHINE_NAME}")

if(BUILD_VERSION STREQUAL "DEV")
target_compile_definitions(qtedit4 PRIVATE -DBUILD_DEV)
target_compile_definitions(codepointer PRIVATE -DBUILD_DEV)
elseif(BUILD_VERSION STREQUAL "CE")
target_compile_definitions(qtedit4 PRIVATE -DBUILD_CE)
target_compile_definitions(codepointer PRIVATE -DBUILD_CE)
else()
target_compile_definitions(qtedit4 PRIVATE -DBUILD_OFFICIAL)
target_compile_definitions(codepointer PRIVATE -DBUILD_OFFICIAL)
endif()

target_include_directories(qtedit4 PUBLIC
target_include_directories(codepointer PUBLIC
${qmdilib_SOURCE_DIR}/demos/plugin-demo
${qutepart_SOURCE_DIR}/include
src
)
target_link_libraries(qtedit4 PUBLIC Qt6::Core Qt6::Widgets Qt6::Concurrent Qt6::Network Qt6::Svg Qt6::Xml
target_link_libraries(codepointer PUBLIC Qt6::Core Qt6::Widgets Qt6::Concurrent Qt6::Network Qt6::Svg Qt6::Xml
qmdilib
qutepart
CommandPaletteWidget
Expand All @@ -201,21 +201,21 @@ target_link_libraries(qtedit4 PUBLIC Qt6::Core Qt6::Widgets Qt6::Concurrent Qt6:
QSimpleUpdater
QJsonModelStatic
)
set_target_properties(qtedit4 PROPERTIES OUTPUT_NAME ${QTEDIT4_BINARY})
set_target_properties(codepointer PROPERTIES OUTPUT_NAME ${CODEPOINTER_BINARY})

if(MSVC)
# if we don't do this - file will be under Debug/Relase subdir
set_target_properties(qtedit4 PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}$<0:>)
target_compile_options(qtedit4 PRIVATE /W4)
set_target_properties(codepointer PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}$<0:>)
target_compile_options(codepointer PRIVATE /W4)
else()
set_target_properties(qtedit4 PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
target_compile_options(qtedit4 PRIVATE -Wall -Wextra -Wpedantic)
set_target_properties(codepointer PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
target_compile_options(codepointer PRIVATE -Wall -Wextra -Wpedantic)
endif()

install(TARGETS qtedit4
install(TARGETS codepointer
RUNTIME DESTINATION bin)

if (NOT QTEDIT4_WORK_OFFLINE)
if (NOT CODEPOINTER_WORK_OFFLINE)
install(DIRECTORY ${CMAKE_BINARY_DIR}/share/
DESTINATION share/
DIRECTORY_PERMISSIONS
Expand All @@ -225,21 +225,20 @@ if (NOT QTEDIT4_WORK_OFFLINE)
endif()

if (WIN32)
install(FILES ${CMAKE_SOURCE_DIR}/${QTEDIT4_ICON}.svg
install(FILES ${CMAKE_SOURCE_DIR}/${CODEPOINTER_ICON}.svg
DESTINATION /)
install(FILES ${CMAKE_SOURCE_DIR}/${QTEDIT4_ICON}.ico
install(FILES ${CMAKE_SOURCE_DIR}/${CODEPOINTER_ICON}.ico
DESTINATION /)
else()
install(FILES ${CMAKE_SOURCE_DIR}/${QTEDIT4_ICON}.svg
install(FILES ${CMAKE_SOURCE_DIR}/${CODEPOINTER_ICON}.svg
DESTINATION share/icons/hicolor/scalable/apps)
install(FILES ${CMAKE_BINARY_DIR}/${QTEDIT4_APP_NAME}.desktop
install(FILES ${CMAKE_BINARY_DIR}/${CODEPOINTER_APP_NAME}.desktop
DESTINATION share/applications
RENAME org.diegoiast.${QTEDIT4_APP_NAME}.desktop)
RENAME org.codepointerapp.${CODEPOINTER_APP_NAME}.desktop)

install(FILES ${CMAKE_SOURCE_DIR}/${QTEDIT4_ICON}.svg
install(FILES ${CMAKE_SOURCE_DIR}/${CODEPOINTER_ICON}.svg
DESTINATION share/icons/hicolor/scalable/apps
RENAME org.diegoiast.${QTEDIT4_APP_NAME}.svg)
install(FILES org.diegoiast.qtedit4.appdata.xml
RENAME org.codepointerapp.${CODEPOINTER_APP_NAME}.svg)
install(FILES org.codepointerapp.codepointer.appdata.xml
DESTINATION share/metainfo)

endif()
Loading