From 0f57d04269b7f1ed0a09dc984c285e2481ce9d0c Mon Sep 17 00:00:00 2001 From: kalwalt Date: Mon, 23 Oct 2023 18:31:23 +0200 Subject: [PATCH] making CMakeLists file compliant for emscripten --- WebARKit/CMakeLists.txt | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/WebARKit/CMakeLists.txt b/WebARKit/CMakeLists.txt index 99cd1e5..105e719 100644 --- a/WebARKit/CMakeLists.txt +++ b/WebARKit/CMakeLists.txt @@ -4,14 +4,25 @@ project(WebARKitLib) set(CMAKE_CXX_STANDARD 14) -cmake_policy(SET CMP0135 NEW) +if(VERSION GREATER 3.24) + cmake_policy(SET CMP0135 NEW) +endif() include(FetchContent) -FetchContent_Declare( - build_opencv - URL https://github.com/webarkit/opencv-em/releases/download/0.1.0/opencv-4.7.0.zip -) +if(${EMSCRIPTEN_COMP} EQUAL 1) + message("Fetching opencv for emscripten compilation from webarkit/opencv-em ...") + FetchContent_Declare( + build_opencv + URL https://github.com/webarkit/opencv-em/releases/download/0.1.0/opencv-js-4.7.0-emcc-3.1.26.zip + ) +else() + message("Fetching opencv from webarkit/opencv-em ...") + FetchContent_Declare( + build_opencv + URL https://github.com/webarkit/opencv-em/releases/download/0.1.0/opencv-4.7.0.zip + ) +endif() FetchContent_MakeAvailable(build_opencv)