added the ability to build disabled ui, appshell modules

This commit is contained in:
Igor Korsukov 2023-02-15 18:07:19 +02:00
parent 92e6cdd7bd
commit 709d4aa660
28 changed files with 129 additions and 65 deletions

View file

@ -64,11 +64,13 @@ option(MUE_BUILD_MUSESAMPLER_MODULE "Build MuseSampler module" ON)
set(MUSESAMPLER_SRC_PATH "" CACHE PATH "Path to MuseSampler sources")
option(MUE_BUILD_NETWORK_MODULE "Build network module" ON)
option(MUE_BUILD_SHORTCUTS_MODULE "Build shortcuts module" ON)
option(MUE_BUILD_UI_MODULE "Build ui module" ON)
set(VST3_SDK_VERSION "3.7")
option(MUE_BUILD_VST_MODULE "Build VST module" OFF)
set(VST3_SDK_PATH "" CACHE PATH "Path to VST3_SDK. SDK version >= ${VST3_SDK_VERSION} required")
# Modules (alphabetical order please)
option(MUE_BUILD_APPSHELL_MODULE "Build appshell module" ON)
option(MUE_BUILD_AUTOBOT_MODULE "Build autobot module" ON)
option(MUE_BUILD_CLOUD_MODULE "Build cloud module" ON)
option(MUE_BUILD_CONVERTER_MODULE "Build converter module" ON)

View file

@ -21,8 +21,6 @@ include(GetBuildType)
include(GetPlatformInfo)
include(version)
if (NOT MUSESCORE_BUILD_CONFIGURATION)
set(MUSESCORE_BUILD_CONFIGURATION "app")
endif()
@ -110,12 +108,14 @@ endif()
###########################################
if(BUILD_CONFIGURE MATCHES "VTEST")
set(MUE_BUILD_ACCESSIBILITY_MODULE OFF)
set(MUE_BUILD_APPSHELL_MODULE OFF)
set(MUE_BUILD_AUDIO_MODULE OFF)
set(MUE_BUILD_MIDI_MODULE OFF)
set(MUE_BUILD_MPE_MODULE OFF)
set(MUE_BUILD_MUSESAMPLER_MODULE OFF)
set(MUE_BUILD_NETWORK_MODULE OFF)
set(MUE_BUILD_SHORTCUTS_MODULE OFF)
set(MUE_BUILD_UI_MODULE OFF)
set(MUE_BUILD_VST_MODULE OFF)
set(MUE_BUILD_CLOUD_MODULE OFF)
set(MUE_BUILD_CONVERTER_MODULE OFF)
@ -174,6 +174,10 @@ if (NOT MUE_BUILD_NOTATION_MODULE)
set(MUE_BUILD_PALETTE_MODULE OFF) # hard dependency
endif()
if (NOT MUE_BUILD_UI_MODULE)
set(MUE_BUILD_APPSHELL_MODULE OFF) # hard dependency
endif()
###########################################
# Global definitions
###########################################
@ -206,7 +210,9 @@ def_opt(MUE_BUILD_MPE_MODULE ${MUE_BUILD_MPE_MODULE})
def_opt(MUE_BUILD_MUSESAMPLER_MODULE ${MUE_BUILD_MUSESAMPLER_MODULE})
def_opt(MUE_BUILD_NETWORK_MODULE ${MUE_BUILD_NETWORK_MODULE})
def_opt(MUE_BUILD_SHORTCUTS_MODULE ${MUE_BUILD_SHORTCUTS_MODULE})
def_opt(MUE_BUILD_UI_MODULE ${MUE_BUILD_UI_MODULE})
# modules
def_opt(MUE_BUILD_APPSHELL_MODULE ${MUE_BUILD_APPSHELL_MODULE})
def_opt(MUE_BUILD_AUTOBOT_MODULE ${MUE_BUILD_AUTOBOT_MODULE})
def_opt(MUE_BUILD_CLOUD_MODULE ${MUE_BUILD_CLOUD_MODULE})
def_opt(MUE_BUILD_CONVERTER_MODULE ${MUE_BUILD_CONVERTER_MODULE})

View file

@ -29,7 +29,7 @@ GEN_SCRIPT=tools/crashdump/generate_syms.sh
ARTIFACTS_DIR=build.artifacts
BUILD_DIR=build.release
SYMBOLS_DIR=$ARTIFACTS_DIR/symbols
MSCORE_BIN=$BUILD_DIR/src/main/mscore4portable*
MSCORE_BIN=$BUILD_DIR/src/app/mscore4portable*
echo "GEN_SCRIPT: $GEN_SCRIPT"

View file

@ -25,7 +25,7 @@ DUMPSYMS_BIN=/c/breakpad_tools/dump_syms.exe
ARTIFACTS_DIR=build.artifacts
BUILD_DIR=build.release
SYMBOLS_DIR=$ARTIFACTS_DIR/symbols
MSCORE_BIN=$BUILD_DIR/src/main/MuseScore4.pdb
MSCORE_BIN=$BUILD_DIR/src/app/MuseScore4.pdb
echo "GEN_SCRIPT: $GEN_SCRIPT"
echo "DUMPSYMS_BIN: $DUMPSYMS_BIN"
@ -36,4 +36,4 @@ echo "MSCORE_BIN: $MSCORE_BIN"
$GEN_SCRIPT --dumpsyms-bin $DUMPSYMS_BIN --build-dir $BUILD_DIR --symbols-dir $SYMBOLS_DIR --mscore-bin $MSCORE_BIN
echo "-----"
ls $SYMBOLS_DIR
ls $SYMBOLS_DIR

View file

@ -18,14 +18,16 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Main
add_subdirectory(main)
# App (main)
add_subdirectory(app)
# Framework
add_subdirectory(framework)
# Modules
add_subdirectory(appshell)
if (MUE_BUILD_APPSHELL_MODULE)
add_subdirectory(appshell)
endif()
if (MUE_BUILD_AUTOBOT_MODULE)
add_subdirectory(autobot)

View file

@ -119,8 +119,6 @@ set(LINK_LIB
${QT_LIBRARIES}
global
draw
ui
uicomponents
fonts
network
@ -128,7 +126,6 @@ set(LINK_LIB
engraving
actions
accessibility
appshell
context
shortcuts
workspace
@ -148,10 +145,19 @@ set(LINK_LIB
update
)
if (MUE_BUILD_UI_MODULE)
list(APPEND LINK_LIB ui)
list(APPEND LINK_LIB uicomponents)
endif()
if (MUE_BUILD_CONVERTER_MODULE)
list(APPEND LINK_LIB converter)
endif()
if (MUE_BUILD_APPSHELL_MODULE)
list(APPEND LINK_LIB appshell)
endif()
if (NOT CC_IS_EMSCRIPTEN)
list(APPEND LINK_LIB cloud)
list(APPEND LINK_LIB languages)
@ -213,6 +219,10 @@ endif()
add_executable(${EXECUTABLE_NAME}
main.cpp
app.cpp
app.h
commandlinecontroller.cpp
commandlinecontroller.h
${MSCORE_APPEND_SRC}
)
@ -379,7 +389,7 @@ elseif(OS_IS_LIN)
COMMAND ${LN_EXECUTABLE} -sf "mscore${MUSESCORE_INSTALL_SUFFIX}" "musescore${MUSESCORE_INSTALL_SUFFIX}"
COMMAND echo 'Symlink alias: musescore${MUSESCORE_INSTALL_SUFFIX} -> mscore${MUSESCORE_INSTALL_SUFFIX}'
)
install(FILES ${PROJECT_BINARY_DIR}/src/main/musescore${MUSESCORE_INSTALL_SUFFIX} DESTINATION bin)
install(FILES ${PROJECT_BINARY_DIR}/src/app/musescore${MUSESCORE_INSTALL_SUFFIX} DESTINATION bin)
else (LN_EXECUTABLE)
add_custom_target(mscore_alias ALL COMMAND echo "No symlink aliases will be created." VERBATIM )
endif (LN_EXECUTABLE)

View file

@ -20,7 +20,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "appshell.h"
#include "app.h"
#include <QApplication>
#include <QQmlApplicationEngine>
@ -30,9 +30,8 @@
#include <QThreadPool>
#endif
#include "view/internal/splashscreen.h"
#include "view/dockwindow/docksetup.h"
#include "appshell/view/internal/splashscreen.h"
#include "appshell/view/dockwindow/docksetup.h"
#include "modularity/ioc.h"
#include "ui/internal/uiengine.h"
@ -44,21 +43,22 @@
#include "log.h"
using namespace mu::app;
using namespace mu::appshell;
//! NOTE Separately to initialize logger and profiler as early as possible
static mu::framework::GlobalModule globalModule;
AppShell::AppShell()
App::App()
{
}
void AppShell::addModule(modularity::IModuleSetup* module)
void App::addModule(modularity::IModuleSetup* module)
{
m_modules.push_back(module);
}
int AppShell::run(int argc, char** argv)
int App::run(int argc, char** argv)
{
// ====================================================
// Setup global Qt application variables
@ -150,11 +150,13 @@ int AppShell::run(int argc, char** argv)
m->onPreInit(runMode);
}
#ifdef MUE_BUILD_APPSHELL_MODULE
SplashScreen* splashScreen = nullptr;
if (runMode == framework::IApplication::RunMode::Editor) {
splashScreen = new SplashScreen();
splashScreen->show();
}
#endif
// ====================================================
// Setup modules: onInit
@ -219,6 +221,7 @@ int AppShell::run(int argc, char** argv)
}
} break;
case framework::IApplication::RunMode::Editor: {
#ifdef MUE_BUILD_APPSHELL_MODULE
// ====================================================
// Setup Qml Engine
// ====================================================
@ -283,6 +286,7 @@ int AppShell::run(int argc, char** argv)
splashScreen->close();
delete splashScreen;
}
#endif // MUE_BUILD_APPSHELL_MODULE
}
}
@ -305,8 +309,11 @@ int AppShell::run(int argc, char** argv)
globalThreadPool->waitForDone();
}
#endif
#ifdef MUE_BUILD_APPSHELL_MODULE
// Engine quit
ui::UiEngine::instance()->quit();
#endif
// Deinit
@ -330,7 +337,7 @@ int AppShell::run(int argc, char** argv)
return retCode;
}
int AppShell::processConverter(const CommandLineController::ConverterTask& task)
int App::processConverter(const CommandLineController::ConverterTask& task)
{
Ret ret = make_ret(Ret::Code::Ok);
io::path_t stylePath = task.params[CommandLineController::ParamKey::StylePath].toString();
@ -379,7 +386,7 @@ int AppShell::processConverter(const CommandLineController::ConverterTask& task)
return ret.code();
}
int AppShell::processDiagnostic(const CommandLineController::Diagnostic& task)
int App::processDiagnostic(const CommandLineController::Diagnostic& task)
{
if (!diagnosticDrawProvider()) {
return make_ret(Ret::Code::NotSupported);
@ -434,7 +441,7 @@ int AppShell::processDiagnostic(const CommandLineController::Diagnostic& task)
return ret.code();
}
void AppShell::processAutobot(const CommandLineController::Autobot& task)
void App::processAutobot(const CommandLineController::Autobot& task)
{
using namespace mu::autobot;
async::Channel<StepInfo, Ret> stepCh = autobot()->stepStatusChanged();

View file

@ -20,8 +20,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_APPSHELL_APPSHELL_H
#define MU_APPSHELL_APPSHELL_H
#ifndef MU_APP_APP_H
#define MU_APP_APP_H
#include <QList>
@ -34,16 +34,16 @@
#include "commandlinecontroller.h"
namespace mu::appshell {
class AppShell
namespace mu::app {
class App
{
INJECT(appshell, framework::IApplication, muapplication)
INJECT(appshell, converter::IConverterController, converter)
INJECT(appshell, diagnostics::IDiagnosticDrawProvider, diagnosticDrawProvider)
INJECT(appshell, autobot::IAutobot, autobot)
INJECT(app, framework::IApplication, muapplication)
INJECT(app, converter::IConverterController, converter)
INJECT(app, diagnostics::IDiagnosticDrawProvider, diagnosticDrawProvider)
INJECT(app, autobot::IAutobot, autobot)
public:
AppShell();
App();
void addModule(modularity::IModuleSetup* module);
@ -59,4 +59,4 @@ private:
};
}
#endif // MU_APPSHELL_APPSHELL_H
#endif // MU_APP_APP_H

View file

@ -21,10 +21,11 @@
*/
#include "commandlinecontroller.h"
#include "log.h"
#include "global/muversion.h"
using namespace mu::appshell;
#include "log.h"
using namespace mu::app;
using namespace mu::framework;
void CommandLineController::parse(const QStringList& args)

View file

@ -19,8 +19,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_APPSHELL_COMMANDLINECONTROLLER_H
#define MU_APPSHELL_COMMANDLINECONTROLLER_H
#ifndef MU_APP_COMMANDLINECONTROLLER_H
#define MU_APP_COMMANDLINECONTROLLER_H
#include <QCommandLineParser>
#include <QStringList>
@ -32,13 +32,13 @@
#include "importexport/midi/imidiconfiguration.h"
#include "importexport/audioexport/iaudioexportconfiguration.h"
#include "importexport/videoexport/ivideoexportconfiguration.h"
#include "iappshellconfiguration.h"
#include "internal/istartupscenario.h"
#include "appshell/iappshellconfiguration.h"
#include "appshell/internal/istartupscenario.h"
#include "notation/inotationconfiguration.h"
#include "project/iprojectconfiguration.h"
#include "importexport/guitarpro/iguitarproconfiguration.h"
namespace mu::appshell {
namespace mu::app {
class CommandLineController
{
INJECT(appshell, framework::IApplication, application)
@ -47,8 +47,8 @@ class CommandLineController
INJECT(appshell, iex::midi::IMidiImportExportConfiguration, midiImportExportConfiguration)
INJECT(appshell, iex::audioexport::IAudioExportConfiguration, audioExportConfiguration)
INJECT(appshell, iex::videoexport::IVideoExportConfiguration, videoExportConfiguration)
INJECT(appshell, IAppShellConfiguration, configuration)
INJECT(appshell, IStartupScenario, startupScenario)
INJECT(appshell, appshell::IAppShellConfiguration, configuration)
INJECT(appshell, appshell::IStartupScenario, startupScenario)
INJECT(appshell, notation::INotationConfiguration, notationConfiguration)
INJECT(appshell, project::IProjectConfiguration, projectConfiguration)
INJECT(appshell, iex::guitarpro::IGuitarProConfiguration, guitarProConfiguration);
@ -127,4 +127,4 @@ private:
};
}
#endif // MU_APPSHELL_COMMANDLINECONTROLLER_H
#endif // MU_APP_COMMANDLINECONTROLLER_H

View file

@ -25,7 +25,7 @@
#include "runtime.h"
#include "log.h"
#include "appshell/appshell.h"
#include "app.h"
#include "framework/global/globalmodule.h"
@ -74,8 +74,10 @@
#include "stubs/framework/shortcuts/shortcutsstubmodule.h"
#endif
#ifdef MUE_BUILD_UI_MODULE
#include "framework/ui/uimodule.h"
#include "framework/uicomponents/uicomponentsmodule.h"
#endif
#ifdef MUE_BUILD_VST_MODULE
#include "framework/vst/vstmodule.h"
@ -212,7 +214,7 @@ int main(int argc, char** argv)
// would otherwise default to the local ANSI code page and cause corruption of any non-ANSI Unicode characters in command-line arguments.
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
mu::appshell::AppShell app;
mu::app::App app;
//! NOTE `diagnostics` must be first, because it installs the crash handler.
//! For other modules, the order is (an should be) unimportant.
@ -231,12 +233,17 @@ int main(int argc, char** argv)
#endif
app.addModule(new mu::network::NetworkModule());
app.addModule(new mu::shortcuts::ShortcutsModule());
#ifdef MUE_BUILD_UI_MODULE
app.addModule(new mu::ui::UiModule());
app.addModule(new mu::uicomponents::UiComponentsModule());
#endif
app.addModule(new mu::vst::VSTModule());
// modules
#ifdef MUE_BUILD_APPSHELL_MODULE
app.addModule(new mu::appshell::AppShellModule());
#endif
#ifdef MUE_BUILD_AUTOBOT_MODULE
app.addModule(new mu::autobot::AutobotModule());
#endif

View file

@ -28,10 +28,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/view/dockwindow/dockwindow.cmake)
set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/appshellmodule.cpp
${CMAKE_CURRENT_LIST_DIR}/appshellmodule.h
${CMAKE_CURRENT_LIST_DIR}/appshell.cpp
${CMAKE_CURRENT_LIST_DIR}/appshell.h
${CMAKE_CURRENT_LIST_DIR}/commandlinecontroller.cpp
${CMAKE_CURRENT_LIST_DIR}/commandlinecontroller.h
${CMAKE_CURRENT_LIST_DIR}/iappshellconfiguration.h
${CMAKE_CURRENT_LIST_DIR}/iapplicationactioncontroller.h
${CMAKE_CURRENT_LIST_DIR}/appshelltypes.h

View file

@ -43,8 +43,10 @@ if (MUE_BUILD_MUSESAMPLER_MODULE)
add_subdirectory(musesampler)
endif()
add_subdirectory(ui)
add_subdirectory(uicomponents)
if (MUE_BUILD_UI_MODULE)
add_subdirectory(ui)
add_subdirectory(uicomponents)
endif()
if (MUE_BUILD_NETWORK_MODULE)
add_subdirectory(network)

View file

@ -27,8 +27,9 @@
#include "io/file.h"
#include "libmscore/masterscore.h"
#include "engraving/libmscore/masterscore.h"
#include "engraving/engravingerrors.h"
#include "engraving/compat/mscxcompat.h"
#include "engraving/compat/scoreaccess.h"
#include "engraving/compat/writescorehook.h"

View file

@ -29,7 +29,7 @@
#include "libmscore/masterscore.h"
#include "engraving/infrastructure/localfileinfoprovider.h"
#include "engraving/engravingerrors.h"
#include "engraving/compat/mscxcompat.h"
#include "engraving/compat/scoreaccess.h"
#include "engraving/compat/writescorehook.h"

View file

@ -28,7 +28,7 @@
#include "io/file.h"
#include "libmscore/masterscore.h"
#include "engraving/engravingerrors.h"
#include "engraving/compat/mscxcompat.h"
#include "engraving/compat/scoreaccess.h"
#include "engraving/compat/writescorehook.h"

View file

@ -37,8 +37,8 @@ public:
virtual Ret setupNewScore(engraving::MasterScore* score, const ScoreCreateOptions& options) = 0;
virtual void applyOptions(engraving::MasterScore* score, const ScoreCreateOptions& options, bool createdFromTemplate = false) = 0;
virtual void setMasterScore(engraving::MasterScore* masterScore) = 0;
virtual engraving::MasterScore* masterScore() const = 0;
virtual void setMasterScore(engraving::MasterScore* masterScore) = 0;
virtual INotationPtr notation() = 0;

View file

@ -47,8 +47,8 @@ public:
Ret setupNewScore(engraving::MasterScore* score, const ScoreCreateOptions& options) override;
void applyOptions(engraving::MasterScore* score, const ScoreCreateOptions& options, bool createdFromTemplate = false) override;
void setMasterScore(engraving::MasterScore* masterScore) override;
engraving::MasterScore* masterScore() const override;
void setMasterScore(engraving::MasterScore* masterScore) override;
INotationPtr notation() override;
int mscVersion() const override;

View file

@ -51,5 +51,8 @@ void CloudModule::registerResources()
void CloudModule::registerUiTypes()
{
ioc()->resolve<ui::IUiEngine>(moduleName())->addSourceImportPath(cloud_QML_IMPORT);
std::shared_ptr<ui::IUiEngine> ui = ioc()->resolve<ui::IUiEngine>(moduleName());
if (ui) {
ui->addSourceImportPath(cloud_QML_IMPORT);
}
}

View file

@ -61,5 +61,8 @@ void AudioModule::registerResources()
void AudioModule::registerUiTypes()
{
ioc()->resolve<ui::IUiEngine>(moduleName())->addSourceImportPath(audio_QML_IMPORT);
std::shared_ptr<ui::IUiEngine> ui = ioc()->resolve<ui::IUiEngine>(moduleName());
if (ui) {
ui->addSourceImportPath(audio_QML_IMPORT);
}
}

View file

@ -58,5 +58,8 @@ void ShortcutsModule::registerResources()
void ShortcutsModule::registerUiTypes()
{
ioc()->resolve<ui::IUiEngine>(moduleName())->addSourceImportPath(shortcuts_QML_IMPORT);
std::shared_ptr<ui::IUiEngine> ui = ioc()->resolve<ui::IUiEngine>(moduleName());
if (ui) {
ui->addSourceImportPath(shortcuts_QML_IMPORT);
}
}

View file

@ -48,5 +48,8 @@ void InspectorModule::registerResources()
void InspectorModule::registerUiTypes()
{
ioc()->resolve<ui::IUiEngine>(moduleName())->addSourceImportPath(inspector_QML_IMPORT);
std::shared_ptr<ui::IUiEngine> ui = ioc()->resolve<ui::IUiEngine>(moduleName());
if (ui) {
ui->addSourceImportPath(inspector_QML_IMPORT);
}
}

View file

@ -63,5 +63,8 @@ void InstrumentsSceneModule::registerResources()
void InstrumentsSceneModule::registerUiTypes()
{
ioc()->resolve<IUiEngine>(moduleName())->addSourceImportPath(instrumentsscene_QML_IMPORT);
std::shared_ptr<ui::IUiEngine> ui = ioc()->resolve<ui::IUiEngine>(moduleName());
if (ui) {
ui->addSourceImportPath(instrumentsscene_QML_IMPORT);
}
}

View file

@ -53,5 +53,8 @@ void LanguagesModule::registerResources()
void LanguagesModule::registerUiTypes()
{
ioc()->resolve<ui::IUiEngine>(moduleName())->addSourceImportPath(languages_QML_IMPORT);
std::shared_ptr<ui::IUiEngine> ui = ioc()->resolve<ui::IUiEngine>(moduleName());
if (ui) {
ui->addSourceImportPath(languages_QML_IMPORT);
}
}

View file

@ -65,5 +65,8 @@ void PaletteModule::registerResources()
void PaletteModule::registerUiTypes()
{
ioc()->resolve<ui::IUiEngine>(moduleName())->addSourceImportPath(palette_QML_IMPORT);
std::shared_ptr<ui::IUiEngine> ui = ioc()->resolve<ui::IUiEngine>(moduleName());
if (ui) {
ui->addSourceImportPath(palette_QML_IMPORT);
}
}

View file

@ -54,5 +54,8 @@ void PlaybackModule::registerResources()
void PlaybackModule::registerUiTypes()
{
ioc()->resolve<ui::IUiEngine>(moduleName())->addSourceImportPath(playback_QML_IMPORT);
std::shared_ptr<ui::IUiEngine> ui = ioc()->resolve<ui::IUiEngine>(moduleName());
if (ui) {
ui->addSourceImportPath(playback_QML_IMPORT);
}
}

View file

@ -54,5 +54,8 @@ void PluginsModule::registerResources()
void PluginsModule::registerUiTypes()
{
ioc()->resolve<IUiEngine>(moduleName())->addSourceImportPath(plugins_QML_IMPORT);
std::shared_ptr<ui::IUiEngine> ui = ioc()->resolve<ui::IUiEngine>(moduleName());
if (ui) {
ui->addSourceImportPath(plugins_QML_IMPORT);
}
}

View file

@ -70,5 +70,8 @@ void WorkspaceModule::registerResources()
void WorkspaceModule::registerUiTypes()
{
ioc()->resolve<IUiEngine>(moduleName())->addSourceImportPath(workspace_QML_IMPORT);
std::shared_ptr<ui::IUiEngine> ui = ioc()->resolve<ui::IUiEngine>(moduleName());
if (ui) {
ui->addSourceImportPath(workspace_QML_IMPORT);
}
}