Skip to content

Commit

Permalink
QT WebSocketServer (#25)
Browse files Browse the repository at this point in the history
* QT gui api server
* removes QT window functions
* removes gitsubmodule for gui html files.
* refactors gui folder.
* MacOS GUI Bundle + Github Action
* linux gui bundle + Github Action
* windows GUI build + Github Action
* windows GHA install action
* embed icons to binary
* adds tray icon
  • Loading branch information
Snider authored Feb 27, 2023
1 parent fc3a837 commit 966d689
Show file tree
Hide file tree
Showing 42 changed files with 487 additions and 1,239 deletions.
56 changes: 0 additions & 56 deletions .github/gui-testnet.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/cli-testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
key: ccache-${{ runner.os }}-build-testnet-cli-${{ github.sha }}
restore-keys: ccache-${{ runner.os }}-build-testnet-cli-
- name: update apt
run: sudo apt update & sudo apt-get upgrade -y
run: sudo apt update
- name: install dependencies
run: sudo apt-get install -y python-dev autotools-dev libboost-all-dev libicu-dev libbz2-dev git screen checkinstall zlib1g-dev ccache miniupnpc
- name: build server
Expand Down
164 changes: 164 additions & 0 deletions .github/workflows/gui-testnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
name: "gui-testnet"
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
push:
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'

env:
CCACHE_SETTINGS: |
ccache --max-size=150M
ccache --set-config=compression=true
jobs:
linux-amd64:
runs-on: ubuntu-20.04
env:
CCACHE_TEMPDIR: /tmp/.ccache-temp
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- uses: actions/cache@v3
with:
path: ~/.ccache
key: ccache-${{ runner.os }}-build-testnet-gui
restore-keys: ccache-${{ runner.os }}-build-testnet-gui
- name: update apt
run: sudo apt update
- name: install dependencies
run: sudo apt-get install -y qt5-default qtwebengine5-dev libqt5websockets5-dev python-dev autotools-dev libboost-all-dev libicu-dev libbz2-dev git screen checkinstall zlib1g-dev ccache miniupnpc
- name: build server
env:
QT_PREFIX_PATH: /usr/lib/qt5
run: |
${{env.CCACHE_SETTINGS}}
./utils/build/testnet_linux_gui.sh
- uses: actions/upload-artifact@v3
with:
name: lethean-gui-bundle-linux-testnet-x86_64
if-no-files-found: error
path: lethean-gui-bundle-linux-testnet-x86_64.tar.bz2
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ github.workspace }}/lethean-gui-bundle-linux-testnet-x86_64.tar.bz2
macos-amd64:
runs-on: macos-latest
env:
CCACHE_TEMPDIR: /tmp/.ccache-temp
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- uses: actions/cache@v3
with:
path: /Users/runner/Library/Caches/ccache
key: ccache-${{ runner.os }}-build-testnet-gui
restore-keys: ccache-${{ runner.os }}-build-testnet-gui
- name: install dependencies
run: HOMEBREW_NO_AUTO_UPDATE=1 brew install openssl boost icu4c ccache miniupnpc qt@5
- name: build server
env:
PKG_CONFIG_PATH: "/usr/local/opt/openssl@3/lib/pkgconfig"
OPENSSL_ROOT_DIR: "/usr/local/opt/openssl@3"
ZANO_BOOST_ROOT: "/usr/local/opt/boost"
ZANO_BOOST_LIBS_PATH: "/usr/local/opt/boost/lib"
ZANO_QT_PATH: "/usr/local/opt/qt@5"
CMAKE_OSX_SYSROOT: "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk"
run: |
${{env.CCACHE_SETTINGS}}
export LIBRARY_PATH=${LIBRARY_PATH}:/usr/local/opt/icu4c/lib
./utils/build/testnet_mac_osx_gui.sh
- uses: actions/upload-artifact@v3
with:
name: lethean-gui-bundle-macos-testnet-i386
if-no-files-found: error
path: lethean-gui-bundle-macos-testnet-i386.tar.bz2
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ github.workspace }}/lethean-gui-bundle-macos-testnet-i386.tar.bz2
windows-amd64:
runs-on: windows-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- uses: actions/cache@v3
with:
path: ~\.ccache
key: ccache-${{ runner.os }}-build-testnet-cli
restore-keys: ccache-${{ runner.os }}-build-testnet-cli
- name: Eat the Choco
run: |
choco install openssl --version 1.1.1.1500 -y
choco install ccache -y
choco install zip -y
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: '5.15.2'
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2019_64'
dir: '${{ github.workspace }}/example/'
modules: 'qtcharts qtwebengine'
- name: install msvc toolset
uses: ilammy/msvc-dev-cmd@v1
- name: Install boost
uses: MarkusJx/[email protected]
id: install-boost
with:
# REQUIRED: Specify the required boost version
# A list of supported versions can be found here:
# https://github.com/MarkusJx/prebuilt-boost/blob/main/versions-manifest.json
boost_version: 1.80.0
platform_version: 2022
toolset: msvc
link: static
- name: Set up Visual Studio shell
uses: egor-tensin/vs-shell@v2
with:
arch: x64
- name: build server
env:
QT_PREFIX_PATH: ${{ github.workspace }}/example/Qt/5.15.2/win64_msvc2019_64
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
LOCAL_BOOST_PATH: ${{ steps.install-boost.outputs.BOOST_ROOT }}
OPENSSL_ROOT_DIR: "C:\\Program Files\\OpenSSL-Win64"
run: |
refreshenv
${{env.CCACHE_SETTINGS}}
.\utils\build\testnet_windows_gui.bat
- uses: actions/upload-artifact@v3
with:
name: lethean-gui-bundle-win-testnet-x64
if-no-files-found: error
path: ${{ github.workspace }}\lethean-gui-bundle-win-testnet-x64.zip
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ github.workspace }}\lethean-gui-bundle-win-testnet-x64.zip
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
[submodule "contrib/miniupnp"]
path = contrib/miniupnp
url = https://github.com/miniupnp/miniupnp
[submodule "src/gui/qt-daemon/layout"]
path = src/gui/qt-daemon/layout
url = https://github.com/letheanVPN/iTw3_ui.git
branch = main
[submodule "contrib/tor-connect"]
path = contrib/tor-connect
url = https://github.com/letheanVPN/tor-connect.git
Expand Down
4 changes: 2 additions & 2 deletions .idea/cmake.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/runConfigurations/daemon.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/simplewallet.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/runConfigurations/wallet.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 13 additions & 38 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,11 @@ file(GLOB_RECURSE WALLET wallet/*)
file(GLOB_RECURSE MINER miner/*)

if(BUILD_GUI)
if(MSVC)
file(GLOB_RECURSE QTDAEMON gui/qt-daemon/*.cpp gui/qt-daemon/*.h gui/qt-daemon/app.rc)
elseif(APPLE)
file(GLOB_RECURSE QTDAEMON gui/qt-daemon/*.cpp gui/qt-daemon/*.h gui/qt-daemon/*.mm)
if(APPLE)
file(GLOB_RECURSE QTSERVER gui/*.cpp gui/*.h gui/*.mm)
else()
file(GLOB_RECURSE QTDAEMON gui/qt-daemon/*.cpp gui/qt-daemon/*.h)
file(GLOB_RECURSE QTSERVER gui/*.cpp gui/*.h)
endif()
list(FILTER QTDAEMON EXCLUDE REGEX "node_modules")
endif()


Expand All @@ -94,7 +91,7 @@ source_group(connectivity-tool FILES ${CONN_TOOL})
source_group(wallet FILES ${WALLET})

if(BUILD_GUI)
source_group(qtdaemon FILES ${QTDAEMON})
source_group(qtserver FILES ${QTSERVER})
endif()


Expand Down Expand Up @@ -183,23 +180,27 @@ set_property(TARGET common crypto currency_core rpc stratum wallet PROPERTY FOLD
set_property(TARGET daemon simplewallet connectivity_tool PROPERTY FOLDER "prog")
set_property(TARGET daemon PROPERTY OUTPUT_NAME "letheand")


if(BUILD_GUI)

if(APPLE)
FIND_LIBRARY(COCOA_LIBRARY Cocoa)
endif()

set(AUTORCC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
SET(MACOSX_BUNDLE_ICON_FILE app.icns)
add_executable(Lethean WIN32 MACOSX_BUNDLE ${QTDAEMON} )
ENABLE_SHARED_PCH(Lethean QTDAEMON)
# SET(MACOSX_BUNDLE_ICON_FILE app.icns)
qt5_add_resources (RCC_SOURCES gui/resources/files.qrc)
add_executable(Lethean WIN32 MACOSX_BUNDLE ${QTSERVER} ${RCC_SOURCES} )
ENABLE_SHARED_PCH(Lethean QTSERVER)
ENABLE_SHARED_PCH_EXECUTABLE(Lethean)
set_property(TARGET Lethean PROPERTY OUTPUT_NAME "lethean-gui-server")

QT5_USE_MODULES(Lethean WebEngineWidgets WebChannel)
QT5_USE_MODULES(Lethean WebEngineWidgets WebChannel WebSockets)
find_package(Qt5PrintSupport REQUIRED)

target_link_libraries(Lethean wallet rpc currency_core crypto common zlibstatic ethash Qt5::WebEngineWidgets Qt5::PrintSupport ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
target_link_libraries(Lethean wallet rpc currency_core crypto common zlibstatic ethash Qt5::WebSockets Qt5::WebEngineWidgets Qt5::PrintSupport ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
if (UNIX AND NOT APPLE)
target_link_libraries(Lethean rt)
endif()
Expand All @@ -213,33 +214,7 @@ if(BUILD_GUI)
endif()

set_property(TARGET Lethean PROPERTY FOLDER "prog")
set_target_properties(Lethean PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/gui/qt-daemon/Info.plist.in)

set(HTML_DIR ${CMAKE_CURRENT_SOURCE_DIR}/gui/qt-daemon/layout/html)
set_target_properties(Lethean PROPERTIES VS_DEBUGGER_COMMAND_ARGUMENTS "--html-path=${HTML_DIR}")

set(CMAKE_AUTOMOC OFF)

# GUI convenience "bundle"
# set(GUI_DIR ${CMAKE_CURRENT_BINARY_DIR}/gui)
# set_target_properties(Lethean PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${GUI_DIR})
# add_custom_command(TARGET Lethean POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${HTML_DIR} ${GUI_DIR}/html)
endif()

if(APPLE)
set(SIMPLE_BUNDLE 1)
endif()

if(SIMPLE_BUNDLE)
set(INSTALL_DIR "${CMAKE_BINARY_DIR}/hp-${VERSION}")
install(TARGETS daemon simplewallet connectivity_tool
RUNTIME DESTINATION "${INSTALL_DIR}" COMPONENT Runtime
)

install(FILES ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} DESTINATION "${INSTALL_DIR}/lib")

if(APPLE)
set(FIXUP_COMMAND ${CMAKE_SOURCE_DIR}/utils/macosx_fixup.sh " " ${INSTALL_DIR})
install(CODE "execute_process(COMMAND ${FIXUP_COMMAND})")
endif()
endif()
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 966d689

Please sign in to comment.