[OpenWrt-Devel] [PATCH] include/cmake: fix compilation with a host subdir
Rosen Penev
rosenp at gmail.com
Thu Feb 6 14:33:43 EST 2020
Some packages such as libcxx do not accept being build in the same
directory, which breaks host compilation.
This commit adds the same behavior present for target builds.
Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
include/cmake.mk | 4 +++-
include/host-build.mk | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/cmake.mk b/include/cmake.mk
index 2726b83a1e..3f69d403e9 100644
--- a/include/cmake.mk
+++ b/include/cmake.mk
@@ -8,6 +8,7 @@ endif
CMAKE_BINARY_DIR = $(PKG_BUILD_DIR)$(if $(CMAKE_BINARY_SUBDIR),/$(CMAKE_BINARY_SUBDIR))
CMAKE_SOURCE_DIR = $(PKG_BUILD_DIR)$(if $(CMAKE_SOURCE_SUBDIR),/$(CMAKE_SOURCE_SUBDIR))
+HOST_CMAKE_BINARY_DIR = $(HOST_BUILD_DIR)$(if $(CMAKE_BINARY_SUBDIR),/$(CMAKE_BINARY_SUBDIR))
HOST_CMAKE_SOURCE_DIR = $(HOST_BUILD_DIR)$(if $(CMAKE_SOURCE_SUBDIR),/$(CMAKE_SOURCE_SUBDIR))
MAKE_PATH = $(firstword $(CMAKE_BINARY_SUBDIR) .)
@@ -84,7 +85,8 @@ endef
Build/InstallDev = $(if $(CMAKE_INSTALL),$(Build/InstallDev/cmake))
define Host/Configure/Default
- (cd $(HOST_BUILD_DIR); \
+ mkdir -p $(HOST_CMAKE_BINARY_DIR)
+ (cd $(HOST_CMAKE_BINARY_DIR); \
CFLAGS="$(HOST_CFLAGS)" \
CXXFLAGS="$(HOST_CFLAGS)" \
LDFLAGS="$(HOST_LDFLAGS)" \
diff --git a/include/host-build.mk b/include/host-build.mk
index 9fc14241c6..1270ca393e 100644
--- a/include/host-build.mk
+++ b/include/host-build.mk
@@ -102,7 +102,7 @@ endef
define Host/Compile/Default
+$(HOST_MAKE_VARS) \
- $(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) \
+ $(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR)/$(MAKE_PATH) \
$(HOST_MAKE_FLAGS) \
$(1)
endef
--
2.24.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list