add yaml-cpp
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -4,3 +4,6 @@
|
||||
[submodule "lib/rtmidi"]
|
||||
path = lib/rtmidi
|
||||
url = https://github.com/thestk/rtmidi.git
|
||||
[submodule "lib/yaml-cpp"]
|
||||
path = lib/yaml-cpp
|
||||
url = https://github.com/jbeder/yaml-cpp.git
|
||||
|
||||
@@ -23,16 +23,24 @@ if (WIN32) # windows 11 x86_64
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${RtMidi_ROOT}/include/rtmidi"
|
||||
)
|
||||
|
||||
add_library(yaml-cpp SHARED IMPORTED)
|
||||
set_target_properties(yaml-cpp PROPERTIES
|
||||
IMPORTED_LOCATION "${yaml-cpp_ROOT}/bin/yaml-cpp.dll"
|
||||
IMPORTED_IMPLIB "${yaml-cpp_ROOT}/lib/yaml-cpp.lib"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${yaml-cpp_ROOT}/include"
|
||||
)
|
||||
|
||||
else() # debian 12 x86_64
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(RTAUDIO REQUIRED rtaudio)
|
||||
pkg_check_modules(RTMIDI REQUIRED rtmidi)
|
||||
pkg_check_modules(YAMLCPP REQUIRED yaml-cpp)
|
||||
endif()
|
||||
|
||||
qt_standard_project_setup()
|
||||
|
||||
# TODO: prob fix this to make it less ugly
|
||||
# might nest CMakeList.txt files once I clean up the directory structure
|
||||
qt_add_executable(metabolus
|
||||
src/main.cpp
|
||||
src/ui/MainWindow.cpp
|
||||
@@ -46,6 +54,8 @@ qt_add_executable(metabolus
|
||||
src/MidiController.h
|
||||
src/NoteQueue.cpp
|
||||
src/NoteQueue.h
|
||||
src/ConfigInterface.cpp
|
||||
src/ConfigInterface.h
|
||||
src/synth/AudioEngine.cpp
|
||||
src/synth/AudioEngine.h
|
||||
src/synth/Envelope.cpp
|
||||
@@ -89,11 +99,12 @@ if (WIN32)
|
||||
PRIVATE
|
||||
RtAudio::rtaudio
|
||||
RtMidi::rtmidi
|
||||
yaml-cpp
|
||||
Qt6::Widgets
|
||||
)
|
||||
|
||||
else()
|
||||
target_include_directories(metabolus PRIVATE ${RTAUDIO_INCLUDE_DIRS} ${RTMIDI_INCLUDE_DIRS})
|
||||
target_link_libraries(metabolus PRIVATE Qt6::Widgets ${RTAUDIO_LIBRARIES} ${RTMIDI_LIBRARIES})
|
||||
target_include_directories(metabolus PRIVATE ${RTAUDIO_INCLUDE_DIRS} ${RTMIDI_INCLUDE_DIRS} ${YAMLCPP_INCLUDE_DIRS})
|
||||
target_link_libraries(metabolus PRIVATE Qt6::Widgets ${RTAUDIO_LIBRARIES} ${RTMIDI_LIBRARIES} ${YAMLCPP_LIBARIES})
|
||||
target_compile_options(metabolus PRIVATE ${RTAUDIO_CFLAGS_OTHER})
|
||||
endif()
|
||||
|
||||
1
lib/yaml-cpp
Submodule
1
lib/yaml-cpp
Submodule
Submodule lib/yaml-cpp added at 89ff142b99
@@ -7,9 +7,11 @@ $BUILD_DIR = "$PWD/build"
|
||||
$CONFIG = "Release"
|
||||
|
||||
# change these to your need
|
||||
# or TODO: make qt_root configurable
|
||||
$QT_ROOT = "C:\Qt\6.10.1\msvc2022_64"
|
||||
$RTAUDIO_ROOT = "$BUILD_DIR\lib\rtaudio"
|
||||
$RTMIDI_ROOT = "$BUILD_DIR\lib\rtmidi"
|
||||
$YAMLCPP_ROOT = "$BUILD_DIR\lib\yaml-cpp"
|
||||
|
||||
# setup
|
||||
|
||||
@@ -23,7 +25,7 @@ if (-not (Test-Path -Path $BUILD_DIR)) {
|
||||
|
||||
# detect dependencies
|
||||
|
||||
$libraries = @("rtaudio", "rtmidi")
|
||||
$libraries = @("rtaudio", "rtmidi", "yaml-cpp")
|
||||
$dependencies_found = 0
|
||||
foreach ($lib in $libraries) {
|
||||
if (Test-Path -Path ".\build\lib\$lib") {
|
||||
@@ -42,7 +44,13 @@ if (-not ($dependencies_found -eq $libraries.Count)) {
|
||||
|
||||
# configure
|
||||
Write-Host "Configuring metabolus..."
|
||||
cmake -S . -B $BUILD_DIR -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=Release -DQt6_ROOT="$QT_ROOT\lib\cmake\Qt6" -DRtAudio_ROOT="$RTAUDIO_ROOT" -DRtMidi_ROOT="$RTMIDI_ROOT"
|
||||
cmake -S . -B $BUILD_DIR -G "Visual Studio 17 2022" `
|
||||
-DCMAKE_BUILD_TYPE=Release `
|
||||
-DQt6_ROOT="$QT_ROOT\lib\cmake\Qt6" `
|
||||
-DRtAudio_ROOT="$RTAUDIO_ROOT" `
|
||||
-DRtMidi_ROOT="$RTMIDI_ROOT" `
|
||||
-Dyaml-cpp_ROOT="$YAMLCPP_ROOT" `
|
||||
|
||||
|
||||
# build
|
||||
Write-Host "Building metabolus..."
|
||||
@@ -56,6 +64,7 @@ cd $BUILD_DIR
|
||||
|
||||
Copy-Item -Path "$RTAUDIO_ROOT\bin\rtaudio.dll" -Destination .\Debug
|
||||
Copy-Item -Path "$RTMIDI_ROOT\bin\rtmidi.dll" -Destination .\Debug
|
||||
Copy-Item -Path "$YAMLCPP_ROOT\bin\yaml-cpp.dll" -Destination .\Debug
|
||||
|
||||
|
||||
# TODO: allow input of an external qt install because this one is huge
|
||||
|
||||
@@ -16,7 +16,6 @@ cmake -S . -B build -G "Visual Studio 17 2022" -DRTDUIO_API_WASAPI=ON -DRTAUDIO_
|
||||
cmake --build build --config Release
|
||||
cmake --install build --prefix "$build_lib_dir\rtaudio"
|
||||
|
||||
|
||||
# rtmidi
|
||||
mkdir "$build_lib_dir\rtmidi" -Force
|
||||
cd $project_root\lib\rtmidi
|
||||
@@ -25,9 +24,10 @@ cmake --build build --config Release
|
||||
cmake --install build --prefix "$build_lib_dir\rtmidi"
|
||||
|
||||
# yaml-cpp
|
||||
<#
|
||||
cd $project_root\lib\qtbase
|
||||
|
||||
#>
|
||||
mkdir "$build_lib_dir\yaml-cpp" -Force
|
||||
cd $project_root\lib\yaml-cpp
|
||||
cmake -S . -B build -G "Visual Studio 17 2022" -DYAML_BUILD_SHARED_LIBS=ON
|
||||
cmake --build build --config Release
|
||||
cmake --install build --prefix "$build_lib_dir\yaml-cpp"
|
||||
|
||||
cd $project_root
|
||||
|
||||
8
src/ConfigInterface.cpp
Normal file
8
src/ConfigInterface.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
#include "ConfigInterface.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
ConfigInterface::ConfigInterface() {
|
||||
std::cout << "Config constructor" << std::endl;
|
||||
}
|
||||
13
src/ConfigInterface.h
Normal file
13
src/ConfigInterface.h
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
class ConfigInterface {
|
||||
|
||||
public:
|
||||
|
||||
ConfigInterface();
|
||||
~ConfigInterface() = default;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <QApplication>
|
||||
|
||||
#include "ui/MainWindow.h"
|
||||
#include "ConfigInterface.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@@ -9,12 +10,14 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
// std::cout << "Main()" << std::endl;
|
||||
|
||||
ConfigInterface config = ConfigInterface();
|
||||
|
||||
QApplication app(argc, argv);
|
||||
|
||||
MainWindow window; // entry point goes to MainWindow::MainWindow()
|
||||
window.show();
|
||||
|
||||
int status = app.exec(); // assembles ui
|
||||
int status = app.exec(); // app execution; blocks until window close
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user