diff --git a/share/qtcreator/templates/wizards/projects/consoleapp/meson.build b/share/qtcreator/templates/wizards/projects/consoleapp/meson.build
new file mode 100644
index 00000000000..55090dea932
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/consoleapp/meson.build
@@ -0,0 +1,11 @@
+project('%{ProjectName}', 'cpp',default_options : ['cpp_std=c++11'], meson_version:'>=0.44')
+
+# Documentation: https://mesonbuild.com/Qt5-module.html
+qt5 = import('qt5')
+qt5core = dependency('qt5', modules : 'Core')
+
+@if %{HasTranslation}
+translations = qt5.compile_translations(ts_files : '%{TsFileName}', build_by_default : true)
+@endif
+
+executable('%{ProjectName}', '%{CppFileName}', dependencies : [qt5core])
diff --git a/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json b/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json
index b54e769d662..1bc8554c8b7 100644
--- a/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json
@@ -1,6 +1,6 @@
{
"version": 1,
- "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qbs.QbsProject", "Qt4ProjectManager.Qt4Project" ],
+ "supportedProjectTypes": [ "MesonProjectManager.MesonProject", "CMakeProjectManager.CMakeProject", "Qbs.QbsProject", "Qt4ProjectManager.Qt4Project" ],
"id": "E.QtCore",
"category": "D.ApplicationQt",
"trDescription": "Creates a project containing a single main.cpp file with a stub implementation.\n\nPreselects a desktop Qt for building the application if available.",
@@ -8,14 +8,15 @@
"trDisplayCategory": "Application (Qt)",
"icon": "../../global/consoleapplication.png",
"featuresRequired": [ "QtSupport.Wizards.FeatureQt" ],
- "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0}",
+ "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0 || value('Plugins').indexOf('MesonProjectManager') >= 0}",
"options":
[
- { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : (value('BuildSystem') === 'cmake' ? value('CMakeFile') : value('QbsFile'))}" },
+ { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : (value('BuildSystem') === 'cmake' ? value('CMakeFile') : (value('BuildSystem') === 'meson' ? value('MesonFile') : value('QbsFile')))}" },
{ "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" },
{ "key": "QbsFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" },
{ "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" },
+ { "key": "MesonFile", "value": "%{ProjectDirectory}/meson.build" },
{ "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" },
{ "key": "CppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" }
],
@@ -59,6 +60,11 @@
"trKey": "Qbs",
"value": "qbs",
"condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}"
+ },
+ {
+ "trKey": "Meson",
+ "value": "meson",
+ "condition": "%{JS: value('Plugins').indexOf('MesonProjectManager') >= 0}"
}
]
}
@@ -106,6 +112,12 @@
"openAsProject": true,
"condition": "%{JS: value('BuildSystem') === 'qbs'}"
},
+ {
+ "source": "meson.build",
+ "target": "%{MesonFile}",
+ "openAsProject": true,
+ "condition": "%{JS: value('BuildSystem') === 'meson'}"
+ },
{
"source": "main.cpp",
"target": "%{CppFileName}",
diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/meson.build b/share/qtcreator/templates/wizards/projects/cpplibrary/meson.build
new file mode 100644
index 00000000000..73b1e67fbcf
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/cpplibrary/meson.build
@@ -0,0 +1,56 @@
+project('%{ProjectName}', 'cpp',
+@if %{IsStatic}
+ default_options : ['cpp_std=c++11', 'default_library=static'],
+@else
+ default_options : ['cpp_std=c++11', 'default_library=shared'],
+@endif
+ meson_version:'>=0.48')
+
+@if '%{QtModule}' != 'none'
+# Documentation: https://mesonbuild.com/Qt5-module.html
+qt5 = import('qt5')
+
+@if '%{QtModule}' == 'core'
+qt5dep = dependency('qt5', modules : ['Core'])
+@endif
+@if '%{QtModule}' == 'gui'
+qt5dep = dependency('qt5', modules : ['Core', 'Gui'])
+@endif
+@if '%{QtModule}' == 'widgets'
+qt5dep = dependency('qt5', modules : ['Core', 'Gui', 'Widgets'])
+@endif
+
+@if %{HasTranslation}
+translations = qt5.compile_translations(ts_files : '%{TsFileName}', build_by_default : true)
+@endif
+
+cpp_args = [
+@if %{IsShared}
+ '-D%{LibraryDefine}'
+ @if %{IsQtPlugin}
+ ,'-DQT_PLUGIN'
+ @endif
+@else
+ @if %{IsQtPlugin}
+ '-DQT_STATICPLUGIN'
+ @endif
+@endif
+]
+
+moc_files = qt5.preprocess(moc_headers : [
+ @if '%{Type}' === 'shared'
+ '%{GlobalHdrFileName}',
+ @endif
+ '%{HdrFileName}'],
+ moc_extra_arguments : cpp_args,
+ dependencies: [qt5dep])
+@endif
+
+
+library('%{ProjectName}', '%{SrcFileName}'
+@if '%{QtModule}' != 'none'
+ , moc_files
+ , dependencies : [qt5dep]
+ , cpp_args : cpp_args
+@endif
+ , install : true)
diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json b/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json
index 0b12fd67e11..217a5c1a735 100644
--- a/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json
@@ -1,19 +1,20 @@
{
"version": 1,
- "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qbs.QbsProject", "Qt4ProjectManager.Qt4Project" ],
+ "supportedProjectTypes": [ "MesonProjectManager.MesonProject", "CMakeProjectManager.CMakeProject", "Qbs.QbsProject", "Qt4ProjectManager.Qt4Project" ],
"id": "H.CppLibrary",
"category": "G.Library",
"trDescription": "Creates a C++ library. This can be used to create:
- a shared C++ library for use with QPluginLoader and runtime (Plugins)
- a shared or static C++ library for use with another project at linktime
",
"trDisplayName": "C++ Library",
"trDisplayCategory": "Library",
"icon": "../../global/lib.png",
- "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0 && (value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0)}",
+ "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0 && (value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0 || value('Plugins').indexOf('MesonProjectManager') >= 0)}",
"options":
[
- { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'cmake' ? value('CMakeFile') : value('ProFile')}" },
+ { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'cmake' ? value('CMakeFile') : ( value('BuildSystem') === 'meson' ? value('MesonFile') : value('ProFile') )}" },
{ "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), value('BuildSystem') === 'qmake' ? 'pro' : 'qbs')}" },
{ "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" },
+ { "key": "MesonFile", "value": "%{ProjectDirectory}/meson.build" },
{ "key": "PluginJsonFile", "value": "%{JS: Util.fileName(value('ProjectName'), 'json')}" },
{ "key": "IsShared", "value": "%{JS: value('Type') === 'shared'}" },
{ "key": "IsStatic", "value": "%{JS: value('Type') === 'static'}" },
@@ -74,6 +75,11 @@
"trKey": "Qbs",
"value": "qbs",
"condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}"
+ },
+ {
+ "trKey": "Meson",
+ "value": "meson",
+ "condition": "%{JS: value('Plugins').indexOf('MesonProjectManager') >= 0}"
}
]
}
@@ -315,6 +321,11 @@
"openAsProject": true,
"condition": "%{JS: value('BuildSystem') === 'cmake'}"
},
+ {
+ "source": "meson.build",
+ "openAsProject": true,
+ "condition": "%{JS: value('BuildSystem') === 'meson'}"
+ },
{
"source": "lib.cpp",
"target": "%{SrcFileName}",
diff --git a/share/qtcreator/templates/wizards/projects/plainc/meson.build b/share/qtcreator/templates/wizards/projects/plainc/meson.build
new file mode 100644
index 00000000000..d88b2c110e1
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/plainc/meson.build
@@ -0,0 +1,3 @@
+project('%{ProjectName}', 'c')
+
+executable('%{ProjectName}', '%{CFileName}')
diff --git a/share/qtcreator/templates/wizards/projects/plainc/wizard.json b/share/qtcreator/templates/wizards/projects/plainc/wizard.json
index 205e02c3790..2f6d8bf5ca4 100644
--- a/share/qtcreator/templates/wizards/projects/plainc/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/plainc/wizard.json
@@ -7,14 +7,15 @@
"trDisplayName": "Plain C Application",
"trDisplayCategory": "Non-Qt Project",
"icon": "../../global/consoleapplication.png",
- "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0 && (value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0)}",
+ "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0 && (value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0 || value('Plugins').indexOf('MesonProjectManager') >= 0)}",
"options":
[
- { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : (value('BuildSystem') === 'cmake' ? value('CMakeFile') : value('QbsFile'))}" },
+ { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : (value('BuildSystem') === 'cmake' ? value('CMakeFile') : ( value('BuildSystem') === 'meson' ? value('MesonFile') : value('QbsFile')))}" },
{ "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" },
{ "key": "QbsFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" },
{ "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" },
+ { "key": "MesonFile", "value": "%{ProjectDirectory}/meson.build" },
{ "key": "CFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-csrc')}" }
],
@@ -56,6 +57,11 @@
"trKey": "Qbs",
"value": "qbs",
"condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}"
+ },
+ {
+ "trKey": "Meson",
+ "value": "meson",
+ "condition": "%{JS: value('Plugins').indexOf('MesonProjectManager') >= 0}"
}
]
}
@@ -98,6 +104,11 @@
"openAsProject": true,
"condition": "%{JS: value('BuildSystem') === 'qbs'}"
},
+ {
+ "source": "meson.build",
+ "openAsProject": true,
+ "condition": "%{JS: value('BuildSystem') === 'meson'}"
+ },
{
"source": "main.c",
"target": "%{CFileName}",
diff --git a/share/qtcreator/templates/wizards/projects/plaincpp/meson.build b/share/qtcreator/templates/wizards/projects/plaincpp/meson.build
new file mode 100644
index 00000000000..4625e042c13
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/plaincpp/meson.build
@@ -0,0 +1,3 @@
+project('%{ProjectName}', 'cpp', default_options : ['cpp_std=c++11'])
+
+executable('%{ProjectName}', '%{CppFileName}')
diff --git a/share/qtcreator/templates/wizards/projects/plaincpp/wizard.json b/share/qtcreator/templates/wizards/projects/plaincpp/wizard.json
index 496f2f41c10..3475d272072 100644
--- a/share/qtcreator/templates/wizards/projects/plaincpp/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/plaincpp/wizard.json
@@ -7,14 +7,15 @@
"trDisplayName": "Plain C++ Application",
"trDisplayCategory": "Non-Qt Project",
"icon": "../../global/consoleapplication.png",
- "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0 && (value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0)}",
+ "enabled": "%{JS: value('Plugins').indexOf('CppEditor') >= 0 && (value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0 || value('Plugins').indexOf('MesonProjectManager') >= 0)}",
"options":
[
- { "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : ('%{BuildSystem}' === 'cmake' ? '%{CMakeFile}' : '%{QbsFile}')}" },
+ { "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : ('%{BuildSystem}' === 'cmake' ? '%{CMakeFile}' : ( '%{BuildSystem}' === 'meson' ? '%{MesonFile}' : '%{QbsFile}'))}" },
{ "key": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" },
{ "key": "QbsFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}" },
{ "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" },
+ { "key": "MesonFile", "value": "%{ProjectDirectory}/meson.build" },
{ "key": "CppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" }
],
@@ -56,6 +57,11 @@
"trKey": "Qbs",
"value": "qbs",
"condition": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0}"
+ },
+ {
+ "trKey": "Meson",
+ "value": "meson",
+ "condition": "%{JS: value('Plugins').indexOf('MesonProjectManager') >= 0}"
}
]
}
@@ -98,6 +104,11 @@
"openAsProject": true,
"condition": "%{JS: '%{BuildSystem}' === 'qbs'}"
},
+ {
+ "source": "meson.build",
+ "openAsProject": true,
+ "condition": "%{JS: '%{BuildSystem}' === 'meson'}"
+ },
{
"source": "main.cpp",
"target": "%{CppFileName}",
diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/meson.build b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/meson.build
new file mode 100644
index 00000000000..c7a3ffd8e0f
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/meson.build
@@ -0,0 +1,23 @@
+project('%{ProjectName}', 'cpp',default_options : ['cpp_std=c++11'])
+
+# Documentation: https://mesonbuild.com/Qt5-module.html
+qt5 = import('qt5')
+qt5dep = dependency('qt5', modules : ['Core', 'Widgets'])
+
+@if %{HasTranslation}
+translations = qt5.compile_translations(ts_files : '%{TsFileName}', build_by_default : true)
+@endif
+
+generated_files = qt5.preprocess(
+ moc_headers : '%{HdrFileName}',
+ @if %{GenerateForm}
+ ui_files : '%{FormFileName}',
+ @endif
+ dependencies: [qt5dep])
+
+executable('%{ProjectName}'
+ , '%{MainFileName}'
+ , '%{SrcFileName}'
+ , generated_files
+ , dependencies : [qt5dep]
+ , install : true)
diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json
index a33f0cb563c..baa5d860e18 100644
--- a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json
@@ -1,6 +1,6 @@
{
"version": 1,
- "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qt4ProjectManager.Qt4Project", "Qbs.QbsProject" ],
+ "supportedProjectTypes": [ "MesonProjectManager.MesonProject","CMakeProjectManager.CMakeProject", "Qt4ProjectManager.Qt4Project", "Qbs.QbsProject" ],
"id": "C.QtWidgets",
"category": "D.ApplicationQt",
"trDescription": "Creates a Qt application for the desktop. Includes a Qt Designer-based main window.\n\nPreselects a desktop Qt for building the application if available.",
@@ -8,13 +8,14 @@
"trDisplayCategory": "Application (Qt)",
"icon": "../../global/guiapplication.png",
"featuresRequired": [ "QtSupport.Wizards.FeatureQt" ],
- "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0}",
+ "enabled": "%{JS: value('Plugins').indexOf('QmakeProjectManager') >= 0 || value('Plugins').indexOf('CMakeProjectManager') >= 0 || value('Plugins').indexOf('QbsProjectManager') >= 0 || value('Plugins').indexOf('MesonProjectManager') >= 0}",
"options":
[
- { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : value('BuildSystem') === 'cmake' ? value('CMakeFile') : value('QbsFile')}" },
+ { "key": "ProjectFile", "value": "%{JS: value('BuildSystem') === 'qmake' ? value('ProFile') : value('BuildSystem') === 'cmake' ? value('CMakeFile') : value('BuildSystem') === 'meson' ? value('MesonFile') : value('QbsFile')}" },
{ "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" },
{ "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" },
+ { "key": "MesonFile", "value": "%{ProjectDirectory}/meson.build" },
{ "key": "QbsFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" },
{ "key": "MainFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" },
{ "key": "UiHdrFileName", "value": "%{JS: (value('BuildSystem') === 'cmake' ? (Util.path(value('FormFileName')) + '/') : '') + 'ui_' + Util.completeBaseName(value('FormFileName')) + '.h'}" },
@@ -58,6 +59,11 @@
"value": "cmake",
"condition": "%{JS: value('Plugins').indexOf('CMakeProjectManager') >= 0}"
},
+ {
+ "trKey": "Meson",
+ "value": "meson",
+ "condition": "%{JS: value('Plugins').indexOf('MesonProjectManager') >= 0}"
+ },
{
"trKey": "Qbs",
"value": "qbs",
@@ -182,6 +188,11 @@
"openAsProject": true,
"condition": "%{JS: value('BuildSystem') === 'qbs'}"
},
+ {
+ "source": "meson.build",
+ "openAsProject": true,
+ "condition": "%{JS: value('BuildSystem') === 'meson'}"
+ },
{
"source": "main.cpp",
"target": "%{MainFileName}",
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
index 85aa9991e66..05f97fde95a 100644
--- a/src/plugins/CMakeLists.txt
+++ b/src/plugins/CMakeLists.txt
@@ -51,6 +51,7 @@ add_subdirectory(fakevim)
add_subdirectory(genericprojectmanager)
add_subdirectory(git)
add_subdirectory(mercurial)
+add_subdirectory(mesonprojectmanager)
add_subdirectory(perforce)
add_subdirectory(qmakeprojectmanager)
add_subdirectory(qmljstools)
diff --git a/src/plugins/mesonprojectmanager/CMakeLists.txt b/src/plugins/mesonprojectmanager/CMakeLists.txt
new file mode 100644
index 00000000000..972fab64731
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/CMakeLists.txt
@@ -0,0 +1,162 @@
+add_qtc_plugin(MesonProjectManager
+ DEPENDS QmlJS
+ PLUGIN_DEPENDS Core CppTools ProjectExplorer TextEditor QtSupport
+ PLUGIN_RECOMMENDS Designer
+ SOURCES
+ mesonprojectplugin.cpp
+ mesonprojectplugin.h
+ versionhelper.h
+ mesonactionsmanager/mesonactionsmanager.h
+ mesonactionsmanager/mesonactionsmanager.cpp
+ settings/tools/toolsmodel.cpp
+ settings/tools/toolssettingswidget.h
+ settings/tools/toolssettingswidget.ui
+ settings/tools/toolssettingswidget.cpp
+ settings/tools/toolssettingspage.cpp
+ settings/tools/toolssettingspage.h
+ settings/tools/toolitemsettings.ui
+ settings/tools/toolitemsettings.cpp
+ settings/tools/toolitemsettings.h
+ settings/tools/tooltreeitem.cpp
+ settings/tools/tooltreeitem.h
+ settings/tools/toolsmodel.h
+ settings/tools/kitaspect/ninjatoolkitaspect.cpp
+ settings/tools/kitaspect/ninjatoolkitaspect.h
+ settings/tools/kitaspect/toolkitaspectwidget.h
+ settings/tools/kitaspect/toolkitaspectwidget.cpp
+ settings/tools/kitaspect/mesontoolkitaspect.cpp
+ settings/tools/kitaspect/mesontoolkitaspect.h
+ settings/tools/toolssettingsaccessor.h
+ settings/tools/toolssettingsaccessor.cpp
+ settings/general/generalsettingswidget.ui
+ settings/general/generalsettingswidget.cpp
+ settings/general/generalsettingswidget.h
+ settings/general/generalsettingspage.h
+ settings/general/generalsettingspage.cpp
+ settings/general/settings.h
+ settings/general/settings.cpp
+ exewrappers/mesonwrapper.cpp
+ exewrappers/mesonwrapper.h
+ exewrappers/ninjawrapper.h
+ exewrappers/toolwrapper.h
+ exewrappers/toolwrapper.cpp
+ exewrappers/mesontools.h
+ exewrappers/mesontools.cpp
+ mesoninfoparser/mesoninfoparser.h
+ mesoninfoparser/buildoptions.h
+ mesoninfoparser/target.h
+ mesoninfoparser/mesoninfo.h
+ mesoninfoparser/parsers/common.h
+ mesoninfoparser/parsers/buildoptionsparser.h
+ mesoninfoparser/parsers/buildsystemfilesparser.h
+ mesoninfoparser/parsers/infoparser.h
+ mesoninfoparser/parsers/targetparser.h
+ kithelper/kitdata.h
+ kithelper/kithelper.h
+ project/mesonproject.h
+ project/mesonproject.cpp
+ project/mesonprojectimporter.h
+ project/mesonprojectimporter.cpp
+ project/mesonbuildsystem.h
+ project/mesonbuildsystem.cpp
+ project/mesonprojectparser.h
+ project/mesonprojectparser.cpp
+ project/mesonbuildconfiguration.h
+ project/mesonbuildconfiguration.cpp
+ project/ninjabuildstep.h
+ project/ninjabuildstep.cpp
+ project/buildoptions/mesonbuildstepconfigwidget.ui
+ project/buildoptions/mesonbuildstepconfigwidget.h
+ project/buildoptions/mesonbuildstepconfigwidget.cpp
+ project/buildoptions/mesonbuildsettingswidget.ui
+ project/buildoptions/mesonbuildsettingswidget.h
+ project/buildoptions/mesonbuildsettingswidget.cpp
+ project/buildoptions/optionsmodel/buildoptionsmodel.h
+ project/buildoptions/optionsmodel/buildoptionsmodel.cpp
+ project/buildoptions/optionsmodel/arrayoptionlineedit.cpp
+ project/buildoptions/optionsmodel/arrayoptionlineedit.h
+ project/mesonprocess.h
+ project/mesonprocess.cpp
+ project/outputparsers/mesonoutputparser.h
+ project/outputparsers/mesonoutputparser.cpp
+ project/outputparsers/ninjaparser.h
+ project/outputparsers/ninjaparser.cpp
+ project/mesonrunconfiguration.h
+ project/mesonrunconfiguration.cpp
+ project/projecttree/projecttree.h
+ project/projecttree/projecttree.cpp
+ project/projecttree/mesonprojectnodes.h
+ project/projecttree/mesonprojectnodes.cpp
+ machinefiles/machinefilemanager.h
+ machinefiles/machinefilemanager.cpp
+ machinefiles/nativefilegenerator.h
+ machinefiles/nativefilegenerator.cpp
+ resources.qrc
+)
+
+if(WITH_TESTS)
+add_qtc_test(tst_mesonwrapper
+ INCLUDES
+ BEFORE "."
+ DEPENDS
+ Qt5::Core Qt5::Test Core
+ Utils
+ DEFINES
+ MESON_SAMPLES_DIR="${CMAKE_CURRENT_SOURCE_DIR}/tests/resources"
+ MESON_SAMPLES_BUILD_DIR="${CMAKE_CURRENT_BINARY_DIR}"
+ SOURCES
+ tests/testmesonwrapper.cpp
+ exewrappers/mesonwrapper.cpp
+ exewrappers/mesonwrapper.h
+ exewrappers/ninjawrapper.h
+ exewrappers/toolwrapper.h
+ exewrappers/toolwrapper.cpp
+ exewrappers/mesontools.h
+)
+
+add_qtc_test(tst_mesoninfoparser
+ INCLUDES
+ BEFORE "."
+ DEPENDS
+ Qt5::Core Qt5::Test Core
+ Utils
+ DEFINES
+ MESON_SAMPLES_DIR="${CMAKE_CURRENT_SOURCE_DIR}/tests/resources"
+ MESON_SAMPLES_BUILD_DIR="${CMAKE_CURRENT_BINARY_DIR}"
+ SOURCES
+ tests/testmesoninfoparser.cpp
+ exewrappers/mesonwrapper.cpp
+ exewrappers/mesonwrapper.h
+ exewrappers/ninjawrapper.h
+ exewrappers/toolwrapper.h
+ exewrappers/toolwrapper.cpp
+ exewrappers/mesontools.h
+ mesoninfoparser/mesoninfoparser.h
+)
+
+add_qtc_test(tst_ninjaparser
+ INCLUDES
+ BEFORE "."
+ DEPENDS
+ Qt5::Core Qt5::Test Core
+ Utils ProjectExplorer
+ SOURCES
+ tests/testninjaparser.cpp
+ project/outputparsers/ninjaparser.cpp
+)
+
+add_qtc_test(tst_mesonparser
+ INCLUDES
+ BEFORE "."
+ DEFINES
+ MESONPARSER_DISABLE_TASKS_FOR_TESTS
+ DEPENDS
+ Qt5::Core Qt5::Test Core
+ Utils ProjectExplorer
+ SOURCES
+ tests/testmesonparser.cpp
+ project/outputparsers/mesonoutputparser.cpp
+)
+
+
+endif(WITH_TESTS)
diff --git a/src/plugins/mesonprojectmanager/MesonProjectManager.json.in b/src/plugins/mesonprojectmanager/MesonProjectManager.json.in
new file mode 100644
index 00000000000..27a0bfda7d0
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/MesonProjectManager.json.in
@@ -0,0 +1,21 @@
+{
+ \"Name\" : \"MesonProjectManager\",
+ \"Version\" : \"$$QTCREATOR_VERSION\",
+ \"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\",
+ \"Vendor\" : \"Laboratory of Plasma Physics\",
+ \"Experimental\" : true,
+ \"DisabledByDefault\" : true,
+ \"Copyright\" : \"(C) $$QTCREATOR_COPYRIGHT_YEAR Laboratory of Plasma Physics\",
+ \"License\" : [ \"Commercial Usage\",
+ \"\",
+ \"Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and The Qt Company.\",
+ \"\",
+ \"GNU General Public License Usage\",
+ \"\",
+ \"Alternatively, this plugin may be used under the terms of the GNU General Public License version 3 as published by the Free Software Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT included in the packaging of this plugin. Please review the following information to ensure the GNU General Public License requirements will be met: https://www.gnu.org/licenses/gpl-3.0.html.\"
+ ],
+ \"Category\" : \"Build Systems\",
+ \"Description\" : \"Meson support.\",
+ \"Url\" : \"http://www.mesonbuild.com\",
+ $$dependencyList
+}
diff --git a/src/plugins/mesonprojectmanager/exewrappers/mesontools.cpp b/src/plugins/mesonprojectmanager/exewrappers/mesontools.cpp
new file mode 100644
index 00000000000..9c773818c85
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/exewrappers/mesontools.cpp
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "mesontools.h"
+namespace MesonProjectManager {
+namespace Internal {
+
+template
+inline bool is(const MesonTools::Tool_t &tool)
+{
+ return bool(std::dynamic_pointer_cast(tool));
+}
+
+template
+std::shared_ptr tool(const Core::Id &id, const std::vector &tools)
+{
+ static_assert(std::is_base_of::value, "Type must derive from ToolWrapper");
+ const auto tool = std::find_if(std::cbegin(tools),
+ std::cend(tools),
+ [&id](const MesonTools::Tool_t &tool) {
+ return tool->id() == id;
+ });
+ if (tool != std::cend(tools) && is(*tool))
+ return std::dynamic_pointer_cast(*tool);
+ return nullptr;
+}
+
+template
+std::shared_ptr autoDetected(const std::vector &tools)
+{
+ static_assert(std::is_base_of::value, "Type must derive from ToolWrapper");
+ for (const auto &tool : tools) {
+ if (tool->autoDetected() && is(tool)) {
+ return std::dynamic_pointer_cast(tool);
+ }
+ }
+ return nullptr;
+}
+
+template
+void fixAutoDetected(std::vector &tools)
+{
+ auto autoDetectedTool = autoDetected(tools);
+ if (!autoDetectedTool) {
+ auto path = T::find();
+ if (path)
+ tools.emplace_back(std::make_shared(
+ QString("System %1 at %2").arg(T::toolName()).arg(path->toString()), *path, true));
+ }
+}
+
+bool MesonTools::isMesonWrapper(const MesonTools::Tool_t &tool)
+{
+ return is(tool);
+}
+
+bool MesonTools::isNinjaWrapper(const MesonTools::Tool_t &tool)
+{
+ return is(tool);
+}
+
+void MesonTools::setTools(std::vector &&tools)
+{
+ auto self = instance();
+ std::swap(self->m_tools, tools);
+ fixAutoDetected(self->m_tools);
+ fixAutoDetected(self->m_tools);
+}
+
+std::shared_ptr MesonTools::ninjaWrapper(const Core::Id &id)
+{
+ return tool(id, MesonTools::instance()->m_tools);
+}
+std::shared_ptr MesonTools::mesonWrapper(const Core::Id &id)
+{
+ return tool(id, MesonTools::instance()->m_tools);
+}
+
+std::shared_ptr MesonTools::ninjaWrapper()
+{
+ return autoDetected(MesonTools::instance()->m_tools);
+}
+
+std::shared_ptr MesonTools::mesonWrapper()
+{
+ return autoDetected(MesonTools::instance()->m_tools);
+}
+
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/exewrappers/mesontools.h b/src/plugins/mesonprojectmanager/exewrappers/mesontools.h
new file mode 100644
index 00000000000..35337d4fc47
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/exewrappers/mesontools.h
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#pragma once
+#include "mesonwrapper.h"
+#include "ninjawrapper.h"
+#include "toolwrapper.h"
+#include
+
+#include
+
+#include
+
+#include
+
+namespace MesonProjectManager {
+namespace Internal {
+
+class MesonTools : public QObject
+{
+ Q_OBJECT
+ MesonTools() {}
+ ~MesonTools() {}
+
+public:
+ using Tool_t = std::shared_ptr;
+
+
+ static bool isMesonWrapper(const Tool_t &tool);
+ static bool isNinjaWrapper(const Tool_t &tool);
+
+ static inline void addTool(const Core::Id &itemId,
+ const QString &name,
+ const Utils::FilePath &exe)
+ {
+ // TODO improve this
+ if (exe.fileName().contains("ninja"))
+ addTool(std::make_shared(name, exe, itemId));
+ else
+ addTool(std::make_shared(name, exe, itemId));
+ }
+
+ static inline void addTool(Tool_t meson)
+ {
+ auto self = instance();
+ self->m_tools.emplace_back(std::move(meson));
+ emit self->toolAdded(self->m_tools.back());
+ }
+
+ static void setTools(std::vector &&tools);
+
+ static inline const std::vector &tools() { return instance()->m_tools; }
+
+ static inline void updateTool(const Core::Id &itemId,
+ const QString &name,
+ const Utils::FilePath &exe)
+ {
+ auto self = instance();
+ auto item = std::find_if(std::begin(self->m_tools),
+ std::end(self->m_tools),
+ [&itemId](const Tool_t &tool) { return tool->id() == itemId; });
+ if (item != std::end(self->m_tools)) {
+ (*item)->setExe(exe);
+ (*item)->setName(name);
+ } else {
+ addTool(itemId, name, exe);
+ }
+ }
+ static void removeTool(const Core::Id &id)
+ {
+ auto self = instance();
+ auto item = Utils::take(self->m_tools, [&id](const auto &item) { return item->id() == id; });
+ QTC_ASSERT(item, return );
+ emit self->toolRemoved(*item);
+ }
+
+ static std::shared_ptr ninjaWrapper(const Core::Id &id);
+ static std::shared_ptr mesonWrapper(const Core::Id &id);
+
+ static std::shared_ptr ninjaWrapper();
+ static std::shared_ptr mesonWrapper();
+
+ Q_SIGNAL void toolAdded(const Tool_t &tool);
+ Q_SIGNAL void toolRemoved(const Tool_t &tool);
+
+ static MesonTools *instance()
+ {
+ static MesonTools inst;
+ return &inst;
+ }
+
+private:
+ std::vector m_tools;
+};
+
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/exewrappers/mesonwrapper.cpp b/src/plugins/mesonprojectmanager/exewrappers/mesonwrapper.cpp
new file mode 100644
index 00000000000..cfc30dc9547
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/exewrappers/mesonwrapper.cpp
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "mesonwrapper.h"
+#include "utils/algorithm.h"
+#include "utils/qtcassert.h"
+#include
+
+namespace {
+template
+void impl_option_cat(QStringList &list, const First &first)
+{
+ list.append(first);
+}
+
+template
+void impl_option_cat(QStringList &list, const First &first, const T &... args)
+{
+ impl_option_cat(list, first);
+ impl_option_cat(list, args...);
+}
+
+template
+QStringList options_cat(const T &... args)
+{
+ QStringList result;
+ impl_option_cat(result, args...);
+ return result;
+}
+
+} // namespace
+namespace MesonProjectManager {
+namespace Internal {
+
+Command MesonWrapper::setup(const Utils::FilePath &sourceDirectory,
+ const Utils::FilePath &buildDirectory,
+ const QStringList &options) const
+{
+ return {m_exe,
+ sourceDirectory,
+ options_cat("setup", options, sourceDirectory.toString(), buildDirectory.toString())};
+}
+
+Command MesonWrapper::configure(const Utils::FilePath &sourceDirectory,
+ const Utils::FilePath &buildDirectory,
+ const QStringList &options) const
+{
+ if (!isSetup(buildDirectory))
+ return setup(sourceDirectory, buildDirectory, options);
+ return {m_exe, buildDirectory, options_cat("configure", options, buildDirectory.toString())};
+}
+
+Command MesonWrapper::regenerate(const Utils::FilePath &sourceDirectory,
+ const Utils::FilePath &buildDirectory) const
+{
+ return {m_exe,
+ buildDirectory,
+ options_cat("--internal",
+ "regenerate",
+ sourceDirectory.toString(),
+ buildDirectory.toString(),
+ "--backend",
+ "ninja")};
+}
+
+Command MesonWrapper::introspect(const Utils::FilePath &sourceDirectory) const
+{
+ return {m_exe,
+ sourceDirectory,
+ {"introspect", "--all", QString("%1/meson.build").arg(sourceDirectory.toString())}};
+}
+
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/exewrappers/mesonwrapper.h b/src/plugins/mesonprojectmanager/exewrappers/mesonwrapper.h
new file mode 100644
index 00000000000..8423b58d2bb
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/exewrappers/mesonwrapper.h
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+#include "../mesonpluginconstants.h"
+#include "toolwrapper.h"
+#include "utils/environment.h"
+#include "utils/fileutils.h"
+#include "utils/optional.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace MesonProjectManager {
+namespace Internal {
+
+template
+bool containsFiles(const QString &path, const File_t &file)
+{
+ return QFile::exists(QString("%1/%2").arg(path).arg(file));
+}
+
+template
+bool containsFiles(const QString &path, const File_t &file, const T &... files)
+{
+ return containsFiles(path, file) && containsFiles(path, files...);
+}
+
+inline bool run_meson(const Command &command, QIODevice *output = nullptr)
+{
+ QProcess process;
+ process.setWorkingDirectory(command.workDir().toString());
+ process.start(command.executable().toString(), command.arguments());
+ if (!process.waitForFinished())
+ return false;
+ if (output) {
+ output->write(process.readAllStandardOutput());
+ }
+ return process.exitCode() == 0;
+}
+
+inline bool isSetup(const Utils::FilePath &buildPath)
+{
+ using namespace Utils;
+ return containsFiles(buildPath.pathAppended(Constants::MESON_INFO_DIR).toString(),
+ Constants::MESON_INTRO_TESTS,
+ Constants::MESON_INTRO_TARGETS,
+ Constants::MESON_INTRO_INSTALLED,
+ Constants::MESON_INTRO_BENCHMARKS,
+ Constants::MESON_INTRO_BUIDOPTIONS,
+ Constants::MESON_INTRO_PROJECTINFO,
+ Constants::MESON_INTRO_DEPENDENCIES,
+ Constants::MESON_INTRO_BUILDSYSTEM_FILES);
+}
+
+class MesonWrapper final : public ToolWrapper
+{
+public:
+ using ToolWrapper::ToolWrapper;
+
+ Command setup(const Utils::FilePath &sourceDirectory,
+ const Utils::FilePath &buildDirectory,
+ const QStringList &options = {}) const;
+ Command configure(const Utils::FilePath &sourceDirectory,
+ const Utils::FilePath &buildDirectory,
+ const QStringList &options = {}) const;
+
+ Command regenerate(const Utils::FilePath &sourceDirectory,
+ const Utils::FilePath &buildDirectory)const;
+
+ Command introspect(const Utils::FilePath &sourceDirectory) const;
+
+ static inline Utils::optional find()
+ {
+ return ToolWrapper::findTool({"meson.py","meson"});
+ }
+
+ static inline QString toolName() { return "Meson"; };
+};
+
+template<>
+inline QVariantMap toVariantMap(const MesonWrapper &meson)
+{
+ QVariantMap data;
+ data.insert(Constants::ToolsSettings::NAME_KEY, meson.m_name);
+ data.insert(Constants::ToolsSettings::EXE_KEY, meson.m_exe.toVariant());
+ data.insert(Constants::ToolsSettings::AUTO_DETECTED_KEY, meson.m_autoDetected);
+ data.insert(Constants::ToolsSettings::ID_KEY, meson.m_id.toSetting());
+ data.insert(Constants::ToolsSettings::TOOL_TYPE_KEY, Constants::ToolsSettings::TOOL_TYPE_MESON);
+ return data;
+}
+template<>
+inline MesonWrapper *fromVariantMap(const QVariantMap &data)
+{
+ return new MesonWrapper(data[Constants::ToolsSettings::NAME_KEY].toString(),
+ Utils::FilePath::fromVariant(data[Constants::ToolsSettings::EXE_KEY]),
+ Core::Id::fromSetting(data[Constants::ToolsSettings::ID_KEY]),
+ data[Constants::ToolsSettings::AUTO_DETECTED_KEY].toBool());
+}
+
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/exewrappers/ninjawrapper.h b/src/plugins/mesonprojectmanager/exewrappers/ninjawrapper.h
new file mode 100644
index 00000000000..85f64765871
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/exewrappers/ninjawrapper.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#pragma once
+#include "../mesonpluginconstants.h"
+#include "toolwrapper.h"
+namespace MesonProjectManager {
+namespace Internal {
+
+class NinjaWrapper final : public ToolWrapper
+{
+public:
+ using ToolWrapper::ToolWrapper;
+
+ static inline Utils::optional find()
+ {
+ return ToolWrapper::findTool({"ninja", "ninja-build"});
+ }
+ static inline QString toolName() { return "Ninja"; };
+};
+
+template<>
+inline QVariantMap toVariantMap(const NinjaWrapper &meson)
+{
+ QVariantMap data;
+ data.insert(Constants::ToolsSettings::NAME_KEY, meson.m_name);
+ data.insert(Constants::ToolsSettings::EXE_KEY, meson.m_exe.toVariant());
+ data.insert(Constants::ToolsSettings::AUTO_DETECTED_KEY, meson.m_autoDetected);
+ data.insert(Constants::ToolsSettings::ID_KEY, meson.m_id.toSetting());
+ data.insert(Constants::ToolsSettings::TOOL_TYPE_KEY, Constants::ToolsSettings::TOOL_TYPE_NINJA);
+ return data;
+}
+template<>
+inline NinjaWrapper *fromVariantMap(const QVariantMap &data)
+{
+ return new NinjaWrapper(data[Constants::ToolsSettings::NAME_KEY].toString(),
+ Utils::FilePath::fromVariant(data[Constants::ToolsSettings::EXE_KEY]),
+ Core::Id::fromSetting(data[Constants::ToolsSettings::ID_KEY]),
+ data[Constants::ToolsSettings::AUTO_DETECTED_KEY].toBool());
+}
+
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/exewrappers/toolwrapper.cpp b/src/plugins/mesonprojectmanager/exewrappers/toolwrapper.cpp
new file mode 100644
index 00000000000..a89d2bf3363
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/exewrappers/toolwrapper.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#include "toolwrapper.h"
+
+namespace MesonProjectManager {
+namespace Internal {
+
+ToolWrapper::ToolWrapper(const QString &name, const Utils::FilePath &path, bool autoDetected)
+ : m_version(read_version(path))
+ , m_isValid{path.exists() && m_version.isValid}
+ , m_autoDetected{autoDetected}
+ , m_id{Core::Id::fromString(QUuid::createUuid().toString())}
+ , m_exe{path}
+ , m_name{name}
+{}
+
+ToolWrapper::ToolWrapper(const QString &name,
+ const Utils::FilePath &path,
+ const Core::Id &id,
+ bool autoDetected)
+ : m_version(read_version(path))
+ , m_isValid{path.exists() && m_version.isValid}
+ , m_autoDetected{autoDetected}
+ , m_id{id}
+ , m_exe{path}
+ , m_name{name}
+{
+ QTC_ASSERT(m_id.isValid(), m_id = Core::Id::fromString(QUuid::createUuid().toString()));
+}
+
+void ToolWrapper::setExe(const Utils::FilePath &newExe)
+{
+ m_exe = newExe;
+ m_version = read_version(m_exe);
+}
+
+Version ToolWrapper::read_version(const Utils::FilePath &toolPath)
+{
+ if (toolPath.toFileInfo().isExecutable()) {
+ QProcess process;
+ process.start(toolPath.toString(), {"--version"});
+ if (process.waitForFinished()) {
+ return Version::fromString(QString::fromUtf8(process.readLine()));
+ }
+ }
+ return {};
+}
+
+Utils::optional ToolWrapper::findTool(const QStringList &exeNames)
+{
+ using namespace Utils;
+ Environment systemEnvironment = Environment::systemEnvironment();
+ for (const auto &exe : exeNames) {
+ const FilePath exe_path = systemEnvironment.searchInPath(exe);
+ if (exe_path.exists())
+ return exe_path;
+ }
+ return Utils::nullopt;
+}
+
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/exewrappers/toolwrapper.h b/src/plugins/mesonprojectmanager/exewrappers/toolwrapper.h
new file mode 100644
index 00000000000..717b38e4c15
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/exewrappers/toolwrapper.h
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#pragma once
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace MesonProjectManager {
+namespace Internal {
+
+class Command
+{
+ Utils::CommandLine m_cmd;
+ Utils::FilePath m_workDir;
+
+public:
+ Command() = default;
+ Command(const Utils::FilePath &exe, const Utils::FilePath &workDir, const QStringList &args)
+ : m_cmd{exe, args}
+ , m_workDir{workDir}
+ {}
+ inline const Utils::CommandLine &cmdLine() const { return m_cmd; }
+ inline const Utils::FilePath &workDir() const { return m_workDir; }
+ inline Utils::FilePath executable() const { return m_cmd.executable(); }
+ inline QStringList arguments() const { return m_cmd.splitArguments(); }
+ inline QString toUserOutput() const { return m_cmd.toUserOutput(); };
+};
+
+class ToolWrapper
+{
+public:
+ virtual ~ToolWrapper(){};
+ ToolWrapper() = delete;
+ ToolWrapper(const QString &name, const Utils::FilePath &path, bool autoDetected = false);
+ ToolWrapper(const QString &name,
+ const Utils::FilePath &path,
+ const Core::Id &id,
+ bool autoDetected = false);
+ ToolWrapper(const ToolWrapper &other) = default;
+ ToolWrapper(ToolWrapper &&other) = default;
+ ToolWrapper &operator=(const ToolWrapper &other) = default;
+ ToolWrapper &operator=(ToolWrapper &&other) = default;
+
+ inline const Version &version() const noexcept { return m_version; };
+ inline bool isValid() const noexcept { return m_isValid; };
+ inline bool autoDetected() const noexcept { return m_autoDetected; };
+ inline Core::Id id() const noexcept { return m_id; };
+ inline Utils::FilePath exe() const noexcept { return m_exe; };
+ inline QString name() const noexcept { return m_name; };
+
+ inline void setName(const QString &newName) { m_name = newName; }
+ virtual void setExe(const Utils::FilePath &newExe);
+
+ static Version read_version(const Utils::FilePath &toolPath);
+
+ static Utils::optional findTool(const QStringList &exeNames);
+
+ template
+ friend QVariantMap toVariantMap(const T &);
+ template
+ friend T fromVariantMap(const QVariantMap &);
+
+protected:
+ Version m_version;
+ bool m_isValid;
+ bool m_autoDetected;
+ Core::Id m_id;
+ Utils::FilePath m_exe;
+ QString m_name;
+};
+
+template
+QVariantMap toVariantMap(const T &);
+template
+T fromVariantMap(const QVariantMap &);
+
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/icons/README.txt b/src/plugins/mesonprojectmanager/icons/README.txt
new file mode 100644
index 00000000000..e21aaaa0498
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/icons/README.txt
@@ -0,0 +1,3 @@
+These pictures are place holders for real Meson logo until license issue is resolved, see here for more details:
+https://codereview.qt-project.org/c/qt-creator/qt-creator/+/298968/23
+
diff --git a/src/plugins/mesonprojectmanager/icons/meson_bw_logo.png b/src/plugins/mesonprojectmanager/icons/meson_bw_logo.png
new file mode 100644
index 00000000000..57e017af715
Binary files /dev/null and b/src/plugins/mesonprojectmanager/icons/meson_bw_logo.png differ
diff --git a/src/plugins/mesonprojectmanager/icons/meson_bw_logo@2x.png b/src/plugins/mesonprojectmanager/icons/meson_bw_logo@2x.png
new file mode 100644
index 00000000000..51ecb6665d8
Binary files /dev/null and b/src/plugins/mesonprojectmanager/icons/meson_bw_logo@2x.png differ
diff --git a/src/plugins/mesonprojectmanager/icons/meson_logo.png b/src/plugins/mesonprojectmanager/icons/meson_logo.png
new file mode 100644
index 00000000000..8b137891791
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/icons/meson_logo.png
@@ -0,0 +1 @@
+
diff --git a/src/plugins/mesonprojectmanager/kithelper/kitdata.h b/src/plugins/mesonprojectmanager/kithelper/kitdata.h
new file mode 100644
index 00000000000..a4463a66402
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/kithelper/kitdata.h
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#pragma once
+#include
+#include
+namespace MesonProjectManager {
+namespace Internal {
+struct KitData
+{
+ QString cCompilerPath;
+ QString cxxCompilerPath;
+ QString cmakePath;
+ QString qmakePath;
+ QString qtVersionStr;
+ Utils::QtVersion qtVersion;
+};
+
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/kithelper/kithelper.h b/src/plugins/mesonprojectmanager/kithelper/kithelper.h
new file mode 100644
index 00000000000..9f0f8295e36
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/kithelper/kithelper.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#include "kitdata.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#pragma once
+namespace MesonProjectManager {
+namespace Internal {
+namespace KitHelper {
+namespace details {
+inline QString expand(const ProjectExplorer::Kit *kit, const QString ¯o)
+{
+ return kit->macroExpander()->expand(macro);
+}
+} // namespace details
+
+inline QString cCompilerPath(const ProjectExplorer::Kit *kit)
+{
+ QTC_ASSERT(kit, return "");
+ return details::expand(kit, "%{Compiler:Executable:C}");
+}
+
+inline QString cxxCompilerPath(const ProjectExplorer::Kit *kit)
+{
+ QTC_ASSERT(kit, return "");
+ return details::expand(kit, "%{Compiler:Executable:Cxx}");
+}
+
+inline QString qmakePath(const ProjectExplorer::Kit *kit)
+{
+ return details::expand(kit, "%{Qt:qmakeExecutable}");
+}
+
+inline QString cmakePath(const ProjectExplorer::Kit *kit)
+{
+ return details::expand(kit, "%{CMake:Executable:FilePath}");
+}
+
+inline QString qtVersion(const ProjectExplorer::Kit *kit)
+{
+ QTC_ASSERT(kit, return "");
+ return details::expand(kit, "%{Qt:Version}");
+}
+
+inline KitData kitData(const ProjectExplorer::Kit *kit)
+{
+ QTC_ASSERT(kit, return {});
+ KitData data;
+ data.cCompilerPath = cCompilerPath(kit);
+ data.cxxCompilerPath = cxxCompilerPath(kit);
+ data.cmakePath = cmakePath(kit);
+ data.qmakePath = qmakePath(kit);
+ data.qtVersionStr = qtVersion(kit);
+ data.qtVersion = Utils::QtVersion::None;
+ auto version = Version::fromString(data.qtVersionStr);
+ if (version.isValid) {
+ switch (version.major) {
+ case 4:
+ data.qtVersion = Utils::QtVersion::Qt4;
+ break;
+ case 5:
+ data.qtVersion = Utils::QtVersion::Qt5;
+ break;
+ default:
+ data.qtVersion = Utils::QtVersion::Unknown;
+ }
+ }
+ return data;
+}
+
+} // namespace KitHelper
+
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/machinefiles/machinefilemanager.cpp b/src/plugins/mesonprojectmanager/machinefiles/machinefilemanager.cpp
new file mode 100644
index 00000000000..b4bffabd0b9
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/machinefiles/machinefilemanager.cpp
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "machinefilemanager.h"
+#include "nativefilegenerator.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace MesonProjectManager {
+namespace Internal {
+
+const char MACHINE_FILE_PREFIX[] = "Meson-MachineFile-";
+const char MACHINE_FILE_EXT[] = ".ini";
+
+template
+bool withFile(const Utils::FilePath &path, const F &f)
+{
+ QFile file(path.toString());
+ if (file.open(QIODevice::WriteOnly)) {
+ f(&file);
+ return file.flush();
+ }
+ return false;
+}
+
+Utils::FilePath MachineFilesDir()
+{
+ return Utils::FilePath::fromString(Core::ICore::userResourcePath())
+ .pathAppended("Meson-machine-files");
+}
+
+MachineFileManager::MachineFileManager()
+{
+ using namespace ProjectExplorer;
+ connect(KitManager::instance(),
+ &KitManager::kitAdded,
+ this,
+ &MachineFileManager::addMachineFile);
+ connect(KitManager::instance(),
+ &KitManager::kitUpdated,
+ this,
+ &MachineFileManager::updateMachineFile);
+ connect(KitManager::instance(),
+ &KitManager::kitRemoved,
+ this,
+ &MachineFileManager::removeMachineFile);
+ connect(KitManager::instance(),
+ &KitManager::kitsLoaded,
+ this,
+ &MachineFileManager::cleanupMachineFiles);
+}
+
+Utils::FilePath MachineFileManager::machineFile(const ProjectExplorer::Kit *kit)
+{
+ QTC_ASSERT(kit, return {});
+ auto baseName
+ = QString("%1%2%3").arg(MACHINE_FILE_PREFIX).arg(kit->id().toString()).arg(MACHINE_FILE_EXT);
+ baseName = baseName.remove('{').remove('}');
+ return MachineFilesDir().pathAppended(baseName);
+}
+
+void MachineFileManager::addMachineFile(const ProjectExplorer::Kit *kit)
+{
+ auto filePath = machineFile(kit);
+ QTC_ASSERT(!filePath.isEmpty(), return );
+ auto data = KitHelper::kitData(kit);
+ QTC_ASSERT(withFile(filePath,
+ [&data](QFile *file) { NativeFileGenerator::makeNativeFile(file, data); }),
+ return );
+}
+
+void MachineFileManager::removeMachineFile(const ProjectExplorer::Kit *kit)
+{
+ auto filePath = machineFile(kit);
+ if (filePath.exists())
+ QFile::remove(filePath.toString());
+}
+
+void MachineFileManager::updateMachineFile(const ProjectExplorer::Kit *kit)
+{
+ addMachineFile(kit);
+}
+
+void MachineFileManager::cleanupMachineFiles()
+{
+ const auto kits = ProjectExplorer::KitManager::kits();
+ auto machineFilesDir = QDir(MachineFilesDir().toString());
+ if (!machineFilesDir.exists()) {
+ machineFilesDir.mkdir(machineFilesDir.path());
+ }
+ auto machineFiles = QDir(MachineFilesDir().toString())
+ .entryList(
+ {QString("%1*%2").arg(MACHINE_FILE_PREFIX).arg(MACHINE_FILE_EXT)});
+ QStringList expected;
+ for (auto const *kit : kits) {
+ QString fname = machineFile(kit).toString();
+ expected.push_back(fname);
+ if (!machineFiles.contains(fname))
+ addMachineFile(kit);
+ }
+
+ for (const auto &file : machineFiles) {
+ if (!expected.contains(file))
+ QFile::remove(file);
+ }
+}
+
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/machinefiles/machinefilemanager.h b/src/plugins/mesonprojectmanager/machinefiles/machinefilemanager.h
new file mode 100644
index 00000000000..e4fe27b6bca
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/machinefiles/machinefilemanager.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#pragma once
+#include
+#include
+#include
+#include
+
+namespace MesonProjectManager {
+namespace Internal {
+
+class MachineFileManager final : public QObject
+{
+ Q_OBJECT
+public:
+ MachineFileManager();
+
+ static Utils::FilePath machineFile(const ProjectExplorer::Kit *kit);
+
+private:
+ void addMachineFile(const ProjectExplorer::Kit *kit);
+ void removeMachineFile(const ProjectExplorer::Kit *kit);
+ void updateMachineFile(const ProjectExplorer::Kit *kit);
+ void cleanupMachineFiles();
+};
+
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/machinefiles/nativefilegenerator.cpp b/src/plugins/mesonprojectmanager/machinefiles/nativefilegenerator.cpp
new file mode 100644
index 00000000000..249c96809f4
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/machinefiles/nativefilegenerator.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#include "nativefilegenerator.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace MesonProjectManager {
+namespace Internal {
+NativeFileGenerator::NativeFileGenerator() {}
+
+inline void addEntry(QIODevice *nativeFile, const QString &key, const QString &value)
+{
+ nativeFile->write(QString("%1 = '%2'\n").arg(key).arg(value).toUtf8());
+}
+
+void writeBinariesSection(QIODevice *nativeFile, const KitData &kitData)
+{
+ nativeFile->write("[binaries]\n");
+ addEntry(nativeFile, "c", kitData.cCompilerPath);
+ addEntry(nativeFile, "cpp", kitData.cxxCompilerPath);
+ addEntry(nativeFile, "qmake", kitData.qmakePath);
+ if (kitData.qtVersion == Utils::QtVersion::Qt4)
+ addEntry(nativeFile, QString{"qmake-qt4"}, kitData.qmakePath);
+ else if (kitData.qtVersion == Utils::QtVersion::Qt5)
+ addEntry(nativeFile, QString{"qmake-qt5"}, kitData.qmakePath);
+ addEntry(nativeFile, "cmake", kitData.cmakePath);
+}
+
+void NativeFileGenerator::makeNativeFile(QIODevice *nativeFile, const KitData &kitData)
+{
+ QTC_ASSERT(nativeFile, return );
+ writeBinariesSection(nativeFile, kitData);
+}
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/machinefiles/nativefilegenerator.h b/src/plugins/mesonprojectmanager/machinefiles/nativefilegenerator.h
new file mode 100644
index 00000000000..fab2472333d
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/machinefiles/nativefilegenerator.h
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#pragma once
+#include
+#include
+#include
+namespace MesonProjectManager {
+namespace Internal {
+class NativeFileGenerator
+{
+ NativeFileGenerator();
+
+public:
+ static void makeNativeFile(QIODevice *nativeFile, const KitData &kitData);
+};
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/mesonactionsmanager/mesonactionsmanager.cpp b/src/plugins/mesonprojectmanager/mesonactionsmanager/mesonactionsmanager.cpp
new file mode 100644
index 00000000000..521b0ba865f
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/mesonactionsmanager/mesonactionsmanager.cpp
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "mesonactionsmanager.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+namespace MesonProjectManager {
+namespace Internal {
+
+MesonActionsManager::MesonActionsManager()
+ : configureActionMenu(tr("Configure"))
+ , configureActionContextMenu(tr("Configure"))
+{
+ const Core::Context globalContext(Core::Constants::C_GLOBAL);
+ const Core::Context projectContext{Constants::Project::ID};
+ Core::ActionContainer *mproject = Core::ActionManager::actionContainer(
+ ProjectExplorer::Constants::M_PROJECTCONTEXT);
+ Core::ActionContainer *msubproject = Core::ActionManager::actionContainer(
+ ProjectExplorer::Constants::M_SUBPROJECTCONTEXT);
+
+ Core::Command *command;
+
+ {
+ command = Core::ActionManager::registerAction(&configureActionMenu,
+ "MesonProject.Configure",
+ projectContext);
+ mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
+ msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
+ connect(&configureActionMenu,
+ &QAction::triggered,
+ this,
+ &MesonActionsManager::configureCurrentProject);
+ }
+
+ {
+ command = Core::ActionManager::registerAction(&buildTargetContextAction,
+ "Meson.BuildTargetContextMenu",
+ projectContext);
+ command->setAttribute(Core::Command::CA_Hide);
+ command->setAttribute(Core::Command::CA_UpdateText);
+ command->setDescription(buildTargetContextAction.text());
+
+ Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_SUBPROJECTCONTEXT)
+ ->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
+ // Wire up context menu updates:
+ connect(ProjectExplorer::ProjectTree::instance(),
+ &ProjectExplorer::ProjectTree::currentNodeChanged,
+ this,
+ &MesonActionsManager::updateContextActions);
+
+ connect(&buildTargetContextAction, &Utils::ParameterAction::triggered, this, [] {
+ auto bs = qobject_cast(
+ ProjectExplorer::ProjectTree::currentBuildSystem());
+ if (bs) {
+ auto targetNode = dynamic_cast(
+ ProjectExplorer::ProjectTree::currentNode());
+ targetNode->build();
+ }
+ });
+ }
+}
+
+void MesonActionsManager::configureCurrentProject()
+{
+ auto bs = dynamic_cast(ProjectExplorer::ProjectTree::currentBuildSystem());
+ QTC_ASSERT(bs, return );
+ if (ProjectExplorer::ProjectExplorerPlugin::saveModifiedFiles())
+ bs->configure();
+}
+
+void MesonActionsManager::updateContextActions()
+{
+ auto targetNode = dynamic_cast(
+ ProjectExplorer::ProjectTree::currentNode());
+ const QString targetDisplayName = targetNode ? targetNode->displayName() : QString();
+
+ // Build Target:
+ buildTargetContextAction.setParameter(targetDisplayName);
+ buildTargetContextAction.setEnabled(targetNode);
+ buildTargetContextAction.setVisible(targetNode);
+}
+
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/mesonactionsmanager/mesonactionsmanager.h b/src/plugins/mesonprojectmanager/mesonactionsmanager/mesonactionsmanager.h
new file mode 100644
index 00000000000..34bf2eb4443
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/mesonactionsmanager/mesonactionsmanager.h
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#pragma once
+#include
+#include
+#include
+namespace MesonProjectManager {
+namespace Internal {
+class MesonActionsManager : public QObject
+{
+ Q_OBJECT
+ Utils::ParameterAction buildTargetContextAction{
+ tr("Build"), tr("Build \"%1\""), Utils::ParameterAction::AlwaysEnabled /*handled manually*/
+ };
+ QAction configureActionMenu;
+ QAction configureActionContextMenu;
+ void configureCurrentProject();
+ void updateContextActions();
+
+public:
+ MesonActionsManager();
+};
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/mesoninfoparser/buildoptions.h b/src/plugins/mesonprojectmanager/mesoninfoparser/buildoptions.h
new file mode 100644
index 00000000000..74b33b72cc7
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/mesoninfoparser/buildoptions.h
@@ -0,0 +1,266 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#pragma once
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+namespace MesonProjectManager {
+namespace Internal {
+
+struct ComboData
+{
+ QString value() const { return m_choices.at(m_currentIndex != -1 ? m_currentIndex : 0); }
+ void setValue(const QString &value) { m_currentIndex = m_choices.indexOf(value); }
+ ComboData(const QStringList &choices, const QString &value)
+ : m_choices{choices}
+ {
+ setValue(value);
+ }
+ ComboData() = default;
+ const QStringList &choices() const { return m_choices; }
+ int currentIndex() const { return m_currentIndex; }
+
+private:
+ QStringList m_choices;
+ int m_currentIndex = 0;
+};
+
+struct FeatureData : ComboData
+{
+ FeatureData()
+ : ComboData({"enabled", "disabled", "auto"}, "disabled")
+ {}
+ FeatureData(const QString &value)
+ : ComboData({"enabled", "disabled", "auto"}, value)
+ {}
+};
+
+} // namespace Internal
+} // namespace MesonProjectManager
+Q_DECLARE_METATYPE(MesonProjectManager::Internal::FeatureData);
+Q_DECLARE_METATYPE(MesonProjectManager::Internal::ComboData);
+
+namespace MesonProjectManager {
+namespace Internal {
+
+struct BuildOption
+{
+ enum class Type { integer, string, feature, combo, array, boolean, unknown };
+ const QString name;
+ const QString section;
+ const QString description;
+ const Utils::optional subproject;
+ virtual ~BuildOption() {}
+ virtual QVariant value() const = 0;
+ virtual QString valueStr() const = 0;
+ virtual void setValue(const QVariant &) = 0;
+ virtual Type type() const = 0;
+ virtual BuildOption *copy() const = 0;
+ inline QString fullName() const
+ {
+ if (subproject)
+ return QString("%1:%2").arg(*subproject).arg(name);
+ return name;
+ }
+ inline virtual QString mesonArg() const
+ {
+ return QString("-D%1=%2").arg(fullName()).arg(valueStr());
+ }
+ BuildOption(const QString &name, const QString §ion, const QString &description)
+ : name{name.contains(":") ? name.split(":").last() : name}
+ , section{section}
+ , description{description}
+ , subproject{name.contains(":") ? Utils::optional(name.split(":").first())
+ : Utils::nullopt}
+ {}
+}; // namespace Internal
+
+struct IntegerBuildOption final : BuildOption
+{
+ QVariant value() const override { return m_currentValue; }
+ QString valueStr() const override { return QString::number(m_currentValue); }
+ void setValue(const QVariant &value) override { m_currentValue = value.toInt(); }
+ Type type() const override { return Type::integer; }
+ BuildOption *copy() const override { return new IntegerBuildOption{*this}; }
+ IntegerBuildOption(const QString &name,
+ const QString §ion,
+ const QString &description,
+ const QVariant &value)
+ : BuildOption(name, section, description)
+ , m_currentValue{value.toInt()}
+ {}
+
+protected:
+ int m_currentValue;
+};
+
+struct StringBuildOption : BuildOption
+{
+ QVariant value() const override { return m_currentValue; }
+ QString valueStr() const override { return m_currentValue; }
+ void setValue(const QVariant &value) override { m_currentValue = value.toString(); }
+ Type type() const override { return Type::string; }
+ BuildOption *copy() const override { return new StringBuildOption{*this}; }
+
+ StringBuildOption(const QString &name,
+ const QString §ion,
+ const QString &description,
+ const QVariant &value)
+ : BuildOption(name, section, description)
+ , m_currentValue{value.toString()}
+ {}
+
+protected:
+ QString m_currentValue;
+};
+
+struct FeatureBuildOption : BuildOption
+{
+ QVariant value() const override { return QVariant::fromValue(m_currentValue); }
+ QString valueStr() const override { return m_currentValue.value(); }
+ void setValue(const QVariant &value) override { m_currentValue.setValue(value.toString()); }
+ Type type() const override { return Type::feature; }
+ BuildOption *copy() const override { return new FeatureBuildOption{*this}; }
+ FeatureBuildOption(const QString &name,
+ const QString §ion,
+ const QString &description,
+ const QVariant &value)
+ : BuildOption(name, section, description)
+ {
+ setValue(value);
+ }
+
+protected:
+ FeatureData m_currentValue;
+};
+
+struct ComboBuildOption : BuildOption
+{
+ const QStringList &choices() const { return m_currentValue.choices(); }
+ QVariant value() const override { return QVariant::fromValue(m_currentValue); }
+ QString valueStr() const override { return m_currentValue.value(); }
+ void setValue(const QVariant &value) override { m_currentValue.setValue(value.toString()); }
+ Type type() const override { return Type::combo; }
+ BuildOption *copy() const override { return new ComboBuildOption{*this}; }
+ ComboBuildOption(const QString &name,
+ const QString §ion,
+ const QString &description,
+ const QStringList &choices,
+ const QVariant &value)
+ : BuildOption(name, section, description)
+ , m_currentValue{choices, value.toString()}
+ {}
+
+protected:
+ ComboData m_currentValue;
+};
+
+static inline QStringList quoteAll(const QStringList &values)
+{
+ QStringList quoted;
+ std::transform(std::cbegin(values),
+ std::cend(values),
+ std::back_inserter(quoted),
+ [](const QString &v) {
+ if (v.front() == '\'' && v.back() == '\'')
+ return v;
+ return QString("\'%1\'").arg(v);
+ });
+ return quoted;
+}
+struct ArrayBuildOption : BuildOption
+{
+ QVariant value() const override { return m_currentValue; }
+ QString valueStr() const override { return m_currentValue.join(" "); }
+ void setValue(const QVariant &value) override
+ {
+ m_currentValue = quoteAll(value.toStringList());
+ }
+ Type type() const override { return Type::array; }
+ BuildOption *copy() const override { return new ArrayBuildOption{*this}; }
+ inline virtual QString mesonArg() const override
+ {
+ return QString("-D%1=[%2]").arg(fullName()).arg(quoteAll(m_currentValue).join(','));
+ }
+ ArrayBuildOption(const QString &name,
+ const QString §ion,
+ const QString &description,
+ const QVariant &value)
+ : BuildOption(name, section, description)
+ , m_currentValue{quoteAll(value.toStringList())}
+ {}
+
+protected:
+ QStringList m_currentValue;
+};
+
+struct BooleanBuildOption : BuildOption
+{
+ QVariant value() const override { return m_currentValue; }
+ QString valueStr() const override
+ {
+ return m_currentValue ? QString{"true"} : QString{"false"};
+ }
+ void setValue(const QVariant &value) override { m_currentValue = value.toBool(); }
+ Type type() const override { return Type::boolean; }
+ BuildOption *copy() const override { return new BooleanBuildOption{*this}; }
+
+ BooleanBuildOption(const QString &name,
+ const QString §ion,
+ const QString &description,
+ const QVariant &value)
+ : BuildOption(name, section, description)
+ {
+ setValue(value);
+ }
+
+protected:
+ bool m_currentValue;
+};
+
+struct UnknownBuildOption : BuildOption
+{
+ QVariant value() const override { return "Unknown option"; }
+ QString valueStr() const override { return "Unknown option"; }
+ void setValue(const QVariant &) override {}
+ Type type() const override { return Type::unknown; }
+ BuildOption *copy() const override { return new UnknownBuildOption{*this}; }
+
+ UnknownBuildOption(const QString &name, const QString §ion, const QString &description)
+ : BuildOption(name, section, description)
+ {}
+};
+
+using BuildOptionsList = std::vector>;
+
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/mesoninfoparser/mesoninfo.h b/src/plugins/mesonprojectmanager/mesoninfoparser/mesoninfo.h
new file mode 100644
index 00000000000..258c01a6dd4
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/mesoninfoparser/mesoninfo.h
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#pragma once
+#include
+namespace MesonProjectManager {
+namespace Internal {
+struct MesonInfo
+{
+ Version mesonVersion;
+};
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/mesoninfoparser/mesoninfoparser.h b/src/plugins/mesonprojectmanager/mesoninfoparser/mesoninfoparser.h
new file mode 100644
index 00000000000..7db6d96acfd
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/mesoninfoparser/mesoninfoparser.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#pragma once
+#include "buildoptions.h"
+#include "mesoninfo.h"
+#include "parsers/buildoptionsparser.h"
+#include "parsers/buildsystemfilesparser.h"
+#include "parsers/infoparser.h"
+#include "parsers/targetparser.h"
+#include "target.h"
+#include
+#include
+#include
+#include
+namespace MesonProjectManager {
+namespace Internal {
+class MesonInfoParserPrivate;
+
+namespace MesonInfoParser {
+struct Result
+{
+ TargetsList targets;
+ BuildOptionsList buildOptions;
+ std::vector buildSystemFiles;
+ Utils::optional mesonInfo;
+};
+
+inline Result parse(const QString &buildDir)
+{
+ return {TargetParser{buildDir}.targetList(),
+ BuildOptionsParser{buildDir}.takeBuildOptions(),
+ BuildSystemFilesParser{buildDir}.files(),
+ InfoParser{buildDir}.info()};
+}
+
+inline Result parse(const QByteArray &data)
+{
+ auto json = QJsonDocument::fromJson(data);
+ return {TargetParser{json}.targetList(),
+ BuildOptionsParser{json}.takeBuildOptions(),
+ BuildSystemFilesParser{json}.files(),
+ Utils::nullopt};
+}
+
+inline Result parse(QIODevice *introFile)
+{
+ if (introFile) {
+ if (!introFile->isOpen())
+ introFile->open(QIODevice::ReadOnly | QIODevice::Text);
+ introFile->seek(0);
+ auto data = introFile->readAll();
+ return parse(data);
+ }
+ return {};
+}
+inline Utils::optional mesonInfo(const QString &buildDir)
+{
+ return InfoParser{buildDir}.info();
+}
+
+} // namespace MesonInfoParser
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/mesoninfoparser/parsers/buildoptionsparser.h b/src/plugins/mesonprojectmanager/mesoninfoparser/parsers/buildoptionsparser.h
new file mode 100644
index 00000000000..bbceb83a57e
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/mesoninfoparser/parsers/buildoptionsparser.h
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#pragma once
+#include "../../mesonpluginconstants.h"
+#include "../buildoptions.h"
+#include "./common.h"
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+namespace MesonProjectManager {
+namespace Internal {
+
+class BuildOptionsParser
+{
+ static inline std::unique_ptr load_option(const QJsonObject &option)
+ {
+ const auto type = option["type"].toString();
+ if (type == "string")
+ return std::make_unique(option["name"].toString(),
+ option["section"].toString(),
+ option["description"].toString(),
+ option["value"]);
+ if (type == "boolean")
+ return std::make_unique(option["name"].toString(),
+ option["section"].toString(),
+ option["description"].toString(),
+ option["value"]);
+ if (type == "combo")
+ return std::make_unique(option["name"].toString(),
+ option["section"].toString(),
+ option["description"].toString(),
+ option["choices"].toVariant().toStringList(),
+ option["value"]);
+ if (type == "integer")
+ return std::make_unique(option["name"].toString(),
+ option["section"].toString(),
+ option["description"].toString(),
+ option["value"]);
+ if (type == "array")
+ return std::make_unique(option["name"].toString(),
+ option["section"].toString(),
+ option["description"].toString(),
+ option["value"].toVariant());
+ if (type == "feature")
+ return std::make_unique(option["name"].toString(),
+ option["section"].toString(),
+ option["description"].toString(),
+ option["value"]);
+ return std::make_unique(option["name"].toString(),
+ option["section"].toString(),
+ option["description"].toString());
+ }
+
+ static inline std::vector> load_options(const QJsonArray &arr)
+ {
+ std::vector> buildOptions;
+ std::transform(std::cbegin(arr),
+ std::cend(arr),
+ std::back_inserter(buildOptions),
+ [](const auto &option) { return load_option(option.toObject()); });
+ return buildOptions;
+ }
+
+ std::vector> m_buildOptions;
+
+public:
+ BuildOptionsParser(const QString &buildDir)
+ {
+ auto arr = load(QString("%1/%2/%3")
+ .arg(buildDir)
+ .arg(Constants::MESON_INFO_DIR)
+ .arg(Constants::MESON_INTRO_BUIDOPTIONS));
+ if (arr)
+ m_buildOptions = load_options(*arr);
+ }
+ BuildOptionsParser(const QJsonDocument &js)
+ {
+ auto obj = get(js.object(), "buildoptions");
+ if (obj)
+ m_buildOptions = load_options(*obj);
+ }
+
+ inline std::vector> takeBuildOptions()
+ {
+ return std::move(m_buildOptions);
+ }
+};
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/mesoninfoparser/parsers/buildsystemfilesparser.h b/src/plugins/mesonprojectmanager/mesoninfoparser/parsers/buildsystemfilesparser.h
new file mode 100644
index 00000000000..6d6fd80dd71
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/mesoninfoparser/parsers/buildsystemfilesparser.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#pragma once
+#include "../../mesonpluginconstants.h"
+#include "./common.h"
+#include "utils/fileutils.h"
+#include
+#include
+#include
+#include
+#include
+
+namespace MesonProjectManager {
+namespace Internal {
+
+class BuildSystemFilesParser
+{
+ std::vector m_files;
+ static void appendFiles(const Utils::optional &arr,
+ std::vector &dest)
+ {
+ if (arr)
+ std::transform(std::cbegin(*arr),
+ std::cend(*arr),
+ std::back_inserter(dest),
+ [](const auto &file) {
+ return Utils::FilePath::fromString(file.toString());
+ });
+ }
+
+public:
+ BuildSystemFilesParser(const QString &buildDir)
+ {
+ auto arr = load(QString("%1/%2/%3")
+ .arg(buildDir)
+ .arg(Constants::MESON_INFO_DIR)
+ .arg(Constants::MESON_INTRO_BUILDSYSTEM_FILES));
+ appendFiles(arr, m_files);
+ }
+
+ BuildSystemFilesParser(const QJsonDocument &js)
+ {
+ auto arr = get(js.object(), "projectinfo", "buildsystem_files");
+ appendFiles(arr, m_files);
+ auto subprojects = get(js.object(), "projectinfo", "subprojects");
+ std::for_each(std::cbegin(*subprojects),
+ std::cend(*subprojects),
+ [this](const auto &subproject) {
+ auto arr = get(subproject.toObject(), "buildsystem_files");
+ appendFiles(arr, m_files);
+ });
+ }
+
+ std::vector files() { return m_files; };
+};
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/mesoninfoparser/parsers/common.h b/src/plugins/mesonprojectmanager/mesoninfoparser/parsers/common.h
new file mode 100644
index 00000000000..a5113a7700f
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/mesoninfoparser/parsers/common.h
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#pragma once
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace MesonProjectManager {
+namespace Internal {
+
+template
+inline T load(QJsonDocument &&doc);
+
+template<>
+inline QJsonArray load(QJsonDocument &&doc)
+{
+ return doc.array();
+}
+
+template<>
+inline QJsonObject load(QJsonDocument &&doc)
+{
+ return doc.object();
+}
+
+template
+inline T load(const QJsonValueRef &ref);
+
+template<>
+inline QJsonArray load(const QJsonValueRef &ref)
+{
+ return ref.toArray();
+}
+
+template<>
+inline QJsonObject load(const QJsonValueRef &ref)
+{
+ return ref.toObject();
+}
+
+template
+inline Utils::optional load(const QString &jsonFile)
+{
+ QFile js(jsonFile);
+ js.open(QIODevice::ReadOnly | QIODevice::Text);
+ if (js.isOpen()) {
+ auto data = js.readAll();
+ return load(QJsonDocument::fromJson(data));
+ }
+ return Utils::nullopt;
+}
+
+template
+inline Utils::optional get(const QJsonObject &obj, const QString &name);
+
+template<>
+inline Utils::optional get(const QJsonObject &obj, const QString &name)
+{
+ if (obj.contains(name)) {
+ auto child = obj[name];
+ if (child.isArray())
+ return child.toArray();
+ }
+ return Utils::nullopt;
+}
+
+template<>
+inline Utils::optional get(const QJsonObject &obj, const QString &name)
+{
+ if (obj.contains(name)) {
+ auto child = obj[name];
+ if (child.isObject())
+ return child.toObject();
+ }
+ return Utils::nullopt;
+}
+
+template
+inline Utils::optional get(const QJsonObject &obj,
+ const QString &firstPath,
+ const Strings &... path)
+{
+ if (obj.contains(firstPath))
+ return get(obj[firstPath].toObject(), path...);
+ return Utils::nullopt;
+}
+
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/mesoninfoparser/parsers/infoparser.h b/src/plugins/mesonprojectmanager/mesoninfoparser/parsers/infoparser.h
new file mode 100644
index 00000000000..883102a6e3c
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/mesoninfoparser/parsers/infoparser.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#pragma once
+#include "../../mesonpluginconstants.h"
+#include "../mesoninfo.h"
+#include "./common.h"
+#include
+#include
+#include
+#include
+#include
+
+namespace MesonProjectManager {
+namespace Internal {
+
+class InfoParser
+{
+ static inline MesonInfo load_info(const QJsonObject &obj)
+ {
+ MesonInfo info;
+ auto version = obj["meson_version"].toObject();
+ info.mesonVersion = Version{version["major"].toInt(),
+ version["minor"].toInt(),
+ version["patch"].toInt()};
+ return info;
+ }
+ MesonInfo m_info;
+
+public:
+ InfoParser(const QString &buildDir)
+ /*: AbstractParser(jsonFile(buildDir))*/
+ {
+ auto obj = load(jsonFile(buildDir));
+ if (obj)
+ m_info = load_info(*obj);
+ }
+ static inline QString jsonFile(const QString &buildDir)
+ {
+ return QString("%1/%2/%3")
+ .arg(buildDir)
+ .arg(Constants::MESON_INFO_DIR)
+ .arg(Constants::MESON_INFO);
+ }
+ MesonInfo info() { return m_info; }
+};
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/mesoninfoparser/parsers/targetparser.h b/src/plugins/mesonprojectmanager/mesoninfoparser/parsers/targetparser.h
new file mode 100644
index 00000000000..41e1c83629a
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/mesoninfoparser/parsers/targetparser.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#pragma once
+#include "../../mesonpluginconstants.h"
+#include "../target.h"
+#include "./common.h"
+#include
+#include
+#include
+#include
+#include
+
+namespace MesonProjectManager {
+namespace Internal {
+
+class TargetParser
+{
+ TargetsList m_targets;
+ static inline Target::SourceGroup extract_source(const QJsonValue &source)
+ {
+ const auto srcObj = source.toObject();
+ return {srcObj["language"].toString(),
+ srcObj["compiler"].toVariant().toStringList(),
+ srcObj["parameters"].toVariant().toStringList(),
+ srcObj["sources"].toVariant().toStringList(),
+ srcObj["generated_sources"].toVariant().toStringList()};
+ }
+
+ static inline Target::SourceGroupList extract_sources(const QJsonArray &sources)
+ {
+ Target::SourceGroupList res;
+ std::transform(std::cbegin(sources),
+ std::cend(sources),
+ std::back_inserter(res),
+ extract_source);
+ return res;
+ }
+
+ static inline Target extract_target(const QJsonValue &target)
+ {
+ auto targetObj = target.toObject();
+ Target t{targetObj["type"].toString(),
+ targetObj["name"].toString(),
+ targetObj["id"].toString(),
+ targetObj["defined_in"].toString(),
+ targetObj["filename"].toVariant().toStringList(),
+ targetObj["subproject"].toString(),
+ extract_sources(targetObj["target_sources"].toArray())};
+ return t;
+ }
+
+ static inline TargetsList load_targets(const QJsonArray &arr)
+ {
+ TargetsList targets;
+ std::transform(std::cbegin(arr),
+ std::cend(arr),
+ std::back_inserter(targets),
+ extract_target);
+ return targets;
+ }
+
+public:
+ TargetParser(const QString &buildDir)
+ {
+ auto arr = load(QString("%1/%2/%3")
+ .arg(buildDir)
+ .arg(Constants::MESON_INFO_DIR)
+ .arg(Constants::MESON_INTRO_TARGETS));
+ if (arr)
+ m_targets = load_targets(*arr);
+ }
+
+ TargetParser(const QJsonDocument &js)
+ {
+ auto obj = get(js.object(), "targets");
+ if (obj)
+ m_targets = load_targets(*obj);
+ }
+
+ inline TargetsList targetList() { return m_targets; }
+};
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/mesoninfoparser/target.h b/src/plugins/mesonprojectmanager/mesoninfoparser/target.h
new file mode 100644
index 00000000000..a0cbaaef66d
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/mesoninfoparser/target.h
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#pragma once
+#include
+#include
+#include
+#include
+
+namespace MesonProjectManager {
+namespace Internal {
+
+struct Target
+{
+ enum class Type {
+ executable,
+ run,
+ custom,
+ sharedLibrary,
+ sharedModule,
+ staticLibrary,
+ jar,
+ unknown
+ };
+ struct SourceGroup
+ {
+ const QString language;
+ const QStringList compiler;
+ const QStringList parameters;
+ const QStringList sources;
+ const QStringList generatedSources;
+ SourceGroup(QString &&language,
+ QStringList &&compiler,
+ QStringList &¶meters,
+ QStringList &&sources,
+ QStringList &&generatedSources)
+ : language{std::move(language)}
+ , compiler{std::move(compiler)}
+ , parameters{std::move(parameters)}
+ , sources{std::move(sources)}
+ , generatedSources{std::move(generatedSources)}
+ {}
+ };
+ using SourceGroupList = std::vector;
+ const Type type;
+ const QString name;
+ const QString id;
+ const QString definedIn;
+ const QStringList fileName;
+ const Utils::optional subproject;
+ const SourceGroupList sources;
+
+ static inline QString fullName(const Target &target)
+ {
+ // TODO, this is bad, might be moved in a place where src dir is known
+ if (target.fileName.first().startsWith("/")) {
+ auto fname = target.fileName.first().split('/');
+ auto definedIn = target.definedIn.split('/');
+ definedIn.pop_back();
+ int i = std::min(definedIn.length(), fname.length()) - 1;
+ for (; i >= 0 && fname[i] == definedIn[i]; --i)
+ ;
+ return fname.mid(i + 1).join("/");
+ } else {
+ return target.fileName.first();
+ }
+ }
+
+ static Type toType(const QString &typeStr)
+ {
+ if (typeStr == "executable")
+ return Type::executable;
+ if (typeStr == "static library")
+ return Type::staticLibrary;
+ if (typeStr == "shared library")
+ return Type::sharedLibrary;
+ if (typeStr == "shared module")
+ return Type::sharedModule;
+ if (typeStr == "custom")
+ return Type::custom;
+ if (typeStr == "run")
+ return Type::run;
+ if (typeStr == "jar")
+ return Type::jar;
+ return Type::unknown;
+ }
+
+ Target(const QString &type,
+ QString &&name,
+ QString &&id,
+ QString &&definedIn,
+ QStringList &&fileName,
+ QString &&subproject,
+ SourceGroupList &&sources)
+ : type{toType(type)}
+ , name{std::move(name)}
+ , id{std::move(id)}
+ , definedIn{std::move(definedIn)}
+ , fileName{std::move(fileName)}
+ , subproject{subproject.isNull() ? Utils::nullopt
+ : Utils::optional{std::move(subproject)}}
+ , sources{std::move(sources)}
+ {}
+};
+
+using TargetsList = std::vector;
+
+template
+void for_each_source_group(const TargetsList &targets, const function &f)
+{
+ for (const Target &target : targets) {
+ for (const Target::SourceGroup &group : target.sources) {
+ f(target, group);
+ }
+ }
+}
+
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/mesonpluginconstants.h b/src/plugins/mesonprojectmanager/mesonpluginconstants.h
new file mode 100644
index 00000000000..4329ae987d3
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/mesonpluginconstants.h
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+namespace MesonProjectManager {
+namespace Constants {
+
+namespace Project {
+const char MIMETYPE[] = "text/x-meson";
+const char ID[] = "MesonProjectManager.MesonProject";
+} // namespace Project
+
+namespace BuildConfiguration {
+const char BUILD_TYPE_KEY[] = "MesonProjectManager.BuildConfig.Type";
+}
+
+// Settings page
+namespace SettingsPage {
+const char GENERAL_ID[] = "A.MesonProjectManager.SettingsPage.General";
+const char TOOLS_ID[] = "Z.MesonProjectManager.SettingsPage.Tools";
+const char CATEGORY[] = "Z.Meson";
+} // namespace SettingsPage
+
+namespace ToolsSettings {
+const char FILENAME[] = "mesontools.xml";
+const char ENTRY_KEY[] = "Tool.";
+const char ENTRY_COUNT[] = "Tools.Count";
+const char TOOL_TYPE_KEY[] = "type";
+const char TOOL_TYPE_MESON[] = "meson";
+const char TOOL_TYPE_NINJA[] = "ninja";
+const char EXE_KEY[] = "exe";
+const char AUTO_DETECTED_KEY[] = "autodetected";
+const char NAME_KEY[] = "name";
+const char ID_KEY[] = "uuid";
+} // namespace ToolsSettings
+
+namespace GeneralSettings {
+const char SECTION[] = "MesonProjectManager";
+const char AUTORUN_MESON_KEY[] = "meson.autorun";
+const char VERBOSE_NINJA_KEY[] = "ninja.verbose";
+} // namespace GeneralSettings
+
+namespace Icons {
+const char MESON[] = ":/mesonproject/icons/meson_logo.png";
+const char MESON_BW[] = ":/mesonproject/icons/meson_bw_logo.png";
+} // namespace Icons
+
+const char MESON_INFO_DIR[] = "meson-info";
+const char MESON_INTRO_BENCHMARKS[] = "intro-benchmarks.json";
+const char MESON_INTRO_BUIDOPTIONS[] = "intro-buildoptions.json";
+const char MESON_INTRO_BUILDSYSTEM_FILES[] = "intro-buildsystem_files.json";
+const char MESON_INTRO_DEPENDENCIES[] = "intro-dependencies.json";
+const char MESON_INTRO_INSTALLED[] = "intro-installed.json";
+const char MESON_INTRO_PROJECTINFO[] = "intro-projectinfo.json";
+const char MESON_INTRO_TARGETS[] = "intro-targets.json";
+const char MESON_INTRO_TESTS[] = "intro-tests.json";
+const char MESON_INFO[] = "meson-info.json";
+
+const char MESON_TOOL_MANAGER[] = "MesonProjectManager.Tools";
+const char MESON_BUILD_STEP_ID[] = "MesonProjectManager.BuildStep";
+
+namespace Targets {
+const char all[] = "all";
+const char clean[] = "clean";
+const char install[] = "install";
+const char tests[] = "test";
+const char benchmark[] = "benchmark";
+const char clang_format[] = "clang-format";
+const char scan_build[] = "scan-build";
+} // namespace Targets
+const char MESON_BUILD_CONFIG_ID[] = "MesonProjectManager.BuildConfiguration";
+
+} // namespace Constants
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/mesonprojectmanager.pro b/src/plugins/mesonprojectmanager/mesonprojectmanager.pro
new file mode 100644
index 00000000000..71a7b25818b
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/mesonprojectmanager.pro
@@ -0,0 +1,102 @@
+include(../../qtcreatorplugin.pri)
+
+INCLUDEPATH += $$PWD
+
+HEADERS = \
+ exewrappers/mesontools.h \
+ exewrappers/mesonwrapper.h \
+ exewrappers/ninjawrapper.h \
+ exewrappers/toolwrapper.h \
+ kithelper/kitdata.h \
+ kithelper/kithelper.h \
+ machinefiles/machinefilemanager.h \
+ machinefiles/nativefilegenerator.h \
+ mesonactionsmanager/mesonactionsmanager.h \
+ mesoninfoparser/buildoptions.h \
+ mesoninfoparser/mesoninfo.h \
+ mesoninfoparser/mesoninfoparser.h \
+ mesoninfoparser/parsers/buildoptionsparser.h \
+ mesoninfoparser/parsers/buildsystemfilesparser.h \
+ mesoninfoparser/parsers/common.h \
+ mesoninfoparser/parsers/infoparser.h \
+ mesoninfoparser/parsers/targetparser.h \
+ mesoninfoparser/target.h \
+ project/buildoptions/optionsmodel/arrayoptionlineedit.h \
+ project/buildoptions/optionsmodel/buildoptionsmodel.h \
+ project/buildoptions/mesonbuildsettingswidget.h \
+ project/buildoptions/mesonbuildstepconfigwidget.h \
+ project/outputparsers/mesonoutputparser.h \
+ project/outputparsers/ninjaparser.h \
+ project/projecttree/mesonprojectnodes.h \
+ project/projecttree/projecttree.h \
+ project/mesonbuildconfiguration.h \
+ project/mesonbuildsystem.h \
+ project/mesonprocess.h \
+ project/mesonproject.h \
+ project/mesonprojectimporter.h \
+ project/mesonprojectparser.h \
+ project/mesonrunconfiguration.h \
+ project/ninjabuildstep.h \
+ settings/general/generalsettingspage.h \
+ settings/general/generalsettingswidget.h \
+ settings/general/settings.h \
+ settings/tools/kitaspect/mesontoolkitaspect.h \
+ settings/tools/kitaspect/ninjatoolkitaspect.h \
+ settings/tools/kitaspect/toolkitaspectwidget.h \
+ settings/tools/toolitemsettings.h \
+ settings/tools/toolsmodel.h \
+ settings/tools/toolssettingsaccessor.h \
+ settings/tools/toolssettingspage.h \
+ settings/tools/toolssettingswidget.h \
+ settings/tools/tooltreeitem.h \
+ mesonpluginconstants.h \
+ mesonprojectplugin.h \
+ versionhelper.h
+
+
+SOURCES = \
+ exewrappers/mesonwrapper.cpp \
+ exewrappers/toolwrapper.cpp \
+ exewrappers/mesontools.cpp \
+ machinefiles/machinefilemanager.cpp \
+ machinefiles/nativefilegenerator.cpp \
+ mesonactionsmanager/mesonactionsmanager.cpp \
+ project/buildoptions/optionsmodel/arrayoptionlineedit.cpp \
+ project/buildoptions/optionsmodel/buildoptionsmodel.cpp \
+ project/buildoptions/mesonbuildsettingswidget.cpp \
+ project/buildoptions/mesonbuildstepconfigwidget.cpp \
+ project/outputparsers/mesonoutputparser.cpp \
+ project/outputparsers/ninjaparser.cpp \
+ project/projecttree/mesonprojectnodes.cpp \
+ project/projecttree/projecttree.cpp \
+ project/mesonbuildconfiguration.cpp \
+ project/mesonbuildsystem.cpp \
+ project/mesonprocess.cpp \
+ project/mesonproject.cpp \
+ project/mesonprojectimporter.cpp \
+ project/mesonprojectparser.cpp \
+ project/mesonrunconfiguration.cpp \
+ project/ninjabuildstep.cpp \
+ settings/general/generalsettingspage.cpp \
+ settings/general/generalsettingswidget.cpp \
+ settings/general/settings.cpp \
+ settings/tools/kitaspect/mesontoolkitaspect.cpp \
+ settings/tools/kitaspect/ninjatoolkitaspect.cpp \
+ settings/tools/kitaspect/toolkitaspectwidget.cpp \
+ settings/tools/toolitemsettings.cpp \
+ settings/tools/toolsmodel.cpp \
+ settings/tools/toolssettingsaccessor.cpp \
+ settings/tools/toolssettingspage.cpp \
+ settings/tools/toolssettingswidget.cpp \
+ settings/tools/tooltreeitem.cpp \
+ mesonprojectplugin.cpp
+
+RESOURCES += resources.qrc
+
+FORMS += \
+ project/buildoptions/mesonbuildsettingswidget.ui \
+ project/buildoptions/mesonbuildstepconfigwidget.ui \
+ settings/general/generalsettingswidget.ui \
+ settings/tools/toolitemsettings.ui \
+ settings/tools/toolssettingswidget.ui
+
diff --git a/src/plugins/mesonprojectmanager/mesonprojectmanager.qbs b/src/plugins/mesonprojectmanager/mesonprojectmanager.qbs
new file mode 100644
index 00000000000..42b86ba0297
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/mesonprojectmanager.qbs
@@ -0,0 +1,197 @@
+import qbs.FileInfo
+
+Project {
+ name: "MesonProjectManager"
+
+ property stringList testDefines: [
+ 'MESON_SAMPLES_DIR="' + FileInfo.joinPaths(sourceDirectory, "tests", "resources") + '"',
+ ]
+
+ QtcPlugin {
+ Depends { name: "Qt.widgets" }
+ Depends { name: "Utils" }
+
+ Depends { name: "Core" }
+ Depends { name: "CppTools" }
+ Depends { name: "ProjectExplorer" }
+ Depends { name: "QtSupport" }
+ Depends { name: "app_version_header" }
+
+ pluginRecommends: [
+ "Designer"
+ ]
+
+ cpp.includePaths: "."
+
+ files: [
+ "exewrappers/mesontools.cpp",
+ "exewrappers/mesontools.h",
+ "exewrappers/mesonwrapper.cpp",
+ "exewrappers/mesonwrapper.h",
+ "exewrappers/ninjawrapper.h",
+ "exewrappers/toolwrapper.cpp",
+ "exewrappers/toolwrapper.h",
+ "kithelper/kitdata.h",
+ "kithelper/kithelper.h",
+ "machinefiles/machinefilemanager.cpp",
+ "machinefiles/machinefilemanager.h",
+ "machinefiles/nativefilegenerator.cpp",
+ "machinefiles/nativefilegenerator.h",
+ "mesonactionsmanager/mesonactionsmanager.cpp",
+ "mesonactionsmanager/mesonactionsmanager.h",
+ "mesoninfoparser/buildoptions.h",
+ "mesoninfoparser/mesoninfo.h",
+ "mesoninfoparser/mesoninfoparser.h",
+ "mesoninfoparser/parsers/buildoptionsparser.h",
+ "mesoninfoparser/parsers/buildsystemfilesparser.h",
+ "mesoninfoparser/parsers/common.h",
+ "mesoninfoparser/parsers/infoparser.h",
+ "mesoninfoparser/parsers/targetparser.h",
+ "mesoninfoparser/target.h",
+ "mesonpluginconstants.h",
+ "mesonprojectplugin.cpp",
+ "mesonprojectplugin.h",
+ "project/buildoptions/mesonbuildsettingswidget.cpp",
+ "project/buildoptions/mesonbuildsettingswidget.h",
+ "project/buildoptions/mesonbuildsettingswidget.ui",
+ "project/buildoptions/mesonbuildstepconfigwidget.cpp",
+ "project/buildoptions/mesonbuildstepconfigwidget.h",
+ "project/buildoptions/mesonbuildstepconfigwidget.ui",
+ "project/buildoptions/optionsmodel/arrayoptionlineedit.cpp",
+ "project/buildoptions/optionsmodel/arrayoptionlineedit.h",
+ "project/buildoptions/optionsmodel/buildoptionsmodel.cpp",
+ "project/buildoptions/optionsmodel/buildoptionsmodel.h",
+ "project/mesonbuildconfiguration.cpp",
+ "project/mesonbuildconfiguration.h",
+ "project/mesonbuildsystem.cpp",
+ "project/mesonbuildsystem.h",
+ "project/mesonprocess.cpp",
+ "project/mesonprocess.h",
+ "project/mesonproject.cpp",
+ "project/mesonproject.h",
+ "project/mesonprojectimporter.cpp",
+ "project/mesonprojectimporter.h",
+ "project/mesonprojectparser.cpp",
+ "project/mesonprojectparser.h",
+ "project/mesonrunconfiguration.cpp",
+ "project/mesonrunconfiguration.h",
+ "project/ninjabuildstep.cpp",
+ "project/ninjabuildstep.h",
+ "project/outputparsers/mesonoutputparser.cpp",
+ "project/outputparsers/mesonoutputparser.h",
+ "project/outputparsers/ninjaparser.cpp",
+ "project/outputparsers/ninjaparser.h",
+ "project/projecttree/mesonprojectnodes.cpp",
+ "project/projecttree/mesonprojectnodes.h",
+ "project/projecttree/projecttree.cpp",
+ "project/projecttree/projecttree.h",
+ "settings/general/generalsettingspage.cpp",
+ "settings/general/generalsettingspage.h",
+ "settings/general/generalsettingswidget.cpp",
+ "settings/general/generalsettingswidget.h",
+ "settings/general/generalsettingswidget.ui",
+ "settings/general/settings.cpp",
+ "settings/general/settings.h",
+ "settings/tools/kitaspect/mesontoolkitaspect.cpp",
+ "settings/tools/kitaspect/mesontoolkitaspect.h",
+ "settings/tools/kitaspect/ninjatoolkitaspect.cpp",
+ "settings/tools/kitaspect/ninjatoolkitaspect.h",
+ "settings/tools/kitaspect/toolkitaspectwidget.cpp",
+ "settings/tools/kitaspect/toolkitaspectwidget.h",
+ "settings/tools/toolitemsettings.cpp",
+ "settings/tools/toolitemsettings.h",
+ "settings/tools/toolitemsettings.ui",
+ "settings/tools/toolsmodel.cpp",
+ "settings/tools/toolsmodel.h",
+ "settings/tools/toolssettingsaccessor.cpp",
+ "settings/tools/toolssettingsaccessor.h",
+ "settings/tools/toolssettingspage.cpp",
+ "settings/tools/toolssettingspage.h",
+ "settings/tools/toolssettingswidget.cpp",
+ "settings/tools/toolssettingswidget.h",
+ "settings/tools/toolssettingswidget.ui",
+ "settings/tools/tooltreeitem.cpp",
+ "settings/tools/tooltreeitem.h",
+ "versionhelper.h",
+ ]
+ }
+
+ QtcAutotest {
+ name: "tst_mesonwrapper"
+ condition: project.withAutotests
+
+ Depends { name: "Core" }
+ Depends { name: "Utils" }
+
+ cpp.defines: project.testDefines
+ cpp.includePaths: "."
+
+ files: [
+ "exewrappers/mesonwrapper.cpp",
+ "exewrappers/mesonwrapper.h",
+ "exewrappers/ninjawrapper.h",
+ "exewrappers/toolwrapper.h",
+ "exewrappers/toolwrapper.cpp",
+ "exewrappers/mesontools.h",
+ "tests/testmesonwrapper.cpp",
+ ]
+ }
+
+ QtcAutotest {
+ name: "tst_mesoninfoparser"
+ condition: project.withAutotests
+
+ Depends { name: "Core" }
+ Depends { name: "Utils" }
+
+ cpp.defines: project.testDefines
+ cpp.includePaths: "."
+
+ files: [
+ "exewrappers/mesonwrapper.cpp",
+ "exewrappers/mesonwrapper.h",
+ "exewrappers/ninjawrapper.h",
+ "exewrappers/toolwrapper.h",
+ "exewrappers/toolwrapper.cpp",
+ "exewrappers/mesontools.h",
+ "mesoninfoparser/mesoninfoparser.h",
+ "tests/testmesoninfoparser.cpp",
+ ]
+ }
+
+ QtcAutotest {
+ name: "tst_ninjaparser"
+ condition: project.withAutotests
+
+ Depends { name: "Core" }
+ Depends { name: "ProjectExplorer" }
+ Depends { name: "Utils" }
+
+ cpp.includePaths: "."
+
+ files: [
+ "project/outputparsers/ninjaparser.cpp",
+ "project/outputparsers/ninjaparser.h",
+ "mesoninfoparser/mesoninfoparser.h",
+ "tests/testninjaparser.cpp",
+ ]
+ }
+
+ QtcAutotest {
+ name: "tst_mesonparser"
+ condition: project.withAutotests
+
+ Depends { name: "Core" }
+ Depends { name: "ProjectExplorer" }
+ Depends { name: "Utils" }
+
+ cpp.defines: "MESONPARSER_DISABLE_TASKS_FOR_TESTS"
+ cpp.includePaths: "."
+
+ files: [
+ "project/outputparsers/mesonoutputparser.h",
+ "project/outputparsers/mesonoutputparser.cpp",
+ "tests/testmesonparser.cpp",
+ ]
+ }
+}
diff --git a/src/plugins/mesonprojectmanager/mesonprojectmanager_dependencies.pri b/src/plugins/mesonprojectmanager/mesonprojectmanager_dependencies.pri
new file mode 100644
index 00000000000..08c8f220bb6
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/mesonprojectmanager_dependencies.pri
@@ -0,0 +1,12 @@
+QTC_PLUGIN_NAME = MesonProjectManager
+QTC_LIB_DEPENDS += \
+ extensionsystem \
+ utils
+QTC_PLUGIN_DEPENDS += \
+ coreplugin \
+ projectexplorer \
+ cpptools \
+ qtsupport
+QTC_PLUGIN_RECOMMENDS += \
+ designer
+
diff --git a/src/plugins/mesonprojectmanager/mesonprojectplugin.cpp b/src/plugins/mesonprojectmanager/mesonprojectplugin.cpp
new file mode 100644
index 00000000000..a48e2b6a8ab
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/mesonprojectplugin.cpp
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "mesonprojectplugin.h"
+#include "exewrappers/mesonwrapper.h"
+#include "machinefiles/machinefilemanager.h"
+#include "mesonactionsmanager/mesonactionsmanager.h"
+#include "project/mesonbuildconfiguration.h"
+#include "project/mesonbuildsystem.h"
+#include "project/mesonproject.h"
+#include "project/mesonrunconfiguration.h"
+#include "project/ninjabuildstep.h"
+#include "settings/general/generalsettingspage.h"
+#include "settings/tools/kitaspect/mesontoolkitaspect.h"
+#include "settings/tools/kitaspect/ninjatoolkitaspect.h"
+#include "settings/tools/toolssettingsaccessor.h"
+#include "settings/tools/toolssettingspage.h"
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+
+#include
+
+#include
+
+using namespace Core;
+using namespace ProjectExplorer;
+using namespace Utils;
+
+namespace MesonProjectManager {
+namespace Internal {
+
+class MesonProjectPluginPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ MesonProjectPluginPrivate()
+ {
+ MesonTools::setTools(m_toolsSettings.loadMesonTools(ICore::dialogParent()));
+ connect(ICore::instance(),
+ &ICore::saveSettingsRequested,
+ this,
+ &MesonProjectPluginPrivate::saveAll);
+ }
+
+ ~MesonProjectPluginPrivate() {}
+
+private:
+ GeneralSettingsPage m_generalSettingsPage;
+ ToolsSettingsPage m_toolslSettingsPage;
+ ToolsSettingsAccessor m_toolsSettings;
+ MesonToolKitAspect m_mesonKitAspect;
+ NinjaToolKitAspect m_ninjaKitAspect;
+ MesonBuildStepFactory m_buildStepFactory;
+ MesonBuildConfigurationFactory m_buildConfigurationFactory;
+ MesonRunConfigurationFactory m_runConfigurationFactory;
+ MesonActionsManager m_actions;
+ MachineFileManager m_machineFilesManager;
+ RunWorkerFactory
+ m_mesonRunWorkerFactory{RunWorkerFactory::make(),
+ {ProjectExplorer::Constants::NORMAL_RUN_MODE},
+ {m_runConfigurationFactory.id()}};
+ void saveAll()
+ {
+ m_toolsSettings.saveMesonTools(MesonTools::tools(), ICore::dialogParent());
+ m_generalSettingsPage.saveAll();
+ }
+};
+
+MesonProjectPlugin::~MesonProjectPlugin()
+{
+ delete d;
+}
+
+bool MesonProjectPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
+{
+ Q_UNUSED(errorMessage)
+
+ d = new MesonProjectPluginPrivate;
+
+ ProjectManager::registerProjectType(Constants::Project::MIMETYPE);
+ FileIconProvider::registerIconOverlayForFilename(Constants::Icons::MESON, "meson.build");
+ FileIconProvider::registerIconOverlayForFilename(Constants::Icons::MESON, "meson_options.txt");
+ return true;
+}
+
+void MesonProjectPlugin::extensionsInitialized() {}
+
+} // namespace Internal
+} // namespace MesonProjectManager
+
+#include "mesonprojectplugin.moc"
diff --git a/src/plugins/mesonprojectmanager/mesonprojectplugin.h b/src/plugins/mesonprojectmanager/mesonprojectplugin.h
new file mode 100644
index 00000000000..8cbcfa10bae
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/mesonprojectplugin.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include
+
+namespace MesonProjectManager {
+namespace Internal {
+
+class MesonProjectPlugin : public ExtensionSystem::IPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "MesonProjectManager.json")
+
+public:
+ ~MesonProjectPlugin() override;
+
+#ifdef WITH_TESTS
+private slots:
+
+#endif
+
+private:
+ bool initialize(const QStringList &arguments, QString *errorMessage) override;
+ void extensionsInitialized() override;
+
+ class MesonProjectPluginPrivate *d = nullptr;
+};
+
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/project/buildoptions/mesonbuildsettingswidget.cpp b/src/plugins/mesonprojectmanager/project/buildoptions/mesonbuildsettingswidget.cpp
new file mode 100644
index 00000000000..df91c285fab
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/project/buildoptions/mesonbuildsettingswidget.cpp
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#include
+#include
+#include
+#include
+#include
+
+#include "../mesonbuildconfiguration.h"
+#include "../mesonbuildsystem.h"
+#include "mesonbuildsettingswidget.h"
+#include "ui_mesonbuildsettingswidget.h"
+
+namespace MesonProjectManager {
+namespace Internal {
+MesonBuildSettingsWidget::MesonBuildSettingsWidget(MesonBuildConfiguration *buildCfg)
+ : ProjectExplorer::NamedWidget{tr("Meson")}
+ , ui{new Ui::MesonBuildSettingsWidget}
+ , m_progressIndicator(Utils::ProgressIndicatorSize::Large)
+{
+ ui->setupUi(this);
+ ui->container->setState(Utils::DetailsWidget::NoSummary);
+ ui->container->setWidget(ui->details);
+ ProjectExplorer::LayoutBuilder buildDirWBuilder{ui->buildDirWidget};
+ auto buildDirAspect = buildCfg->buildDirectoryAspect();
+ buildDirAspect->addToLayout(buildDirWBuilder);
+
+ ui->optionsFilterLineEdit->setFiltering(true);
+
+ ui->optionsTreeView->sortByColumn(0, Qt::AscendingOrder);
+
+ QFrame *findWrapper
+ = Core::ItemViewFind::createSearchableWrapper(ui->optionsTreeView,
+ Core::ItemViewFind::LightColored);
+ findWrapper->setFrameStyle(QFrame::StyledPanel);
+ m_progressIndicator.attachToWidget(findWrapper);
+ m_progressIndicator.raise();
+ m_progressIndicator.hide();
+ ui->details->layout()->addWidget(findWrapper);
+
+ m_showProgressTimer.setSingleShot(true);
+ m_showProgressTimer.setInterval(50); // don't show progress for < 50ms tasks
+ connect(&m_showProgressTimer, &QTimer::timeout, [this]() { m_progressIndicator.show(); });
+ connect(&m_optionsModel, &BuidOptionsModel::configurationChanged, this, [this]() {
+ ui->configureButton->setEnabled(true);
+ });
+ m_optionsFilter.setSourceModel(&m_optionsModel);
+ m_optionsFilter.setSortRole(Qt::DisplayRole);
+ m_optionsFilter.setFilterKeyColumn(-1);
+ m_optionsFilter.setFilterCaseSensitivity(Qt::CaseInsensitive);
+
+ ui->optionsTreeView->setModel(&m_optionsFilter);
+
+ ui->optionsTreeView->setItemDelegate(new BuildOptionDelegate{ui->optionsTreeView});
+ MesonBuildSystem *bs = static_cast(buildCfg->buildSystem());
+ connect(buildCfg->target(),
+ &ProjectExplorer::Target::parsingFinished,
+ this,
+ [this, bs](bool success) {
+ if (success) {
+ m_optionsModel.setConfiguration(bs->buildOptions());
+ } else {
+ m_optionsModel.clear();
+ }
+ ui->optionsTreeView->expandAll();
+ ui->optionsTreeView->resizeColumnToContents(0);
+ ui->optionsTreeView->setEnabled(true);
+ m_showProgressTimer.stop();
+ m_progressIndicator.hide();
+ });
+
+ connect(bs, &MesonBuildSystem::parsingStarted, this, [this]() {
+ if (!m_showProgressTimer.isActive()) {
+ ui->optionsTreeView->setEnabled(false);
+ m_showProgressTimer.start();
+ }
+ });
+
+ connect(&m_optionsModel, &BuidOptionsModel::dataChanged, this, [bs, this]() {
+ bs->setMesonConfigArgs(this->m_optionsModel.changesAsMesonArgs());
+ });
+
+ connect(&m_optionsFilter, &QAbstractItemModel::modelReset, this, [this]() {
+ ui->optionsTreeView->expandAll();
+ ui->optionsTreeView->resizeColumnToContents(0);
+ });
+ connect(ui->optionsFilterLineEdit,
+ &QLineEdit::textChanged,
+ &m_optionsFilter,
+ &QSortFilterProxyModel::setFilterFixedString);
+ connect(ui->optionsTreeView,
+ &Utils::TreeView::activated,
+ ui->optionsTreeView,
+ [tree = ui->optionsTreeView](const QModelIndex &idx) { tree->edit(idx); });
+ connect(ui->configureButton, &QPushButton::clicked, [bs, this]() {
+ ui->optionsTreeView->setEnabled(false);
+ ui->configureButton->setEnabled(false);
+ m_showProgressTimer.start();
+ bs->configure();
+ });
+ connect(ui->wipeButton, &QPushButton::clicked, [bs, this]() {
+ ui->optionsTreeView->setEnabled(false);
+ ui->configureButton->setEnabled(false);
+ m_showProgressTimer.start();
+ bs->wipe();
+ });
+ bs->triggerParsing();
+}
+
+MesonBuildSettingsWidget::~MesonBuildSettingsWidget()
+{
+ delete ui;
+}
+
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/project/buildoptions/mesonbuildsettingswidget.h b/src/plugins/mesonprojectmanager/project/buildoptions/mesonbuildsettingswidget.h
new file mode 100644
index 00000000000..d3b9ab51185
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/project/buildoptions/mesonbuildsettingswidget.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 Alexis Jeandet.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+#pragma once
+#include "optionsmodel/buildoptionsmodel.h"
+
+#include
+#include
+#include
+
+#include
+#include
+
+namespace Ui {
+class MesonBuildSettingsWidget;
+}
+
+namespace MesonProjectManager {
+namespace Internal {
+class MesonBuildConfiguration;
+class MesonBuildSettingsWidget : public ProjectExplorer::NamedWidget
+{
+ Q_OBJECT
+
+public:
+ explicit MesonBuildSettingsWidget(MesonBuildConfiguration *buildCfg);
+ ~MesonBuildSettingsWidget();
+
+private:
+ Ui::MesonBuildSettingsWidget *ui;
+ BuidOptionsModel m_optionsModel;
+ Utils::CategorySortFilterModel m_optionsFilter;
+ Utils::ProgressIndicator m_progressIndicator;
+ QTimer m_showProgressTimer;
+};
+
+} // namespace Internal
+} // namespace MesonProjectManager
diff --git a/src/plugins/mesonprojectmanager/project/buildoptions/mesonbuildsettingswidget.ui b/src/plugins/mesonprojectmanager/project/buildoptions/mesonbuildsettingswidget.ui
new file mode 100644
index 00000000000..69671323e17
--- /dev/null
+++ b/src/plugins/mesonprojectmanager/project/buildoptions/mesonbuildsettingswidget.ui
@@ -0,0 +1,147 @@
+
+
+ MesonBuildSettingsWidget
+
+
+