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