2020-03-28 16:35:00 +01:00
|
|
|
# parameters:
|
|
|
|
# $(1): lowercase package name
|
|
|
|
# $(2): uppercase package name
|
|
|
|
# $(3): 32/64, build type
|
2021-11-12 13:36:32 +01:00
|
|
|
# $(4): CROSS/<empty>, cross compile
|
2020-03-28 16:35:00 +01:00
|
|
|
#
|
|
|
|
define create-rules-cmake
|
2021-11-12 13:36:32 +01:00
|
|
|
$(call create-rules-common,$(1),$(2),$(3),$(4))
|
2020-03-28 16:35:00 +01:00
|
|
|
|
2023-01-13 12:48:41 +01:00
|
|
|
$$($(2)_SRC)/CMakeLists.txt: | $$(OBJ)/.$(1)-post-source
|
2020-03-28 16:35:00 +01:00
|
|
|
$$(OBJ)/.$(1)-configure$(3): $$($(2)_SRC)/CMakeLists.txt
|
|
|
|
@echo ":: configuring $(3)bit $(1)..." >&2
|
|
|
|
rm -rf "$$($(2)_OBJ$(3))/CMakeCache.txt"
|
|
|
|
|
|
|
|
cd "$$($(2)_OBJ$(3))" && env $$($(2)_ENV$(3)) \
|
|
|
|
cmake "$$($(2)_SRC)" \
|
|
|
|
-DCMAKE_INSTALL_PREFIX="$$($(2)_DST$(3))" \
|
|
|
|
-DCMAKE_INSTALL_LIBDIR="lib$(subst 32,,$(3))" \
|
|
|
|
-DCMAKE_BUILD_TYPE=plain \
|
2021-12-14 17:58:51 +01:00
|
|
|
-DCMAKE_SYSTEM_NAME=$(if $(4),Windows,) \
|
2021-11-12 13:36:32 +01:00
|
|
|
-DCMAKE_SHARED_LIBRARY_PREFIX_C=$(if $(4),,lib) \
|
|
|
|
-DCMAKE_IMPORT_LIBRARY_PREFIX_C=$(if $(4),,lib) \
|
2020-03-28 16:35:00 +01:00
|
|
|
$$($(2)_CMAKE_ARGS) \
|
|
|
|
$$($(2)_CMAKE_ARGS$(3))
|
|
|
|
|
|
|
|
touch $$@
|
|
|
|
|
|
|
|
$$(OBJ)/.$(1)-build$(3):
|
|
|
|
@echo ":: building $(3)bit $(1)..." >&2
|
|
|
|
cd "$$($(2)_OBJ$(3))" && env $$($(2)_ENV$(3)) \
|
|
|
|
$$(MAKE)
|
|
|
|
cd "$$($(2)_OBJ$(3))" && env $$($(2)_ENV$(3)) \
|
|
|
|
$$(MAKE) install
|
|
|
|
touch $$@
|
|
|
|
endef
|
|
|
|
|
2021-11-12 13:36:32 +01:00
|
|
|
rules-cmake = $(call create-rules-cmake,$(1),$(call toupper,$(1)),$(2),$(3))
|