mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
CMake: Add support for building JUCE projects with CMake
This commit is contained in:
parent
1fdba480cc
commit
ece5644a20
149 changed files with 9921 additions and 3693 deletions
90
extras/Build/juceaide/CMakeLists.txt
Normal file
90
extras/Build/juceaide/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
# ==============================================================================
|
||||
#
|
||||
# This file is part of the JUCE 6 technical preview.
|
||||
# Copyright (c) 2020 - ROLI Ltd.
|
||||
#
|
||||
# You may use this code under the terms of the GPL v3
|
||||
# (see www.gnu.org/licenses).
|
||||
#
|
||||
# For this technical preview, this file is not subject to commercial licensing.
|
||||
#
|
||||
# JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
|
||||
# EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
|
||||
# DISCLAIMED.
|
||||
#
|
||||
# ==============================================================================
|
||||
|
||||
# The juceaide program generates intermediate build files including BinaryData sources, icons, and
|
||||
# plists. To ensure that we always build it for the host system, and not for, say, a device or
|
||||
# simulator if we're targeting iOS or Android, we reinvoke cmake here and build juceaide during the
|
||||
# configuration stage of the outer project.
|
||||
|
||||
if(JUCE_BUILD_HELPER_TOOLS)
|
||||
# Build the tool for the current system
|
||||
juce_add_console_app(juceaide)
|
||||
|
||||
target_sources(juceaide PRIVATE Main.cpp)
|
||||
|
||||
target_compile_definitions(juceaide PRIVATE
|
||||
JUCE_DISABLE_JUCE_VERSION_PRINTING=1
|
||||
JUCE_USE_CURL=0)
|
||||
|
||||
target_link_libraries(juceaide PRIVATE juce::juce_build_tools)
|
||||
|
||||
export(TARGETS juceaide
|
||||
NAMESPACE juce_tools::
|
||||
FILE "${JUCE_BINARY_DIR}/JUCEToolsExport.cmake")
|
||||
else()
|
||||
# If we're building using the NDK, the gradle wrapper will try to inject its own compiler using
|
||||
# environment variables, which is unfortunate because we really don't want to cross-compile
|
||||
# juceaide. If you really want to set the compilers for juceaide, pass the appropriate
|
||||
# CMAKE_<lang>_COMPILER flags when configuring CMake.
|
||||
unset(ENV{ASM})
|
||||
unset(ENV{CC})
|
||||
unset(ENV{CXX})
|
||||
|
||||
# Looks like we're boostrapping, reinvoke CMake
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}"
|
||||
"-B${JUCE_BINARY_DIR}/tools"
|
||||
"-G${CMAKE_GENERATOR}"
|
||||
"-DCMAKE_BUILD_TYPE=Debug"
|
||||
"-DJUCE_BUILD_HELPER_TOOLS=ON"
|
||||
"-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}"
|
||||
WORKING_DIRECTORY "${JUCE_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE command_output
|
||||
ERROR_VARIABLE command_output
|
||||
RESULT_VARIABLE result_variable)
|
||||
|
||||
if(result_variable)
|
||||
message(FATAL_ERROR "Failed to configure tools\n${command_output}")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}"
|
||||
--build "${JUCE_BINARY_DIR}/tools"
|
||||
--config Debug
|
||||
OUTPUT_VARIABLE command_output
|
||||
ERROR_VARIABLE command_output
|
||||
RESULT_VARIABLE result_variable)
|
||||
|
||||
if(result_variable)
|
||||
message(FATAL_ERROR "Failed to build tools\n${command_output}")
|
||||
endif()
|
||||
|
||||
# This will be generated by the recursive invocation of CMake (above)
|
||||
include("${JUCE_BINARY_DIR}/tools/JUCEToolsExport.cmake")
|
||||
|
||||
add_executable(juceaide IMPORTED GLOBAL)
|
||||
get_target_property(imported_location juce_tools::juceaide IMPORTED_LOCATION_DEBUG)
|
||||
set_target_properties(juceaide PROPERTIES IMPORTED_LOCATION "${imported_location}")
|
||||
|
||||
add_executable(juce::juceaide ALIAS juceaide)
|
||||
|
||||
set(JUCE_TOOL_INSTALL_DIR "bin" CACHE STRING
|
||||
"The location, relative to the install prefix, where juceaide will be installed")
|
||||
|
||||
install(PROGRAMS "${imported_location}" DESTINATION "${JUCE_TOOL_INSTALL_DIR}")
|
||||
|
||||
get_filename_component(binary_name "${imported_location}" NAME)
|
||||
set(JUCE_CMAKE_BINARY_BUILDER_NAME "${JUCE_TOOL_INSTALL_DIR}/${binary_name}"
|
||||
CACHE INTERNAL "The name of the juceaide program")
|
||||
endif()
|
||||
Loading…
Add table
Add a link
Reference in a new issue