forked from SynoCommunity/spksrc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspksrc.native-cmake.mk
88 lines (71 loc) · 2.08 KB
/
spksrc.native-cmake.mk
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
# Build CMake programs
#
# prerequisites:
# - cross/module depends on cmake
#
# Common makefiles
include ../../mk/spksrc.common.mk
include ../../mk/spksrc.directories.mk
# Force build in native tool directrory, not cross directory.
WORK_DIR := $(PWD)/work-native
# Package dependend
URLS = $(PKG_DIST_SITE)/$(PKG_DIST_NAME)
NAME = $(PKG_NAME)
COOKIE_PREFIX = $(PKG_NAME)-
ifneq ($(PKG_DIST_FILE),)
LOCAL_FILE = $(PKG_DIST_FILE)
else
LOCAL_FILE = $(PKG_DIST_NAME)
endif
DIST_FILE = $(DISTRIB_DIR)/$(LOCAL_FILE)
DIST_EXT = $(PKG_EXT)
#####
include ../../mk/spksrc.native-env.mk
# cmake specific configurations
include ../../mk/spksrc.native-cmake-env.mk
# configure using cmake
ifeq ($(strip $(CONFIGURE_TARGET)),)
CONFIGURE_TARGET = cmake_configure_target
endif
ifneq ($(strip $(CMAKE_USE_NINJA)),1)
# compile
ifeq ($(strip $(COMPILE_TARGET)),)
COMPILE_TARGET = cmake_compile_target
endif
# install
ifeq ($(strip $(INSTALL_TARGET)),)
INSTALL_TARGET = cmake_install_target
endif
endif
.PHONY: cmake_configure_target
# default cmake configure:
cmake_configure_target:
@$(MSG) - CMake configure
@$(MSG) - Dependencies = $(DEPENDS)
@$(MSG) - Use NASM = $(CMAKE_USE_NASM)
@$(MSG) - Use DESTDIR = $(CMAKE_USE_DESTDIR)
@$(MSG) - Path DESTDIR = $(CMAKE_DESTDIR)
@$(MSG) - Path BUILD_DIR = $(CMAKE_BUILD_DIR)
$(RUN) rm -rf CMakeCache.txt CMakeFiles
$(RUN) mkdir --parents $(CMAKE_BUILD_DIR)
cd $(CMAKE_BUILD_DIR) && env $(ENV) cmake $(CMAKE_ARGS) $(WORK_DIR)/$(PKG_DIR)
.PHONY: cmake_compile_target
ifeq ($(strip $(CMAKE_USE_NINJA)),1)
include ../../mk/spksrc.cross-ninja.mk
else
# default compile:
cmake_compile_target:
@$(MSG) - CMake compile
env $(ENV) $(PSTAT_TIME) cmake --build $(CMAKE_BUILD_DIR) -j $(NCPUS)
.PHONY: cmake_install_target
# default install:
cmake_install_target:
@$(MSG) - CMake install
ifeq ($(strip $(CMAKE_USE_DESTDIR)),0)
cd $(CMAKE_BUILD_DIR) && env $(ENV) $(MAKE) install
else
cd $(CMAKE_BUILD_DIR) && env $(ENV) $(MAKE) install DESTDIR=$(CMAKE_DESTDIR)
endif
endif
# call-up regular build process
include ../../mk/spksrc.native-cc.mk