projects
/
librecmc
/
librecmc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
kernel: make the kernel build auto-clean the build dir like package builds
[librecmc/librecmc.git]
/
include
/
cmake.mk
diff --git
a/include/cmake.mk
b/include/cmake.mk
index f1db612986f71b25a11a0d6d4932d39df4d3f74d..483a1510827b7496f53202ef615c71708c29de5c 100644
(file)
--- a/
include/cmake.mk
+++ b/
include/cmake.mk
@@
-1,10
+1,15
@@
+cmake_bool = $(patsubst %,-D%:BOOL=$(if $($(1)),ON,OFF),$(2))
+
PKG_INSTALL:=1
ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
MAKE_FLAGS+=VERBOSE=1
endif
PKG_INSTALL:=1
ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
MAKE_FLAGS+=VERBOSE=1
endif
-CMAKE_SOURCE_DIR:=.
+CMAKE_BINARY_DIR = $(PKG_BUILD_DIR)$(if $(CMAKE_BINARY_SUBDIR),/$(CMAKE_BINARY_SUBDIR))
+CMAKE_SOURCE_DIR = $(PKG_BUILD_DIR)
+HOST_CMAKE_SOURCE_DIR = $(HOST_BUILD_DIR)
+MAKE_PATH = $(firstword $(CMAKE_BINARY_SUBDIR) .)
ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
cmake_tool=$(TOOLCHAIN_DIR)/bin/$(1)
ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
cmake_tool=$(TOOLCHAIN_DIR)/bin/$(1)
@@
-18,10
+23,7
@@
ifeq ($(CONFIG_CCACHE),)
CMAKE_C_COMPILER_ARG1:=
CMAKE_CXX_COMPILER_ARG1:=
else
CMAKE_C_COMPILER_ARG1:=
CMAKE_CXX_COMPILER_ARG1:=
else
- CCACHE:=$(shell which ccache)
- ifeq ($(CCACHE),)
- CCACHE:=$(STAGING_DIR_HOST)/bin/ccache
- endif
+ CCACHE:=$(STAGING_DIR_HOST)/bin/ccache
CMAKE_C_COMPILER:=$(CCACHE)
CMAKE_C_COMPILER_ARG1:=$(TARGET_CC_NOCACHE)
CMAKE_CXX_COMPILER:=$(CCACHE)
CMAKE_C_COMPILER:=$(CCACHE)
CMAKE_C_COMPILER_ARG1:=$(TARGET_CC_NOCACHE)
CMAKE_CXX_COMPILER:=$(CCACHE)
@@
-31,11
+33,13
@@
CMAKE_AR:=$(call cmake_tool,$(TARGET_AR))
CMAKE_NM:=$(call cmake_tool,$(TARGET_NM))
CMAKE_RANLIB:=$(call cmake_tool,$(TARGET_RANLIB))
CMAKE_NM:=$(call cmake_tool,$(TARGET_NM))
CMAKE_RANLIB:=$(call cmake_tool,$(TARGET_RANLIB))
-CMAKE_FIND_ROOT_PATH:=$(STAGING_DIR);$(TOOLCHAIN_DIR)$(if $(CONFIG_EXTERNAL_TOOLCHAIN),;$(CONFIG_TOOLCHAIN_ROOT))
-CMAKE_HOST_FIND_ROOT_PATH:=$(STAGING_DIR_HOST)
+CMAKE_FIND_ROOT_PATH:=$(STAGING_DIR)/usr;$(TOOLCHAIN_DIR)$(if $(CONFIG_EXTERNAL_TOOLCHAIN),;$(CONFIG_TOOLCHAIN_ROOT))
+CMAKE_HOST_FIND_ROOT_PATH:=$(STAGING_DIR)/host;$(STAGING_DIR_HOST)
+CMAKE_SHARED_LDFLAGS:=-Wl,-Bsymbolic-functions
define Build/Configure/Default
define Build/Configure/Default
- (cd $(PKG_BUILD_DIR); \
+ mkdir -p $(CMAKE_BINARY_DIR)
+ (cd $(CMAKE_BINARY_DIR); \
CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \
CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" \
@@
-53,8
+57,8
@@
define Build/Configure/Default
-DCMAKE_ASM_COMPILER="$(CMAKE_C_COMPILER)" \
-DCMAKE_ASM_COMPILER_ARG1="$(CMAKE_C_COMPILER_ARG1)" \
-DCMAKE_EXE_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS)" \
-DCMAKE_ASM_COMPILER="$(CMAKE_C_COMPILER)" \
-DCMAKE_ASM_COMPILER_ARG1="$(CMAKE_C_COMPILER_ARG1)" \
-DCMAKE_EXE_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS)" \
- -DCMAKE_MODULE_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS)" \
- -DCMAKE_SHARED_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS)" \
+ -DCMAKE_MODULE_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS)
$(CMAKE_SHARED_LDFLAGS)
" \
+ -DCMAKE_SHARED_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS)
$(CMAKE_SHARED_LDFLAGS)
" \
-DCMAKE_AR="$(CMAKE_AR)" \
-DCMAKE_NM="$(CMAKE_NM)" \
-DCMAKE_RANLIB="$(CMAKE_RANLIB)" \
-DCMAKE_AR="$(CMAKE_AR)" \
-DCMAKE_NM="$(CMAKE_NM)" \
-DCMAKE_RANLIB="$(CMAKE_RANLIB)" \
@@
-96,10
+100,10
@@
define Host/Configure/Default
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
-DCMAKE_STRIP=: \
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
-DCMAKE_STRIP=: \
- -DCMAKE_INSTALL_PREFIX=$(
STAGING_DIR_HOST
) \
- -DCMAKE_PREFIX_PATH=$(
STAGING_DIR_HOST
) \
+ -DCMAKE_INSTALL_PREFIX=$(
HOST_BUILD_PREFIX
) \
+ -DCMAKE_PREFIX_PATH=$(
HOST_BUILD_PREFIX
) \
-DCMAKE_SKIP_RPATH=TRUE \
$(CMAKE_HOST_OPTIONS) \
-DCMAKE_SKIP_RPATH=TRUE \
$(CMAKE_HOST_OPTIONS) \
- $(CMAKE_SOURCE_DIR) \
+ $(
HOST_
CMAKE_SOURCE_DIR) \
)
endef
)
endef