22255acf590c69e625543006b7036d3e690b0739
[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 CMAKE_C_COMPILER:=$(STAGING_DIR_HOST)/bin/ccache
19 CMAKE_C_COMPILER_ARG1:=$(filter-out ccache,$(TARGET_CC))
20 CMAKE_CXX_COMPILER:=$(STAGING_DIR_HOST)/bin/ccache
21 CMAKE_CXX_COMPILER_ARG1:=$(filter-out ccache,$(TARGET_CXX))
22 endif
23
24 define Build/Configure/Default
25 (cd $(PKG_BUILD_DIR); \
26 CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
27 CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
28 cmake \
29 -DCMAKE_SYSTEM_NAME=Linux \
30 -DCMAKE_SYSTEM_VERSION=1 \
31 -DCMAKE_SYSTEM_PROCESSOR=$(ARCH) \
32 -DCMAKE_BUILD_TYPE=Release \
33 -DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" \
34 -DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" \
35 -DCMAKE_C_COMPILER="$(CMAKE_C_COMPILER)" \
36 -DCMAKE_C_COMPILER_ARG1="$(CMAKE_C_COMPILER_ARG1)" \
37 -DCMAKE_CXX_COMPILER="$(CMAKE_CXX_COMPILER)" \
38 -DCMAKE_CXX_COMPILER_ARG1="$(CMAKE_CXX_COMPILER_ARG1)" \
39 -DCMAKE_EXE_LINKER_FLAGS="$(TARGET_LDFLAGS)" \
40 -DCMAKE_MODULE_LINKER_FLAGS="$(TARGET_LDFLAGS)" \
41 -DCMAKE_SHARED_LINKER_FLAGS="$(TARGET_LDFLAGS)" \
42 -DCMAKE_FIND_ROOT_PATH=$(STAGING_DIR) \
43 -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=$(STAGING_DIR_HOST) \
44 -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=$(STAGING_DIR) \
45 -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=$(STAGING_DIR) \
46 -DCMAKE_STRIP=: \
47 -DCMAKE_INSTALL_PREFIX=/usr \
48 $(CMAKE_OPTIONS) \
49 . \
50 )
51 endef
52
53 define Build/InstallDev/cmake
54 $(INSTALL_DIR) $(1)
55 $(CP) $(PKG_INSTALL_DIR)/* $(1)/
56 endef
57
58 Build/InstallDev = $(if $(CMAKE_INSTALL),$(Build/InstallDev/cmake))
This page took 0.040871 seconds and 3 git commands to generate.