-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.cmake-common
139 lines (112 loc) · 4.45 KB
/
Makefile.cmake-common
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# ------------------------------------------------------------------------
# This file is supposed to be included from the main project Makefile.
# ------------------------------------------------------------------------
# Beginning of user configuration -------------------------------
# General build configuration -----------------------------------
## Specify path to overriden jucer file.
APP_CUSTOM_JUCER=$(shell pwd)/apps/override.$(APP_NAME).jucer
## Specify path to aap-juce. The default is the submodule path.
ifeq ('$(AAP_JUCE_DIR)', '')
AAP_JUCE_DIR=$(shell pwd)/external/aap-juce
endif
# For metadata updates, relative to build-desktop
ifeq ('$(APP_SHARED_CODE_LIBS)', '')
APP_SHARED_CODE_LIBS="$(APP_NAME)_artefacts/lib$(APP_NAME)_SharedCode.a"
endif
## Specify path to juce. The default is the submodule path.
ifeq ('$(JUCE_DIR)', '')
JUCE_DIR=$(shell pwd)/external/JUCE
endif
## Specify path to aap core. The default is the submodule path.
AAP_DIR=$(shell pwd)/external/aap-core
## If the build output is going to be too huge to keep, use this flag to delete.
MINIMIZE_INTERMEDIATES=0
## Specify arbitrary NDK version. No guarantee on that your version works.
NDK_VERSION=21.4.7075529
## Specify whatever gradle task you want to run.
GRADLE_TASK=$(shell printf '%b' "build bundle")
## dist directory to collect build artifacts
DIST_DIR=$(shell pwd)/dist
# End of user configuration. ------------------------------------
THISFILE=$(abspath $(lastword $(MAKEFILE_LIST)))
THISDIR=$(dir $(THISFILE))
ifeq ('$(ANDROID_SDK_ROOT)', '')
ANDROID_SDK_ROOT=~/Android/Sdk
endif
# for CMake, it is the same as $(APP_BUILD_DIR)
ANDROID_DIR=$(APP_BUILD_DIR)
all: build
build: $(PRE_BUILD_TASKS) patch-juce-cmake patch-app-cmake build-aap-core build-app-cmake
patch-juce-cmake: $(JUCE_DIR)/.stamp-juce
$(JUCE_DIR)/.stamp-juce:
echo "JUCE patches: $(JUCE_PATCHES)"
for patch in $(JUCE_PATCHES) ; do \
echo "JUCE patch: $${patch}" ; \
if [ '$${patch}' != '' ] ; then \
cd $(JUCE_DIR) && patch -i $${patch} -p $(JUCE_PATCH_DEPTH) -l ; \
fi ; \
done
echo "For CMake build we need another standard patch..."
if [ "$(AAP_JUCE_CMAKE_SKIP_DEFAULT_PATCHES)" == "" ] ; then \
if [ "$(AAP_JUCE_CMAKE_PATCH_HOSTING)" != "" ] ; then \
cd $(JUCE_DIR) && patch -i $(AAP_JUCE_DIR)/JUCE-support-Android-CMake-hosting.patch -p1 -l ; \
else \
cd $(JUCE_DIR) && patch -i $(AAP_JUCE_DIR)/JUCE-support-Android-CMake.patch -p1 -l ; \
fi ; \
fi
touch $(JUCE_DIR)/.stamp-juce
patch-app-cmake: $(APP_SRC_DIR)/.stamp-app
$(APP_SRC_DIR)/.stamp-app:
if [ $(PATCH_FILE) ] ; then \
cd $(APP_SRC_DIR) && patch -i $(PATCH_FILE) -p$(PATCH_DEPTH) -l ; \
touch $(APP_SRC_DIR)/.stamp-app ; \
fi
build-aap-core:
if [ ! -f $(AAP_DIR)/local.properties ] ; then \
if [ "`uname`" == "Darwin" ] ; then \
echo "sdk.dir=$(HOME)/Library/Android/sdk" > $(AAP_DIR)/local.properties ; \
else \
echo "sdk.dir=$(HOME)/Android/Sdk" > $(AAP_DIR)/local.properties ; \
fi ; \
fi
cd $(AAP_DIR) && ./gradlew publishToMavenLocal
build-app-cmake:
if [ ! -f local.properties ] ; then \
if [ "`uname`" == "Darwin" ] ; then \
echo "sdk.dir=$(HOME)/Library/Android/sdk" > local.properties ; \
else \
echo "sdk.dir=$(HOME)/Android/Sdk" > local.properties ; \
fi ; \
fi
if [ -f '$(APP_ICON)' ] ; then \
mkdir -p $(ANDROID_DIR)/app/src/main/res/drawable ; \
cp $(APP_ICON) $(ANDROID_DIR)/app/src/main/res/drawable/ic_launcher.png ; \
fi
./gradlew $(GRADLE_TASK)
if [ $(MINIMIZE_INTERMEDIATES) ] ; then \
rm -rf $(ANDROID_DIR)/app/build/intermediates/ ; \
rm -rf $(ANDROID_DIR)/app/.cxx ; \
fi
.PHONY:
dist:
mkdir -p $(DIST_DIR)
cp $(APP_BUILD_DIR)/app/build/outputs/apk/debug/*.apk $(DIST_DIR)/$(APP_NAME)-debug.apk
cp $(APP_BUILD_DIR)/app/build/outputs/bundle/release/*.aab $(DIST_DIR)/$(APP_NAME)-release.aab
# Independent Tasks that have to be performed manually
.PHONY:
update-aap-metadata-cmake:
mkdir -p $(APP_SRC_DIR)/build-desktop
cd $(APP_SRC_DIR)/build-desktop && \
cmake -DAAP_DIR="$(AAP_DIR)" -DAAP_JUCE_DIR="$(AAP_JUCE_DIR)" $(METADATA_GENERATOR_CMAKE_EXTRA_FLAGS) .. && \
make && cd $(CURDIR)
cd $(APP_SRC_DIR)/build-desktop && \
APPNAME=$(APP_NAME) \
EXTRA_OUTDIR=$(CURDIR) \
LIBRARY=lib$(APP_NAME)_Standalone.so \
ENTRYPOINT=GetJuceAAPFactoryStandalone \
LIBFILES=$(APP_SHARED_CODE_LIBS) \
EXTRA_LDFLAGS=$(METADATA_GENERATOR_EXTRA_LDFLAGS) \
BUILDS_DIR=$(BUILDS_DIR) \
PLAT_BUILD_DIR=$(PLAT_BUILD_DIR) \
PLAT_COMPILER=$(PLAT_COMPILER) \
$(AAP_JUCE_DIR)/generate-metadata.sh