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
66 changes: 51 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,29 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install dependencies
- name: Install non-Qt dependencies
run: |
sudo apt-get update
sudo apt-get install -y qt6-base-dev qt6-svg-dev libxkbcommon-dev liblo-dev libasound2-dev build-essential cmake
sudo apt-get install -y libxkbcommon-dev liblo-dev libasound2-dev build-essential cmake

- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: "6.11.0"
host: "linux"
target: "desktop"
arch: "linux_gcc_64"

- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ runner.os }}-${{ hashFiles('**/CMakeLists.txt') }}

- name: Configure
run: cmake -B build -DCMAKE_BUILD_TYPE=Release

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

- name: Upload artifact
uses: actions/upload-artifact@v4
Expand All @@ -35,33 +48,51 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install Qt
uses: jurplel/install-qt-action@v4
- name: Cache Qt
id: cache-qt
uses: actions/cache@v4
with:
version: "6.6.0"
host: "windows"
target: "desktop"
arch: "win64_msvc2019_64"
path: C:\Qt\6.11.0\msvc2022_64
key: qt-6.11.0-msvc2022_64

- name: Download Qt
if: steps.cache-qt.outputs.cache-hit != 'true'
run: |
gh release download qt-deps --pattern "msvc2022_64.zip" --dir $env:TEMP
Expand-Archive -Path "$env:TEMP\msvc2022_64.zip" -DestinationPath C:\Qt\6.11.0
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install liblo via vcpkg
run: vcpkg install liblo:x64-windows

- name: Set up MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ runner.os }}-${{ hashFiles('**/CMakeLists.txt') }}

- name: Configure
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" -DCMAKE_PREFIX_PATH="C:\Qt\6.11.0\msvc2022_64"

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

- name: Deploy Qt
run: |
cd build/Release
windeployqt --release OpenMix.exe
mkdir build\deploy
copy build\OpenMix.exe build\deploy\
C:\Qt\6.11.0\msvc2022_64\bin\windeployqt --release build\deploy\OpenMix.exe

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: OpenMix-windows
path: build/Release/
path: build/deploy/

build-macos:
runs-on: macos-latest
Expand All @@ -71,6 +102,11 @@ jobs:
- name: Install dependencies
run: brew install qt@6 liblo

- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ runner.os }}-${{ hashFiles('**/CMakeLists.txt') }}

- name: Configure
run: |
export PATH="/opt/homebrew/opt/qt@6/bin:$PATH"
Expand All @@ -79,7 +115,7 @@ jobs:
-DCMAKE_PREFIX_PATH=/opt/homebrew/opt/qt@6

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

- name: Deploy, sign, & package
run: |
Expand Down
79 changes: 52 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
if(MSVC)
foreach(config DEBUG RELWITHDEBINFO)
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_${config} "${CMAKE_CXX_FLAGS_${config}}")
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_${config} "${CMAKE_C_FLAGS_${config}}")
endforeach()
endif()
endif()

# find Qt6
find_package(Qt6 REQUIRED COMPONENTS
Core
Expand Down Expand Up @@ -40,8 +52,27 @@ else()
endif()

# RtMidi
set(RTMIDI_SOURCES libs/RtMidi/RtMidi.cpp)
set(RTMIDI_HEADERS libs/RtMidi/RtMidi.h)
add_library(RtMidi STATIC libs/RtMidi/RtMidi.cpp libs/RtMidi/RtMidi.h)
target_include_directories(RtMidi PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/libs/RtMidi)
if(WIN32)
target_compile_definitions(RtMidi PUBLIC __WINDOWS_MM__)
target_compile_options(RtMidi PRIVATE /FIwindows.h)
target_link_libraries(RtMidi PUBLIC winmm)
elseif(APPLE)
target_compile_definitions(RtMidi PUBLIC __MACOSX_CORE__)
find_library(COREMIDI_LIBRARY CoreMIDI REQUIRED)
find_library(COREAUDIO_LIBRARY CoreAudio REQUIRED)
find_library(COREFOUNDATION_LIBRARY CoreFoundation REQUIRED)
target_link_libraries(RtMidi PUBLIC
${COREMIDI_LIBRARY}
${COREAUDIO_LIBRARY}
${COREFOUNDATION_LIBRARY}
)
else()
target_compile_definitions(RtMidi PUBLIC __LINUX_ALSA__)
find_package(ALSA REQUIRED)
target_link_libraries(RtMidi PUBLIC ALSA::ALSA)
endif()

# source files
set(SOURCES
Expand Down Expand Up @@ -214,8 +245,6 @@ set(RESOURCES
add_executable(${PROJECT_NAME}
${SOURCES}
${HEADERS}
${RTMIDI_SOURCES}
${RTMIDI_HEADERS}
${RESOURCES}
)

Expand All @@ -224,7 +253,6 @@ target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src/ui
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/libs/RtMidi
)

# link libraries
Expand All @@ -244,31 +272,28 @@ else()
target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::LIBLO)
endif()

# RtMidi config
if(WIN32)
target_compile_definitions(${PROJECT_NAME} PRIVATE __WINDOWS_MM__)
target_link_libraries(${PROJECT_NAME} PRIVATE winmm)
set_source_files_properties(libs/RtMidi/RtMidi.cpp PROPERTIES
COMPILE_FLAGS "/FIwindows.h"
)
elseif(APPLE)
target_compile_definitions(${PROJECT_NAME} PRIVATE __MACOSX_CORE__)
find_library(COREMIDI_LIBRARY CoreMIDI)
find_library(COREAUDIO_LIBRARY CoreAudio)
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
target_link_libraries(${PROJECT_NAME} PRIVATE
${COREMIDI_LIBRARY}
${COREAUDIO_LIBRARY}
${COREFOUNDATION_LIBRARY}
)
else()
target_compile_definitions(${PROJECT_NAME} PRIVATE __LINUX_ALSA__)
find_package(ALSA REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE ALSA::ALSA)
endif()
target_link_libraries(${PROJECT_NAME} PRIVATE RtMidi)

target_precompile_headers(${PROJECT_NAME} PRIVATE
<QObject>
<QString>
<QStringList>
<QVector>
<QList>
<QMap>
<QHash>
<QSet>
<QTimer>
<QVariant>
<QJsonObject>
<QJsonArray>
<functional>
<optional>
)

# platform-specific settings
if(WIN32)
target_compile_definitions(${PROJECT_NAME} PRIVATE NOMINMAX)
set_target_properties(${PROJECT_NAME} PROPERTIES
WIN32_EXECUTABLE TRUE
)
Expand Down
5 changes: 5 additions & 0 deletions src/app/Application.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "Application.h"
#include "ui/MainWindow.h"
#include "core/AppLogger.h"
#include "core/ConnectionLogBridge.h"
#include "core/Cue.h"
Expand Down Expand Up @@ -212,4 +213,8 @@ void Application::startupScan() {
m_discoveryService->startScan(3000);
}

void Application::setMainWindow(MainWindow* window) { m_mainWindow = window; }

MainWindow* Application::mainWindow() { return m_mainWindow; }

} // namespace OpenMix
40 changes: 21 additions & 19 deletions src/app/Application.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#pragma once

#include "ui/MainWindow.h"
#include <QObject>
#include <QPointer>
#include <QUndoStack>

namespace OpenMix {

class MainWindow;
class Show;
class PlaybackEngine;
class MixerProtocol;
Expand All @@ -32,45 +32,45 @@ class Application : public QObject {
~Application() override;

// singleton access
static Application* instance() { return s_instance; }
[[nodiscard]] static Application* instance() { return s_instance; }

// core components
Show* show() { return m_show; }
PlaybackEngine* playbackEngine() { return m_playbackEngine; }
MixerProtocol* mixer() { return m_mixer; }
QUndoStack* undoStack() { return m_undoStack; }
AutosaveManager* autosaveManager() { return m_autosaveManager; }
[[nodiscard]] Show* show() { return m_show; }
[[nodiscard]] PlaybackEngine* playbackEngine() { return m_playbackEngine; }
[[nodiscard]] MixerProtocol* mixer() { return m_mixer; }
[[nodiscard]] QUndoStack* undoStack() { return m_undoStack; }
[[nodiscard]] AutosaveManager* autosaveManager() { return m_autosaveManager; }

// safety & validation
CueValidator* cueValidator() { return m_cueValidator; }
PlaybackGuard* playbackGuard() { return m_playbackGuard; }
PlaybackLogger* playbackLogger() { return m_playbackLogger; }
DryRunEngine* dryRunEngine() { return m_dryRunEngine; }
[[nodiscard]] CueValidator* cueValidator() { return m_cueValidator; }
[[nodiscard]] PlaybackGuard* playbackGuard() { return m_playbackGuard; }
[[nodiscard]] PlaybackLogger* playbackLogger() { return m_playbackLogger; }
[[nodiscard]] DryRunEngine* dryRunEngine() { return m_dryRunEngine; }

// operator experience
ShortcutManager* shortcutManager() { return m_shortcutManager; }
OperationModeManager* operationModeManager() { return m_operationModeManager; }
[[nodiscard]] ShortcutManager* shortcutManager() { return m_shortcutManager; }
[[nodiscard]] OperationModeManager* operationModeManager() { return m_operationModeManager; }

// recovery
CrashRecovery* crashRecovery() { return m_crashRecovery; }
[[nodiscard]] CrashRecovery* crashRecovery() { return m_crashRecovery; }

// MIDI input
MidiInputManager* midiInputManager() { return m_midiInputManager; }
[[nodiscard]] MidiInputManager* midiInputManager() { return m_midiInputManager; }

// console discovery
ConsoleDiscoveryService* discoveryService() { return m_discoveryService; }
[[nodiscard]] ConsoleDiscoveryService* discoveryService() { return m_discoveryService; }

// application logging
AppLogger* appLogger() { return m_appLogger; }
[[nodiscard]] AppLogger* appLogger() { return m_appLogger; }

// mixer connection
void connectToMixer(const QString& type, const QString& host, int port);
void connectToDiscoveredConsole(const DiscoveredConsole& console);
void disconnectFromMixer();

// main window
void setMainWindow(MainWindow* window) { m_mainWindow = window; }
MainWindow* mainWindow() { return m_mainWindow; }
void setMainWindow(MainWindow* window);
[[nodiscard]] MainWindow* mainWindow();

// initialization
void initialize();
Expand All @@ -87,6 +87,8 @@ class Application : public QObject {

static Application* s_instance;

// All pointer members below are owned by Qt's parent-child system (parent = this).
// m_mixer is the exception: created by ProtocolFactory with this as parent, swapped on reconnect.
Show* m_show;
PlaybackEngine* m_playbackEngine;
MixerProtocol* m_mixer = nullptr;
Expand Down
Loading
Loading