-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
CMakeLists.txt
89 lines (73 loc) · 3.48 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# ==============================================================================
#
# 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_JUCEAIDE_NAME "${binary_name}" CACHE INTERNAL "The name of the juceaide program")
endif()