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.

108 lines
4.1KB

  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. export(TARGETS juceaide
  40. NAMESPACE juce_tools::
  41. FILE "${JUCE_BINARY_DIR}/JUCEToolsExport.cmake")
  42. else()
  43. # If we're building using the NDK, the gradle wrapper will try to inject its own compiler using
  44. # environment variables, which is unfortunate because we really don't want to cross-compile
  45. # juceaide. If you really want to set the compilers for juceaide, pass the appropriate
  46. # CMAKE_<lang>_COMPILER flags when configuring CMake.
  47. unset(ENV{ASM})
  48. unset(ENV{CC})
  49. unset(ENV{CXX})
  50. message(STATUS "Configuring juceaide")
  51. # Looks like we're boostrapping, reinvoke CMake
  52. execute_process(COMMAND "${CMAKE_COMMAND}"
  53. "."
  54. "-B${JUCE_BINARY_DIR}/tools"
  55. "-G${CMAKE_GENERATOR}"
  56. "-DCMAKE_BUILD_TYPE=Debug"
  57. "-DJUCE_BUILD_HELPER_TOOLS=ON"
  58. "-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}"
  59. WORKING_DIRECTORY "${JUCE_SOURCE_DIR}"
  60. OUTPUT_VARIABLE command_output
  61. ERROR_VARIABLE command_output
  62. RESULT_VARIABLE result_variable)
  63. if(result_variable)
  64. message(FATAL_ERROR "Failed to configure juceaide\n${command_output}")
  65. endif()
  66. message(STATUS "Building juceaide")
  67. execute_process(COMMAND "${CMAKE_COMMAND}"
  68. --build "${JUCE_BINARY_DIR}/tools"
  69. --config Debug
  70. OUTPUT_VARIABLE command_output
  71. ERROR_VARIABLE command_output
  72. RESULT_VARIABLE result_variable)
  73. if(result_variable)
  74. message(FATAL_ERROR "Failed to build juceaide\n${command_output}")
  75. endif()
  76. message(STATUS "Exporting juceaide")
  77. # This will be generated by the recursive invocation of CMake (above)
  78. include("${JUCE_BINARY_DIR}/tools/JUCEToolsExport.cmake")
  79. add_executable(juceaide IMPORTED GLOBAL)
  80. get_target_property(imported_location juce_tools::juceaide IMPORTED_LOCATION_DEBUG)
  81. set_target_properties(juceaide PROPERTIES IMPORTED_LOCATION "${imported_location}")
  82. add_executable(juce::juceaide ALIAS juceaide)
  83. set(JUCE_TOOL_INSTALL_DIR "bin/JUCE-${JUCE_VERSION}" CACHE STRING
  84. "The location, relative to the install prefix, where juceaide will be installed")
  85. install(PROGRAMS "${imported_location}" DESTINATION "${JUCE_TOOL_INSTALL_DIR}")
  86. get_filename_component(binary_name "${imported_location}" NAME)
  87. set(JUCE_JUCEAIDE_NAME "${binary_name}" CACHE INTERNAL "The name of the juceaide program")
  88. endif()