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