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
73 changes: 72 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
path: neopdf_capi-${{ matrix.target }}.tar.gz

publish-release:
needs: [capi-macos, cli-macos, capi-linux, cli-linux]
needs: [capi-macos, cli-macos, capi-linux, cli-linux, gui-macos, gui-linux]
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
steps:
Expand All @@ -166,6 +166,77 @@ jobs:
find artifacts -name 'neopdf_*' ! -name '*.whl' -type f -exec gh release upload v${version} {} +
gh release edit v${version} --draft=false

gui-macos:
needs: capi-macos
strategy:
matrix:
include:
- os: macos-13
target: x86_64-apple-darwin
- os: macos-14
target: aarch64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Qt
run: brew install qt6
- name: Set Qt path
run: echo "CMAKE_PREFIX_PATH=$(brew --prefix qt6)" >> $GITHUB_ENV
- name: Download capi artifact
uses: actions/download-artifact@v4
with:
name: neopdf_capi-${{ matrix.target }}
path: neopdf_capi_artifact
- name: Build and package
run: |
mkdir capi_install
tar -xzf neopdf_capi_artifact/neopdf_capi-${{ matrix.target }}.tar.gz -C capi_install
export CARGO_C_INSTALL_PREFIX=$(pwd)/capi_install
cmake -S neopdf_gui -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(pwd)/install -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH
cmake --build build --config Release
cmake --install build
cd install
cpack
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: neopdf_gui-${{ matrix.target }}
path: install/*.dmg

gui-linux:
needs: capi-linux
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64-unknown-linux-gnu]
steps:
- uses: actions/checkout@v4
- name: Install Qt and build essentials
run: |
sudo apt-get update
sudo apt-get install -y build-essential qt6-base-dev qt6-charts-dev
- name: Download capi artifact
uses: actions/download-artifact@v4
with:
name: neopdf_capi-${{ matrix.target }}
path: neopdf_capi_artifact
- name: Build and package
run: |
mkdir capi_install
tar -xzf neopdf_capi_artifact/neopdf_capi-${{ matrix.target }}.tar.gz -C capi_install
export CARGO_C_INSTALL_PREFIX=$(pwd)/capi_install
cmake -S neopdf_gui -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(pwd)/install
cmake --build build --config Release
cmake --install build
cd install
cpack
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: neopdf_gui-${{ matrix.target }}
path: install/*.tar.gz


publish-crates:
runs-on: ubuntu-latest
container: ghcr.io/qcdlab/neopdf-container:latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/target
/neopdf_gui/build/
/neopdf_capi/docs/build/
/neopdf_capi/docs/xml/
/neopdf_capi/docs/html/
Expand Down
4 changes: 4 additions & 0 deletions maintainer/make-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ sed -i \
Cargo.toml
git add Cargo.toml

# update GUI version
sed -i "s/^project(neopdf_gui VERSION .*)/project(neopdf_gui VERSION ${version})/" neopdf_gui/CMakeLists.txt
git add neopdf_gui/CMakeLists.txt

echo ">>> Updating Cargo.lock ..."

# update explicit version for `neopdf_tmdlib` in `neopdf_cli`
Expand Down
106 changes: 106 additions & 0 deletions neopdf_gui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
cmake_minimum_required(VERSION 3.16)
project(neopdf_gui VERSION 0.1.0)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

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

find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Charts)

set(CARGO_C_INSTALL_PREFIX "$ENV{CARGO_C_INSTALL_PREFIX}")
if(DEFINED CARGO_C_INSTALL_PREFIX AND NOT CARGO_C_INSTALL_PREFIX STREQUAL "")
list(APPEND NEOPDF_CAPI_INCLUDE_SEARCH_PATHS "${CARGO_C_INSTALL_PREFIX}/include/neopdf_capi")
list(APPEND NEOPDF_CAPI_LIBRARY_SEARCH_PATHS "${CARGO_C_INSTALL_PREFIX}/lib")
else()
message(FATAL_ERROR "CARGO_C_INSTALL_PREFIX must be specified.")
endif()

find_path(
NEOPDF_CAPI_INCLUDE_DIR
NAMES NeoPDF.hpp neopdf_capi.h
PATHS ${NEOPDF_CAPI_INCLUDE_SEARCH_PATHS}
NO_DEFAULT_PATH
)
if(NOT NEOPDF_CAPI_INCLUDE_DIR)
message(FATAL_ERROR "Could not find NeoPDF.hpp/neopdf_capi.h.")
endif()

find_library(
NEOPDF_CAPI_LIBRARY
NAMES neopdf_capi
PATHS ${NEOPDF_CAPI_LIBRARY_SEARCH_PATHS}
NO_DEFAULT_PATH
)
if(NOT NEOPDF_CAPI_LIBRARY)
message(FATAL_ERROR "Could not find libneopdf_capi.")
endif()

message(STATUS "Found neopdf_capi library: ${NEOPDF_CAPI_LIBRARY}")
message(STATUS "Found neopdf_capi include dir: ${NEOPDF_CAPI_INCLUDE_DIR}")

add_executable(neopdf_gui
main.cpp
MainWindow.cpp
MainWindow.hpp
)

if(APPLE)
set_target_properties(neopdf_gui PROPERTIES
MACOSX_BUNDLE TRUE
)
endif()

target_link_libraries(neopdf_gui
PRIVATE
Qt6::Core
Qt6::Gui
Qt6::Widgets
Qt6::Charts
)

target_include_directories(neopdf_gui
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${NEOPDF_CAPI_INCLUDE_DIR}
)

target_link_libraries(neopdf_gui
PRIVATE
${NEOPDF_CAPI_LIBRARY}
)

target_compile_definitions(neopdf_gui PRIVATE QT_NO_FILESYSTEM)

install(TARGETS neopdf_gui
BUNDLE DESTINATION .
RUNTIME DESTINATION bin
)

if(WIN32)
set(QT_DEPLOY_TOOL windeployqt)
elseif(APPLE)
set(QT_DEPLOY_TOOL macdeployqt)
endif()

if(QT_DEPLOY_TOOL)
find_program(QT_DEPLOY_TOOL_PATH ${QT_DEPLOY_TOOL} HINTS ${Qt6_BIN_DIR})
if(QT_DEPLOY_TOOL_PATH)
if(WIN32)
set(APP_PATH "\"${CMAKE_INSTALL_PREFIX}/bin/neopdf_gui.exe\"")
elseif(APPLE)
set(APP_PATH "\"${CMAKE_INSTALL_PREFIX}/neopdf_gui.app\"")
endif()
install(CODE "execute_process(COMMAND ${QT_DEPLOY_TOOL_PATH} ${APP_PATH})")
endif()
endif()

set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_GENERATOR "TGZ")
if(APPLE)
set(CPACK_GENERATOR "DragNDrop")
endif()

include(CPack)
Loading