package/base-files: move /etc/functions.sh to /lib/functions.sh
[openwrt.git] / include / cmake.mk
1 PKG_INSTALL:=1
2
3 MAKE_FLAGS+=VERBOSE=1
4
5 ifeq ($(CONFIG_CCACHE),)
6 ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
7 CMAKE_C_COMPILER:=$(TOOLCHAIN_DIR)/bin/$(TARGET_CC)
8 CMAKE_C_COMPILER_ARG1:=
9 CMAKE_CXX_COMPILER:=$(TOOLCHAIN_DIR)/bin/$(TARGET_CXX)
10 CMAKE_CXX_COMPILER_ARG1:=
11 else
12 CMAKE_C_COMPILER:=$(shell which $(TARGET_CC))
13 CMAKE_C_COMPILER_ARG1:=
14 CMAKE_CXX_COMPILER:=$(shell which $(TARGET_CXX))
15 CMAKE_CXX_COMPILER_ARG1:=
16 endif
17 else
18 CCACHE:=$(shell which ccache)
19 ifeq ($(CCACHE),)
20 CCACHE:=$(STAGING_DIR_HOST)/bin/ccache
21 endif
22 CMAKE_C_COMPILER:=$(CCACHE)
23 CMAKE_C_COMPILER_ARG1:=$(filter-out ccache,$(TARGET_CC))
24 CMAKE_CXX_COMPILER:=$(CCACHE)
25 CMAKE_CXX_COMPILER_ARG1:=$(filter-out ccache,$(TARGET_CXX))
26 endif
27
28 define Build/Configure/Default
29 (cd $(PKG_BUILD_DIR); \
30 CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
31 CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
32 cmake \
33 -DCMAKE_SYSTEM_NAME=Linux \
34 -DCMAKE_SYSTEM_VERSION=1 \
35 -DCMAKE_SYSTEM_PROCESSOR=$(ARCH) \
36 -DCMAKE_BUILD_TYPE=Release \
37 -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" \
38 -DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" \
39 -DCMAKE_C_COMPILER="$(CMAKE_C_COMPILER)" \
40 -DCMAKE_C_COMPILER_ARG1="$(CMAKE_C_COMPILER_ARG1)" \
41 -DCMAKE_CXX_COMPILER="$(CMAKE_CXX_COMPILER)" \
42 -DCMAKE_CXX_COMPILER_ARG1="$(CMAKE_CXX_COMPILER_ARG1)" \
43 -DCMAKE_EXE_LINKER_FLAGS="$(TARGET_LDFLAGS)" \
44 -DCMAKE_MODULE_LINKER_FLAGS="$(TARGET_LDFLAGS)" \
45 -DCMAKE_SHARED_LINKER_FLAGS="$(TARGET_LDFLAGS)" \
46 -DCMAKE_FIND_ROOT_PATH=$(STAGING_DIR) \
47 -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH \
48 -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
49 -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
50 -DCMAKE_STRIP=: \
51 -DCMAKE_INSTALL_PREFIX=/usr \
52 -DDL_LIBRARY=$(STAGING_DIR) \
53 $(CMAKE_OPTIONS) \
54 . \
55 )
56 endef
57
58 define Build/InstallDev/cmake
59 $(INSTALL_DIR) $(1)
60 $(CP) $(PKG_INSTALL_DIR)/* $(1)/
61 endef
62
63 Build/InstallDev = $(if $(CMAKE_INSTALL),$(Build/InstallDev/cmake))
This page took 0.061219 seconds and 5 git commands to generate.