From 7f9c75d88fe6d9f710d60885253b0c748cf096d8 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 7 Jun 2021 21:55:27 +0200 Subject: src/CMakeLists.txt: Wrap GIR and VAPI related build instructions into if-clauses (that check, if INTROSPECTION_FOUND and VAPI_FOUND). --- src/CMakeLists.txt | 137 ++++++++++++++++++++++++++++------------------------- 1 file changed, 73 insertions(+), 64 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bb93dc3..9894f90 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -108,69 +108,78 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libayatana-ido3-0.4.so.0.0.0" DESTINA # ayatana-ido3-0.4.gir -set(HEADERS - idocalendarmenuitem.h - idoentrymenuitem.h - idorange.h - idoscalemenuitem.h - idoswitchmenuitem.h - idotimeline.h -) - find_package(GObjectIntrospection REQUIRED QUIET) -add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.gir" - DEPENDS "ayatana-ido3-0.4" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND - ${INTROSPECTION_SCANNER} - ${SOURCES} ${HEADERS} - --symbol-prefix=ido - --identifier-prefix=Ido - --namespace=AyatanaIdo3 - --nsversion=0.4 - --quiet - --pkg=gtk+-3.0 - --warn-all - --include=Gtk-3.0 - --library="ayatana-ido3-0.4" - --library-path=${CMAKE_CURRENT_BINARY_DIR} - --output "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.gir" -) - -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.gir" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/gir-1.0") - -# ayatana-ido3-0.4.typelib - -add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.typelib" - DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.gir" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND - ${INTROSPECTION_COMPILER} - --includedir=${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.gir - -o "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.typelib" -) - -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.typelib" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/girepository-1.0") - -# ayatana-ido3-0.4.vapi - -find_package(Vala REQUIRED QUIET) - -add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.vapi" - DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.typelib" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND - ${VAPI_GEN} - --library=AyatanaIdo3-0.4 - --pkg gtk+-3.0 - AyatanaIdo3-0.4.gir -) - -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.vapi" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/vala/vapi") - -add_custom_target("src" ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.vapi") +if (INTROSPECTION_FOUND) + + set(HEADERS + idocalendarmenuitem.h + idoentrymenuitem.h + idorange.h + idoscalemenuitem.h + idoswitchmenuitem.h + idotimeline.h + ) + + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.gir" + DEPENDS "ayatana-ido3-0.4" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND + ${INTROSPECTION_SCANNER} + ${SOURCES} ${HEADERS} + --symbol-prefix=ido + --identifier-prefix=Ido + --namespace=AyatanaIdo3 + --nsversion=0.4 + --quiet + --pkg=gtk+-3.0 + --warn-all + --include=Gtk-3.0 + --library="ayatana-ido3-0.4" + --library-path=${CMAKE_CURRENT_BINARY_DIR} + --output "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.gir" + ) + + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.gir" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/gir-1.0") + + # ayatana-ido3-0.4.typelib + + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.typelib" + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.gir" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND + ${INTROSPECTION_COMPILER} + --includedir=${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.gir + -o "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.typelib" + ) + + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.typelib" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/girepository-1.0") + + + # ayatana-ido3-0.4.vapi + + find_package(Vala REQUIRED QUIET) + + if (VALA_FOUND) + + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.vapi" + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.typelib" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND + ${VAPI_GEN} + --library=AyatanaIdo3-0.4 + --pkg gtk+-3.0 + AyatanaIdo3-0.4.gir + ) + + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.vapi" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/vala/vapi") + + add_custom_target("src" ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AyatanaIdo3-0.4.vapi") + + endif () + +endif () -- cgit v1.2.3