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
4.2KB

  1. # ==============================================================================
  2. #
  3. # This file is part of the JUCE library.
  4. # Copyright (c) 2020 - Raw Material Software Limited
  5. #
  6. # JUCE is an open source library subject to commercial or open-source
  7. # licensing.
  8. #
  9. # By using JUCE, you agree to the terms of both the JUCE 6 End-User License
  10. # Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
  11. #
  12. # End User License Agreement: www.juce.com/juce-6-licence
  13. # Privacy Policy: www.juce.com/juce-privacy-policy
  14. #
  15. # Or: You may also use this code under the terms of the GPL v3 (see
  16. # www.gnu.org/licenses).
  17. #
  18. # JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  19. # EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  20. # DISCLAIMED.
  21. #
  22. # ==============================================================================
  23. # The juceaide program generates intermediate build files including BinaryData sources, icons, and
  24. # plists. To ensure that we always build it for the host system, and not for, say, a device or
  25. # simulator if we're targeting iOS or Android, we reinvoke cmake here and build juceaide during the
  26. # configuration stage of the outer project.
  27. if(JUCE_BUILD_HELPER_TOOLS)
  28. # Build the tool for the current system
  29. juce_add_console_app(juceaide)
  30. target_sources(juceaide PRIVATE Main.cpp)
  31. target_compile_definitions(juceaide PRIVATE
  32. JUCE_DISABLE_JUCE_VERSION_PRINTING=1
  33. JUCE_USE_CURL=0)
  34. target_link_libraries(juceaide PRIVATE
  35. juce::juce_build_tools
  36. juce::juce_recommended_config_flags
  37. juce::juce_recommended_lto_flags
  38. juce::juce_recommended_warning_flags)
  39. set_target_properties(juceaide PROPERTIES
  40. MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
  41. export(TARGETS juceaide
  42. NAMESPACE juce_tools::
  43. FILE "${JUCE_BINARY_DIR}/JUCEToolsExport.cmake")
  44. else()
  45. # If we're building using the NDK, the gradle wrapper will try to inject its own compiler using
  46. # environment variables, which is unfortunate because we really don't want to cross-compile
  47. # juceaide. If you really want to set the compilers for juceaide, pass the appropriate
  48. # CMAKE_<lang>_COMPILER flags when configuring CMake.
  49. unset(ENV{ASM})
  50. unset(ENV{CC})
  51. unset(ENV{CXX})
  52. message(STATUS "Configuring juceaide")
  53. # Looks like we're boostrapping, reinvoke CMake
  54. execute_process(COMMAND "${CMAKE_COMMAND}"
  55. "."
  56. "-B${JUCE_BINARY_DIR}/tools"
  57. "-G${CMAKE_GENERATOR}"
  58. "-DCMAKE_BUILD_TYPE=Debug"
  59. "-DJUCE_BUILD_HELPER_TOOLS=ON"
  60. "-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}"
  61. WORKING_DIRECTORY "${JUCE_SOURCE_DIR}"
  62. OUTPUT_VARIABLE command_output
  63. ERROR_VARIABLE command_output
  64. RESULT_VARIABLE result_variable)
  65. if(result_variable)
  66. message(FATAL_ERROR "Failed to configure juceaide\n${command_output}")
  67. endif()
  68. message(STATUS "Building juceaide")
  69. execute_process(COMMAND "${CMAKE_COMMAND}"
  70. --build "${JUCE_BINARY_DIR}/tools"
  71. --config Debug
  72. OUTPUT_VARIABLE command_output
  73. ERROR_VARIABLE command_output
  74. RESULT_VARIABLE result_variable)
  75. if(result_variable)
  76. message(FATAL_ERROR "Failed to build juceaide\n${command_output}")
  77. endif()
  78. message(STATUS "Exporting juceaide")
  79. # This will be generated by the recursive invocation of CMake (above)
  80. include("${JUCE_BINARY_DIR}/tools/JUCEToolsExport.cmake")
  81. add_executable(juceaide IMPORTED GLOBAL)
  82. get_target_property(imported_location juce_tools::juceaide IMPORTED_LOCATION_DEBUG)
  83. set_target_properties(juceaide PROPERTIES IMPORTED_LOCATION "${imported_location}")
  84. add_executable(juce::juceaide ALIAS juceaide)
  85. set(JUCE_TOOL_INSTALL_DIR "bin/JUCE-${JUCE_VERSION}" CACHE STRING
  86. "The location, relative to the install prefix, where juceaide will be installed")
  87. install(PROGRAMS "${imported_location}" DESTINATION "${JUCE_TOOL_INSTALL_DIR}")
  88. get_filename_component(binary_name "${imported_location}" NAME)
  89. set(JUCE_JUCEAIDE_NAME "${binary_name}" CACHE INTERNAL "The name of the juceaide program")
  90. endif()