The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
5.5KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. You may use this code under the terms of the GPL v3
  6. (see www.gnu.org/licenses).
  7. For this technical preview, this file is not subject to commercial licensing.
  8. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  9. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  10. DISCLAIMED.
  11. ==============================================================================
  12. */
  13. #pragma once
  14. //==============================================================================
  15. class CompileEngineSettings
  16. {
  17. public:
  18. CompileEngineSettings (ValueTree& projectRoot)
  19. : tree (projectRoot.getOrCreateChildWithName ("LIVE_SETTINGS", nullptr)
  20. .getOrCreateChildWithName (getLiveSettingsSubType(), nullptr)),
  21. buildEnabledValue (tree, Ids::buildEnabled, nullptr, false),
  22. continuousRebuildEnabledValue (tree, Ids::continuousRebuildEnabled, nullptr, false),
  23. warningsEnabledValue (tree, Ids::warningsEnabled, nullptr, true),
  24. userHeaderPathValue (tree, Ids::headerPath, nullptr),
  25. systemHeaderPathValue (tree, Ids::systemHeaderPath, nullptr),
  26. extraDLLsValue (tree, Ids::extraDLLs, nullptr),
  27. extraCompilerFlagsValue (tree, Ids::extraCompilerFlags, nullptr),
  28. extraPreprocessorDefsValue (tree, Ids::defines, nullptr),
  29. windowsTargetPlatformValue (tree, Ids::windowsTargetPlatformVersion, nullptr, "10.0.16299.0")
  30. {
  31. }
  32. //==============================================================================
  33. void setBuildEnabled (bool enabled) noexcept { buildEnabledValue = enabled; }
  34. void setContinuousRebuildEnabled (bool enabled) noexcept { continuousRebuildEnabledValue = enabled; }
  35. void setWarningsEnabled (bool enabled) { warningsEnabledValue = enabled; }
  36. bool isBuildEnabled() const noexcept { return buildEnabledValue.get(); }
  37. bool isContinuousRebuildEnabled() const noexcept { return continuousRebuildEnabledValue.get(); }
  38. bool areWarningsEnabled() const noexcept { return warningsEnabledValue.get(); }
  39. String getUserHeaderPathString() const noexcept { return userHeaderPathValue.get(); }
  40. String getSystemHeaderPathString() const noexcept { return systemHeaderPathValue.get(); }
  41. String getExtraDLLsString() const noexcept { return extraDLLsValue.get(); }
  42. String getExtraCompilerFlagsString() const noexcept { return extraCompilerFlagsValue.get(); }
  43. String getExtraPreprocessorDefsString() const noexcept { return extraPreprocessorDefsValue.get(); }
  44. String getWindowsTargetPlatformVersionString() const noexcept { return windowsTargetPlatformValue.get(); }
  45. //==============================================================================
  46. void getLiveSettings (PropertyListBuilder& props)
  47. {
  48. props.addSearchPathProperty (userHeaderPathValue, "User Header Paths", "User header search paths.");
  49. props.addSearchPathProperty (systemHeaderPathValue, "System Header Paths", "System header search paths.");
  50. props.add (new TextPropertyComponent (extraPreprocessorDefsValue, "Preprocessor Definitions", 32768, true),
  51. "Extra preprocessor definitions. Use the form \"NAME1=value NAME2=value\", using whitespace or commas "
  52. "to separate the items - to include a space or comma in a definition, precede it with a backslash.");
  53. props.add (new TextPropertyComponent (extraCompilerFlagsValue, "Extra Compiler Flags", 2048, true),
  54. "Extra command-line flags to be passed to the compiler. This string can contain references to preprocessor"
  55. " definitions in the form ${NAME_OF_DEFINITION}, which will be replaced with their values.");
  56. props.add (new TextPropertyComponent (extraDLLsValue, "Extra Dynamic Libraries", 2048, true),
  57. "Extra dynamic libs that the running code may require. Use new-lines or commas to separate the items.");
  58. props.add (new TextPropertyComponent (windowsTargetPlatformValue, "Windows Target Platform", 256, false),
  59. "The Windows target platform to use.");
  60. }
  61. private:
  62. ValueTree tree;
  63. ValueWithDefault buildEnabledValue, continuousRebuildEnabledValue, warningsEnabledValue, userHeaderPathValue, systemHeaderPathValue,
  64. extraDLLsValue, extraCompilerFlagsValue, extraPreprocessorDefsValue, windowsTargetPlatformValue;
  65. //==============================================================================
  66. String getLiveSettingsSubType() const noexcept
  67. {
  68. #if JUCE_MAC
  69. return "OSX";
  70. #elif JUCE_WINDOWS
  71. return "WINDOWS";
  72. #elif JUCE_LINUX
  73. return "LINUX";
  74. #else
  75. // unknown platform?!
  76. jassertfalse;
  77. return {};
  78. #endif
  79. }
  80. //==============================================================================
  81. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (CompileEngineSettings)
  82. };