From 88a376c1c21820b2139915ae4789087f0d84deaf Mon Sep 17 00:00:00 2001 From: LAGonauta Date: Sat, 19 Jun 2021 08:13:39 -0300 Subject: [PATCH] Build YoloRT on project build --- .gitmodules | 3 +++ plugins/windows-notification/.gitignore | 1 + plugins/windows-notification/CMakeLists.txt | 18 ++++++++++++------ plugins/windows-notification/prepare-yolort.sh | 15 +++++++++++++++ plugins/windows-notification/yolort-builder | 1 + 5 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 plugins/windows-notification/.gitignore create mode 100644 plugins/windows-notification/prepare-yolort.sh create mode 160000 plugins/windows-notification/yolort-builder diff --git a/.gitmodules b/.gitmodules index b5480660..b0826ebf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,3 +2,6 @@ path = plugins/signal-protocol/libsignal-protocol-c url = https://github.com/WhisperSystems/libsignal-protocol-c.git branch = v2.3.3 +[submodule "plugins/windows-notification/yolort-builder"] + path = plugins/windows-notification/yolort-builder + url = https://github.com/Yuubi-san/YoloRT.git diff --git a/plugins/windows-notification/.gitignore b/plugins/windows-notification/.gitignore new file mode 100644 index 00000000..d71a29c5 --- /dev/null +++ b/plugins/windows-notification/.gitignore @@ -0,0 +1 @@ +/yolort \ No newline at end of file diff --git a/plugins/windows-notification/CMakeLists.txt b/plugins/windows-notification/CMakeLists.txt index 74b45d7a..c8800213 100644 --- a/plugins/windows-notification/CMakeLists.txt +++ b/plugins/windows-notification/CMakeLists.txt @@ -56,6 +56,16 @@ target_include_directories(windows-notification ${PROJECT_SOURCE_DIR}/yolort/include ) +add_custom_target( + yolort ALL + COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/prepare-yolort.sh + BYPRODUCTS yolort/include + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + VERBATIM + USES_TERMINAL + COMMENT "=====> Generating YoloRT Header files for Windows Notification plugin <=====" +) + find_library(shlwapi_LIBRARY shlwapi libshlwapi libshlwapi.a HINTS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}) if(NOT shlwapi_LIBRARY) message(FATAL_ERROR "shlwapi library not found") @@ -66,15 +76,11 @@ if(NOT ntdll_LIBRARY) message(FATAL_ERROR "ntdll library not found") endif(NOT ntdll_LIBRARY) -find_library(mincore_LIBRARY mincore libmincore libmincore.a HINTS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}) -if(NOT mincore_LIBRARY) - message(FATAL_ERROR "mincore library not found") -endif(NOT mincore_LIBRARY) - -target_link_libraries(windows-notification libdino ${shlwapi_LIBRARY} ${propsys_LIBRARY} ${ntdll_LIBRARY} ${mincore_LIBRARY} ${WINDOWS_NOTIFICATION_PACKAGES}) +target_link_libraries(windows-notification libdino ${shlwapi_LIBRARY} ${ntdll_LIBRARY} ${WINDOWS_NOTIFICATION_PACKAGES}) target_compile_features(windows-notification PRIVATE cxx_std_20) target_compile_definitions(windows-notification PRIVATE WINRT_GLIB_H_INSIDE) target_compile_options(windows-notification PRIVATE $<$:-iquote ${PROJECT_SOURCE_DIR}/yolort/include/winrt/yolort_impl>) +add_dependencies(windows-notification yolort) set_target_properties(windows-notification PROPERTIES PREFIX "") set_target_properties(windows-notification PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins/) diff --git a/plugins/windows-notification/prepare-yolort.sh b/plugins/windows-notification/prepare-yolort.sh new file mode 100644 index 00000000..5b63259a --- /dev/null +++ b/plugins/windows-notification/prepare-yolort.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +export ORIGINAL_FOLDER=${PWD} +cd ${PWD}/yolort-builder + +if [ ! -f bin/cppwinrt.exe ]; then + make CPPWINRT_VERSION=2.0.210122.3 bin/cppwinrt.exe +fi + +make originals +make --jobs=$(nproc) + +mkdir -p ../yolort +cp -r include ../yolort +cd ${ORIGINAL_FOLDER} \ No newline at end of file diff --git a/plugins/windows-notification/yolort-builder b/plugins/windows-notification/yolort-builder new file mode 160000 index 00000000..835cd4ee --- /dev/null +++ b/plugins/windows-notification/yolort-builder @@ -0,0 +1 @@ +Subproject commit 835cd4eefd456df0a9d017310beba772f1c48460