Skip to content

Commit

Permalink
fetching content from opencv-em build the project!
Browse files Browse the repository at this point in the history
  • Loading branch information
kalwalt committed Sep 24, 2023
1 parent 8ae03da commit 04541bd
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 93 deletions.
94 changes: 15 additions & 79 deletions WebARKit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,77 +6,17 @@ set(CMAKE_CXX_STANDARD 14)

include(FetchContent)

set(BUILD_SHARED_LIBS OFF)
set(BUILD_opencv_dnn OFF)
set(BUILD_opencv_highgui OFF)
set(BUILD_opencv_ml OFF)
set(BUILD_opencv_objdetect OFF)
set(BUILD_opencv_gapi OFF)
set(BUILD_opencv_photo OFF)
set(BUILD_opencv_stitching OFF)
set(BUILD_opencv_ts OFF)
set(BUILD_opencv_videoio OFF)
set(BUILD_opencv_python2 OFF)
set(BUILD_opencv_python3 OFF)

set(BUILD_opencv_dnn_plugins OFF)
set(BUILD_opencv_highgui_plugins OFF)
set(BUILD_opencv_videoio_plugins OFF)
set(BUILD_opencv_intensity_transform OFF)
set(BUILD_opencv_phase_unwrapping OFF)
set(BUILD_opencv_plot OFF)
set(BUILD_opencv_reg OFF)
set(BUILD_opencv_surface_matching OFF)
set(BUILD_opencv_bioinspired OFF)
set(BUILD_opencv_fuzzy OFF)
set(BUILD_opencv_hfs OFF)
set(BUILD_opencv_img_hash OFF)
set(BUILD_opencv_line_descriptor OFF)
set(BUILD_opencv_saliency OFF)
set(BUILD_opencv_rapid OFF)
set(BUILD_opencv_rgbd OFF)
set(BUILD_opencv_shape OFF)
set(BUILD_opencv_rapid OFF)
set(BUILD_opencv_structured_light OFF)
set(BUILD_opencv_java OFF)

#set(BUILD_opencv_xfeatures2d ON)
#set(BUILD_opencv_contrib ON)
#set(OPENCV_ENABLE_NONFREE ON)

set(BUILD_opencv_ximgproc OFF)
set(BUILD_opencv_bgsegm OFF)
set(BUILD_opencv_optflow OFF)
set(BUILD_opencv_opencv_superres OFF)
set(BUILD_opencv_tracking OFF)
set(BUILD_opencv_stereo OFF)
set(BUILD_opencv_version OFF)

set(OPENCV_EXTRA_MODULES_PATH ${opencv_contrib_SOURCE_DIR}/modules)

FetchContent_Declare(
opencv
GIT_REPOSITORY https://github.com/webarkit/opencv.git
GIT_TAG 889dfa15f1cd60e571d33b23b87a1d506d381ea9
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
build_opencv
URL https://github.com/webarkit/opencv-em/releases/download/0.1.0/opencv-4.7.0.zip
)

FetchContent_Declare(
opencv_contrib
GIT_REPOSITORY https://github.com/webarkit/opencv_contrib.git
GIT_TAG 5438f53d81e1c1137258e18308ebf3f4daa2f2ff
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)

FetchContent_MakeAvailable(opencv opencv_contrib)
set(OPENCV_EXTRA_MODULES_PATH ${opencv_contrib_SOURCE_DIR}/modules)

#set(BUILD_opencv_xfeatures2d ON)
FetchContent_MakeAvailable(build_opencv)

get_filename_component(PARENT_DIR ./ ABSOLUTE)

#set( BUILD_WASM build_wasm )

set(WEBARKIT_HEADERS
${PARENT_DIR}/WebARKitTrackers/WebARKitOpticalTracking/include/WebARKitTrackers/WebARKitOpticalTracking/WebARKitConfig.h
${PARENT_DIR}/WebARKitTrackers/WebARKitOpticalTracking/include/WebARKitTrackers/WebARKitOpticalTracking//WebARKitEnums.h
Expand All @@ -103,17 +43,13 @@ target_include_directories(WebARKitLib PRIVATE "${PARENT_DIR}/include")
target_include_directories(WebARKitLib PRIVATE "${PARENT_DIR}/WebARKitTrackers/WebARKitOpticalTracking/include")

target_include_directories(WebARKitLib PRIVATE
${OPENCV_CONFIG_FILE_INCLUDE_DIR}
${OPENCV_INCLUDE_DIR}
${OPENCV_MODULE_opencv_calib3d_LOCATION}/include
${OPENCV_MODULE_opencv_core_LOCATION}/include
${OPENCV_MODULE_opencv_features2d_LOCATION}/include
${OPENCV_MODULE_opencv_flann_LOCATION}/include
${OPENCV_MODULE_opencv_imgproc_LOCATION}/include
${OPENCV_MODULE_opencv_imgcodecs_LOCATION}/include
${OPENCV_MODULE_opencv_video_LOCATION}/include
#${OPENCV_MODULE_opencv_xfeatures2d_LOCATION}/include
${opencv_contrib_SOURCE_DIR}/modules/xfeatures2d/include
)

target_link_libraries(WebARKitLib opencv_calib3d opencv_core opencv_features2d opencv_flann opencv_imgproc opencv_imgcodecs opencv_video)
"${build_opencv_SOURCE_DIR}"
"${build_opencv_SOURCE_DIR}/libs/opencv/include"
"${build_opencv_SOURCE_DIR}/libs/opencv/modules/calib3d/include"
"${build_opencv_SOURCE_DIR}/libs/opencv/modules/core/include"
"${build_opencv_SOURCE_DIR}/libs/opencv/modules/features2d/include"
"${build_opencv_SOURCE_DIR}/libs/opencv/modules/flann/include"
"${build_opencv_SOURCE_DIR}/libs/opencv/modules/imgproc/include"
"${build_opencv_SOURCE_DIR}/libs/opencv/modules/video/include"
"${build_opencv_SOURCE_DIR}/libs/opencv_contrib/modules/xfeatures2d/include"
)
45 changes: 31 additions & 14 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ FetchContent_Declare(
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)

FetchContent_Declare(
build_opencv
URL https://github.com/webarkit/opencv-em/releases/download/0.1.0/opencv-4.7.0.zip
)

FetchContent_MakeAvailable(googletest build_opencv)

enable_testing()

Expand All @@ -24,32 +30,43 @@ add_executable(
)

get_filename_component(PARENT_DIR ../ ABSOLUTE)
message("opencv contrib source dir: ${PARENT_DIR}/WebARKit/build/_deps/opencv_contrib-src/modules/xfeatures2d/include")
message("opencv contrib source dir inside tests: ${PARENT_DIR}/tests/build/_deps/opencv_contrib-src/modules/xfeatures2d/include")
get_filename_component(TEST_DIR ./ ABSOLUTE)

target_include_directories(webarkit_test PRIVATE "${PARENT_DIR}/WebARKit/include")
target_include_directories(webarkit_test PRIVATE "${PARENT_DIR}/WebARKit/WebARKitTrackers/WebARKitOpticalTracking/include")

target_include_directories(webarkit_test PRIVATE
${OPENCV_CONFIG_FILE_INCLUDE_DIR}
${OPENCV_INCLUDE_DIR}
${OPENCV_MODULE_opencv_calib3d_LOCATION}/include
${OPENCV_MODULE_opencv_core_LOCATION}/include
${OPENCV_MODULE_opencv_features2d_LOCATION}/include
${OPENCV_MODULE_opencv_flann_LOCATION}/include
${OPENCV_MODULE_opencv_imgproc_LOCATION}/include
${OPENCV_MODULE_opencv_imgcodecs_LOCATION}/include
${OPENCV_MODULE_opencv_video_LOCATION}/include
#${OPENCV_MODULE_opencv_xfeatures2d_LOCATION}/include
${PARENT_DIR}/tests/build/_deps/opencv_contrib-src/modules/xfeatures2d/include
"${build_opencv_SOURCE_DIR}"
"${build_opencv_SOURCE_DIR}/libs/opencv/include"
"${build_opencv_SOURCE_DIR}/libs/opencv/modules/calib3d/include"
"${build_opencv_SOURCE_DIR}/libs/opencv/modules/core/include"
"${build_opencv_SOURCE_DIR}/libs/opencv/modules/features2d/include"
"${build_opencv_SOURCE_DIR}/libs/opencv/modules/flann/include"
"${build_opencv_SOURCE_DIR}/libs/opencv/modules/imgproc/include"
"${build_opencv_SOURCE_DIR}/libs/opencv/modules/video/include"
"${build_opencv_SOURCE_DIR}/libs/opencv_contrib/modules/xfeatures2d/include"
)

set(webarkit_test
${PARENT_DIR}/WebARKit/WebARKitManager.cpp
)

# The order of the libs make the difference!

target_link_libraries(
webarkit_test
WebARKitLib
"${build_opencv_SOURCE_DIR}/lib/libopencv_calib3d.a"
"${build_opencv_SOURCE_DIR}/lib/libopencv_features2d.a"
"${build_opencv_SOURCE_DIR}/lib/libopencv_flann.a"
"${build_opencv_SOURCE_DIR}/lib/libopencv_video.a"
"${build_opencv_SOURCE_DIR}/lib/libopencv_xfeatures2d.a"
"${build_opencv_SOURCE_DIR}/lib/libopencv_imgproc.a"
#"${build_opencv_SOURCE_DIR}/lib/libopencv_video.a"
#"${build_opencv_SOURCE_DIR}/3rdparty/lib/libzlib.a"
"${build_opencv_SOURCE_DIR}/lib/libopencv_core.a"
"${build_opencv_SOURCE_DIR}/3rdparty/lib/libzlib.a"
#"${build_opencv_SOURCE_DIR}/lib/libopencv_xfeatures2d.a"
GTest::gtest_main
)

Expand Down

0 comments on commit 04541bd

Please sign in to comment.