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.

110 lines
5.8KB

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