-
Notifications
You must be signed in to change notification settings - Fork 3
/
tempCMakefile
46 lines (35 loc) · 1.27 KB
/
tempCMakefile
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
RACK_DIR ?= ../Rack-SDK
include $(RACK_DIR)/arch.mk
EXTRA_CMAKE :=
RACK_PLUGIN_NAME := plugin
RACK_PLUGIN_ARCH :=
RACK_PLUGIN_EXT := so
ifdef ARCH_WIN
RACK_PLUGIN_EXT := dll
endif
ifdef ARCH_MAC
EXTRA_CMAKE := -DCMAKE_OSX_ARCHITECTURES="x86_64"
RACK_PLUGIN_EXT := dylib
ifdef ARCH_ARM64
EXTRA_CMAKE := -DCMAKE_OSX_ARCHITECTURES="arm64"
RACK_PLUGIN_ARCH := -arm64
endif
endif
RACK_PLUGIN := $(RACK_PLUGIN_NAME)$(RACK_PLUGIN_ARCH).$(RACK_PLUGIN_EXT)
CMAKE_BUILD ?= dep/cmake-build
cmake_rack_plugin := $(CMAKE_BUILD)/$(RACK_PLUGIN)
# create empty plugin lib to skip the make target execution
$(shell touch $(RACK_PLUGIN))
$(info cmake_rack_plugin target is '$(cmake_rack_plugin)')
# trigger CMake build when running `make dep`
DEPS += $(cmake_rack_plugin)
$(cmake_rack_plugin): CMakeLists.txt
$(CMAKE) -B $(CMAKE_BUILD) -DRACK_SDK_DIR=$(RACK_DIR) -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(CMAKE_BUILD)/dist $(EXTRA_CMAKE)
cmake --build $(CMAKE_BUILD) -- -j $(shell getconf _NPROCESSORS_ONLN)
cmake --install $(CMAKE_BUILD)
rack_plugin: $(cmake_rack_plugin)
cp -vf $(cmake_rack_plugin) .
# Add files to the ZIP package when running `make dist`
dist: rack_plugin res
DISTRIBUTABLES += $(wildcard LICENSE*) res README.md CHANGELOG.md
include $(RACK_DIR)/plugin.mk