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.

111 lines
5.8KB

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