[AVALONIA] Use cmake to build library.

This commit is contained in:
James Walmsley 2022-04-04 23:38:20 +00:00
Родитель f630e677ef
Коммит 789099139f
2 изменённых файлов: 37 добавлений и 7 удалений

Просмотреть файл

@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.20)
project(avalonia.skia)
find_package(PkgConfig)
set(ENV{PKG_CONFIG_DIR} "")
set(ENV{PKG_CONFIG_LIBDIR} "${PKGROOT}/usr/lib/pkgconfig:${PKGROOT}/usr/share/pkgconfig")
set(ENV{PKG_CONFIG_SYSROOT_DIR} ${PKGROOT})
pkg_check_modules(PKG_SKIA REQUIRED IMPORTED_TARGET skia)
add_library(avalonia.skia SHARED avalonia.skia.cpp)
target_include_directories(avalonia.skia PRIVATE ${PKG_SKIA_INCLUDE_DIRS})
target_link_libraries(avalonia.skia PRIVATE PkgConfig::PKG_SKIA)
set_target_properties(avalonia.skia PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libavalonia.skia.version)
set (CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-Wl,--version-script=${CMAKE_SOURCE_DIR}/libavalonia.skia.version")
add_executable(avalonia.skia.testprog testprog.c)
target_link_libraries(avalonia.skia.testprog PRIVATE avalonia.skia)
install(TARGETS avalonia.skia)
install(TARGETS avalonia.skia.testprog)

Просмотреть файл

@ -1,12 +1,13 @@
LAYER:=avalonia_skia
include $(DEFINE_LAYER)
avalonia_skia:=$(LSTAMP)/avalonia.skia
avalonia_symbols:=$(PKGROOT)/libavalonia.skia.symbols
avalonia_install:=$(LSTAMP)/avalonia_install
$(call meson_srcdir, avalonia_skia, $(BASE)/libavalonia.skia)
#$(call meson_srcdir, avalonia_skia, $(BASE)/libavalonia.skia)
$(L) += $(avalonia_skia)
$(L) += $(avalonia_symbols)
$(L) += $(avalonia_install)
@ -16,12 +17,16 @@ include $(BUILD_LAYER)
$(L): $(BASE)/libavalonia.skia/meson.build
$(avalonia_symbols): $(LSTAMP)/avalonia_skia
nm $(SYSROOT)/$(PREFIX)/$(LIBDIR)/libavalonia.skia.so | grep '.*\sT\s.*$$' > $@
CMAKE_FLAGS += -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$(SYSROOT)/$(PREFIX) -DPKGROOT=$(PKGROOT) -DCMAKE_INSTALL_LIBDIR=$(LIBDIR)
$(avalonia_install): $(LSTAMP)/avalonia_skia $(avalonia_symbols)
cd $(builddir)/avalonia_skia && DESTDIR=$(PKGROOT) ninja install
$(stamp)
$(avalonia_skia):
mkdir -p $(builddir)/avalonia.skia
cd $(builddir)/avalonia.skia && cmake $(CMAKE_FLAGS) $(BASE)/libavalonia.skia
cd $(builddir)/avalonia.skia && ninja
cd $(builddir)/avalonia.skia && DESTDIR=$(PKGROOT) ninja install
$(avalonia_symbols): $(avalonia_skia)
nm $(PKGROOT)/$(PREFIX)/$(LIBDIR)/libavalonia.skia.so | grep '.*\sT\s.*$$' > $@
$(L).clean:
rm -rf $(builddir)