Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert project to CMake #305

Draft
wants to merge 29 commits into
base: 3.0-dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
4f1ad4b
Remove StreamCli and StreamServer
marcusbirkin Mar 13, 2023
956aa38
Convert to CMake - Windows build compiles
marcusbirkin Mar 15, 2023
4e53766
Fix translations
marcusbirkin Mar 15, 2023
95794fc
Use pre-compiled npcap-sdk for pcap playback on Windows
marcusbirkin Mar 15, 2023
6978ed8
CMake Linux fixes
marcusbirkin Mar 15, 2023
2cfcd4b
Fix Breakpad
marcusbirkin Mar 15, 2023
de6f17b
blake2 patch halted cmake when already applied
marcusbirkin Mar 16, 2023
e837e41
Add back ExceptionHandler for MacOS (Untested)
marcusbirkin Mar 16, 2023
852e5c1
Show git progress on dependencies
marcusbirkin Mar 16, 2023
577bdfd
Link OpenSSL (Linux)
marcusbirkin Mar 16, 2023
5aeb545
Link OpenSSL (Windows)
marcusbirkin Mar 17, 2023
7f4adb2
No need to copy OpenSSL documentation
marcusbirkin Mar 18, 2023
2bc4d82
Build with CMake on Github actions
marcusbirkin Mar 18, 2023
b2db090
Missing QtChart for CI
marcusbirkin Mar 18, 2023
8dcdddf
Correct MacOS icns location
marcusbirkin Mar 18, 2023
0a9c791
Fix macOS crash_handler message
marcusbirkin Mar 18, 2023
0b28ed8
Blake2 is C not C++, compile as such!
marcusbirkin Mar 18, 2023
6408a5b
macOS Missing compilation objects for breakpad
marcusbirkin Mar 18, 2023
638aa48
OpenSSL: Windows use portable Strawberry Perl to config
marcusbirkin Mar 20, 2023
db8674d
Win32: Fix dumpmessage
marcusbirkin Mar 20, 2023
e169a6a
OpenSSL: Apple dylib filename format
marcusbirkin Mar 20, 2023
81c8859
Clean up logo files and naming
marcusbirkin Apr 1, 2023
f126503
OpenSSL: Linux RPath
marcusbirkin Apr 1, 2023
d44c03b
CPack: Linux Deb and AppImage
marcusbirkin Apr 1, 2023
c1cf1c5
CI: Clean up
marcusbirkin Apr 1, 2023
d35d432
Win32: Delay load pcap
marcusbirkin Jun 24, 2023
35c4869
Win32: Final build fixes
marcusbirkin Jun 21, 2023
dc9f07d
Clean up git ignore
marcusbirkin Jun 24, 2023
8c9c1ba
CPack: Windows NSIS installer
marcusbirkin Jun 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
61 changes: 27 additions & 34 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,31 @@ jobs:
fail-fast: false
matrix:
# https://github.com/actions/virtual-environments#available-environments
os: [ubuntu-20.04, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-latest]
qt: ['6.2.4']
include:
- os: ubuntu-20.04 # Oldest LTS for appimage support
qt: '6.2.4' # Qt6 LTS
qt_modules: 'qtmultimedia'
- os: ubuntu-latest
qt_modules: 'qtmultimedia qtcharts'
dependencies: |
sudo apt-get install mesa-common-dev libgl1-mesa-dev libpcap-dev libgstreamer-gl1.0-0 libgstreamer-plugins-base1.0-0 libxkbcommon-x11-0 -y
installer_setup: |
sudo gem install --no-document fpm
make_cmd: make
sudo apt-get install mesa-common-dev libgl1-mesa-dev libpcap-dev libgstreamer-gl1.0-0 libgstreamer-plugins-base1.0-0 libxkbcommon-x11-0 libfuse2 -y
artifact: |
install/linux/sACNView*.AppImage
install/linux/*.deb
build/sacnview*.deb
build/sACNView*.AppImage

- os: windows-latest
qt: '6.2.4' # Qt6 LTS
qt_modules: 'qtmultimedia'
installer_setup: |
Invoke-WebRequest -Uri "https://nsis.sourceforge.io/mediawiki/images/e/e0/NSIS_Simple_Firewall_Plugin_Unicode_1.21.zip" -OutFile "NSIS_Simple_Firewall_Plugin_Unicode.zip"
7z e NSIS_Simple_Firewall_Plugin_Unicode.zip -o"C:\Program Files (x86)\NSIS\Plugins\x86-unicode"
arch: win32_msvc2019
make_cmd: nmake
qt_modules: 'qtmultimedia qtcharts'
dependencies : |
choco install -y winflexbison3
arch: amd64
artifact: |
install/win/sACNView*.exe
release/*.pdb
build/src/sACNView.exe
build/src/sACNView.pdb

- os: macos-latest
qt: '6.2.4' # Qt6 LTS
qt_modules: 'qtmultimedia'
installer_setup: |
brew install create-dmg
qt_modules: 'qtmultimedia qtcharts'
xcode: latest-stable
make_cmd: make
artifact: install/mac/sACNView*.dmg
artifact:
build/src/sACNView

steps:
- name: Checkout
Expand All @@ -73,28 +64,30 @@ jobs:
- name: Dependencies
run: ${{ matrix.dependencies }}

- name: Setup Installer
run: ${{ matrix.installer_setup }}

- name: Environment Setup (MSVC)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}

- name: Environment Setup (Xcode)
if: runner.os == 'macOS'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode }}

- name: Run qmake
- name: Configure Build
shell: bash
run: |
if [[ -n "${Qt5_DIR}" ]]; then export QTDIR=${Qt5_DIR}; fi
if [[ -n "${Qt6_DIR}" ]]; then export QTDIR=${Qt6_DIR}; fi
qmake sACNView.pro
if [[ -n "${Qt5_DIR}" ]]; then export CMAKE_PREFIX_PATH=${Qt5_DIR}; fi
if [[ -n "${Qt6_DIR}" ]]; then export CMAKE_PREFIX_PATH=${Qt6_DIR}; fi
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release

- name: Build
run: cmake --build build --config Release

- name: Run make
run: ${{ matrix.make_cmd }}
- name: Pack
run: cmake --build build --config Release --target package

- name: Upload Artifact(s)
uses: actions/upload-artifact@v3
Expand Down
23 changes: 9 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,28 @@ Makefile*
*-build-*

# QtCreator

CMakeLists.txt.user
*.autosave

#QtCtreator Qml
# QtCtreator Qml
*.qmlproject.user
*.qmlproject.user.*

#Linux libs
*.so.*
# VSCode
.vs

#Libs
!libs/**
# Linux libs
*.so.*

#Binary Output
# Build folder and Binary Output
/build
*.exe
*.zip
*.dmg
*.AppImage
*.deb

#Linux installer autogenerated
# Linux installer autogenerated
install/linux/AppDir/\.DirIcon
install/linux/AppDir/AppRun
install/linux/AppDir/*.desktop
Expand All @@ -62,9 +63,3 @@ install/linux/usr/share/icons/hicolor/48x48/apps/sacnview\.png
install/linux/usr/share/icons/hicolor/scalable/apps/sacnview\.png
install/linux/build/
install/linux/fpm-checkout/

#Translations
translations/sACNView\.ts

#Breakpad
libs/breakpad/
9 changes: 0 additions & 9 deletions .gitmodules

This file was deleted.

27 changes: 27 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
cmake_minimum_required(VERSION 3.5)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

set(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
include(gitversion)
project(sACNView LANGUAGES CXX C
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK})

set(CMAKE_INCLUDE_CURRENT_DIR ON)

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

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_definitions (-DQT_DISABLE_DEPRECATED_BEFORE=0x060000) # disables all the APIs deprecated before Qt 6.0.0

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)

# Main App
add_subdirectory(src)

# Package builder
include(package)
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,5 @@ The application uses a couple of external libraries:

* Google Breakpad for crash reporting
* LibPCAP for captured packet playback

You need to acquire the Breakpad library by using the git `submodule` command

1. Clone the repository (`git clone https://github.com/docsteer/sacnview.git`)
2. Switch to the directory (`cd sacnview`)
3. Initialize the submodules (`git submodule init`)
4. Download the submodule (`git submodule update`)

After that, to build, open the .PRO file in the root directory and build with Qt Creator
* Blake2 for Pathway Secure Protocol

2 changes: 2 additions & 0 deletions cmake/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#Generated files
package_prebuild.cmake
41 changes: 41 additions & 0 deletions cmake/blake2.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
cmake_minimum_required(VERSION 3.14)
include(FetchContent)

set(FETCHCONTENT_QUIET OFF)

FetchContent_Declare(
blake2
GIT_REPOSITORY https://github.com/BLAKE2/BLAKE2.git
GIT_TAG ed1974ea83433eba7b2d95c5dcd9ac33cb847913
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
PATCH_COMMAND git reset --hard && git apply --ignore-space-change --ignore-whitespace ${PROJECT_SOURCE_DIR}/patch/blake2.patch
UPDATE_COMMAND ""
)
FetchContent_MakeAvailable(blake2)

# Check if SSE2 is supported by target
include(CheckCCompilerFlag)
if (CMAKE_C_COMPILER_ID MATCHES "MSVC")
if(MSVC_C_ARCHITECTURE_ID MATCHES 64)
set(SSE2_SUPPORTED 1)
elseif()
check_c_compiler_flag("/arch:SSE2" SSE2_SUPPORTED)
endif()
else()
check_c_compiler_flag("-msse2" SSE2_SUPPORTED)
endif()
if(SSE2_SUPPORTED)
set(BLAKE2_INCLUDE_DIR ${blake2_SOURCE_DIR}/sse)
else()
set(BLAKE2_INCLUDE_DIR ${blake2_SOURCE_DIR}/ref)
endif()

file(GLOB_RECURSE BLAKE2_HEADERS CONFIGURE_DEPENDS "${BLAKE2_INCLUDE_DIR}/*.h")
file(GLOB_RECURSE BLAKE2_SOURCES CONFIGURE_DEPENDS "${BLAKE2_INCLUDE_DIR}/*.c")
set_source_files_properties(${BLAKE2_SOURCES} PROPERTIES LANGUAGE C)
add_library(Blake2 STATIC
${BLAKE2_HEADERS}
${BLAKE2_SOURCES}
)
target_include_directories(Blake2 PRIVATE ${BLAKE2_INCLUDE_DIR})
104 changes: 104 additions & 0 deletions cmake/breakpad.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
cmake_minimum_required(VERSION 3.16.9)

include(FetchContent)
set(FETCHCONTENT_QUIET OFF)

FetchContent_Declare(
breakpad
GIT_REPOSITORY https://chromium.googlesource.com/breakpad/breakpad
GIT_TAG origin/main
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(breakpad)
set(BREAKPAD_INCLUDE_DIR ${breakpad_SOURCE_DIR}/src)

FetchContent_Declare(
lss
GIT_REPOSITORY https://chromium.googlesource.com/linux-syscall-support
GIT_TAG origin/main
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
SOURCE_DIR ${breakpad_SOURCE_DIR}/src/third_party/lss
)
FetchContent_MakeAvailable(lss)

if (UNIX)
list(APPEND BREAKPAD_SOURCES
${BREAKPAD_INCLUDE_DIR}/client/minidump_file_writer.cc
${BREAKPAD_INCLUDE_DIR}/common/convert_UTF.cc
${BREAKPAD_INCLUDE_DIR}/common/md5.cc
${BREAKPAD_INCLUDE_DIR}/common/string_conversion.cc
)
endif()

if(APPLE)
list(APPEND BREAKPAD_HEADERS
${BREAKPAD_INCLUDE_DIR}/client/mac/handler/exception_handler.h
)
list(APPEND BREAKPAD_SOURCES
${BREAKPAD_INCLUDE_DIR}/client/mac/crash_generation/crash_generation_client.cc
${BREAKPAD_INCLUDE_DIR}/client/mac/handler/breakpad_nlist_64.cc
${BREAKPAD_INCLUDE_DIR}/client/mac/handler/dynamic_images.cc
${BREAKPAD_INCLUDE_DIR}/client/mac/handler/exception_handler.cc
${BREAKPAD_INCLUDE_DIR}/client/mac/handler/minidump_generator.cc
${BREAKPAD_INCLUDE_DIR}/client/mac/handler/protected_memory_allocator.cc
${BREAKPAD_INCLUDE_DIR}/common/mac/MachIPC.mm
${BREAKPAD_INCLUDE_DIR}/common/mac/arch_utilities.cc
${BREAKPAD_INCLUDE_DIR}/common/mac/bootstrap_compat.cc
${BREAKPAD_INCLUDE_DIR}/common/mac/dump_syms.cc
${BREAKPAD_INCLUDE_DIR}/common/mac/file_id.cc
${BREAKPAD_INCLUDE_DIR}/common/mac/launch_reporter.cc
${BREAKPAD_INCLUDE_DIR}/common/mac/macho_id.cc
${BREAKPAD_INCLUDE_DIR}/common/mac/macho_reader.cc
${BREAKPAD_INCLUDE_DIR}/common/mac/macho_utilities.cc
${BREAKPAD_INCLUDE_DIR}/common/mac/macho_walker.cc
${BREAKPAD_INCLUDE_DIR}/common/mac/string_utilities.cc
)
endif()

if((UNIX) AND (NOT APPLE))
list(APPEND BREAKPAD_HEADERS
${BREAKPAD_INCLUDE_DIR}/client/linux/handler/exception_handler.h
)
list(APPEND BREAKPAD_SOURCES
${BREAKPAD_INCLUDE_DIR}/client/linux/crash_generation/crash_generation_client.cc
${BREAKPAD_INCLUDE_DIR}/client/linux/dump_writer_common/thread_info.cc
${BREAKPAD_INCLUDE_DIR}/client/linux/dump_writer_common/ucontext_reader.cc
${BREAKPAD_INCLUDE_DIR}/client/linux/handler/exception_handler.cc
${BREAKPAD_INCLUDE_DIR}/client/linux/handler/minidump_descriptor.cc
${BREAKPAD_INCLUDE_DIR}/client/linux/log/log.cc
${BREAKPAD_INCLUDE_DIR}/client/linux/microdump_writer/microdump_writer.cc
${BREAKPAD_INCLUDE_DIR}/client/linux/minidump_writer/linux_core_dumper.cc
${BREAKPAD_INCLUDE_DIR}/client/linux/minidump_writer/linux_dumper.cc
${BREAKPAD_INCLUDE_DIR}/client/linux/minidump_writer/linux_ptrace_dumper.cc
${BREAKPAD_INCLUDE_DIR}/client/linux/minidump_writer/minidump_writer.cc
${BREAKPAD_INCLUDE_DIR}/client/linux/minidump_writer/pe_file.cc
${BREAKPAD_INCLUDE_DIR}/common/linux/breakpad_getcontext.S
${BREAKPAD_INCLUDE_DIR}/common/linux/elfutils.cc
${BREAKPAD_INCLUDE_DIR}/common/linux/file_id.cc
${BREAKPAD_INCLUDE_DIR}/common/linux/guid_creator.cc
${BREAKPAD_INCLUDE_DIR}/common/linux/linux_libc_support.cc
${BREAKPAD_INCLUDE_DIR}/common/linux/memory_mapped_file.cc
${BREAKPAD_INCLUDE_DIR}/common/linux/safe_readlink.cc
)
set_property(SOURCE ${BREAKPAD_INCLUDE_DIR}/common/linux/breakpad_getcontext.S PROPERTY LANGUAGE C)
endif()

if(WIN32)
list(APPEND BREAKPAD_HEADERS
${BREAKPAD_INCLUDE_DIR}/client/windows/handler/exception_handler.h
)
list(APPEND BREAKPAD_SOURCES
${BREAKPAD_INCLUDE_DIR}/client/windows/crash_generation/crash_generation_client.cc
${BREAKPAD_INCLUDE_DIR}/client/windows/handler/exception_handler.cc
${BREAKPAD_INCLUDE_DIR}/common/windows/guid_string.cc
)
endif()

add_library(Breakpad STATIC
${BREAKPAD_SOURCES}
${BREAKPAD_HEADERS}
)
target_compile_definitions(Breakpad PRIVATE UNICODE _UNICODE)
target_include_directories(Breakpad PRIVATE ${BREAKPAD_INCLUDE_DIR})
27 changes: 27 additions & 0 deletions cmake/darkstyle.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
cmake_minimum_required(VERSION 3.14)

include(FetchContent)
set(FETCHCONTENT_QUIET OFF)

# DarkStyle is used for the dark theme
FetchContent_Declare(
DarkStyle
GIT_REPOSITORY https://github.com/Jorgen-VikingGod/Qt-Frameless-Window-DarkStyle.git
GIT_TAG origin/master
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(DarkStyle)

add_library(DarkStyle STATIC
${darkstyle_SOURCE_DIR}/DarkStyle.h
${darkstyle_SOURCE_DIR}/DarkStyle.cpp
${darkstyle_SOURCE_DIR}/darkstyle.qrc
)
target_include_directories(DarkStyle PRIVATE ${darkstyle_SOURCE_DIR})

find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
target_link_libraries(DarkStyle PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

target_include_directories(${PROJECT_NAME} PRIVATE ${darkstyle_SOURCE_DIR})
target_link_libraries(${PROJECT_NAME} PRIVATE DarkStyle)
Loading