From 07e0ea47f639537dd3a28df6ac1ee7c8c10bc15d Mon Sep 17 00:00:00 2001 From: uvos Date: Tue, 8 Jun 2021 21:49:45 +0200 Subject: [PATCH] convert to lib --- CMakeLists.txt | 25 ++++++++++++++++++------- src/bgremoval.cpp | 2 +- src/charuco.cpp | 2 +- src/harris.cpp | 2 +- src/main.cpp | 10 +++++----- src/unwrap.cpp | 2 +- src/{ => uvosunwrap}/bgremoval.h | 0 src/{ => uvosunwrap}/charuco.h | 0 src/{ => uvosunwrap}/detectedpoint.h | 0 src/{ => uvosunwrap}/harris.h | 0 src/{ => uvosunwrap}/normalize.h | 0 src/{ => uvosunwrap}/unwrap.h | 0 12 files changed, 27 insertions(+), 16 deletions(-) rename src/{ => uvosunwrap}/bgremoval.h (100%) rename src/{ => uvosunwrap}/charuco.h (100%) rename src/{ => uvosunwrap}/detectedpoint.h (100%) rename src/{ => uvosunwrap}/harris.h (100%) rename src/{ => uvosunwrap}/normalize.h (100%) rename src/{ => uvosunwrap}/unwrap.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 44d4be9..26c1ae0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,18 +1,29 @@ cmake_minimum_required(VERSION 3.0) -project(unwrap) +project(uvosunwrap) -set(SRC_FILES src/main.cpp src/unwrap.cpp src/drawing.cpp src/matutils.cpp src/bgremoval.cpp src/charuco.cpp src/harris.cpp) +set(SRC_FILES_LIB src/unwrap.cpp src/drawing.cpp src/matutils.cpp src/bgremoval.cpp src/charuco.cpp src/harris.cpp) + +set(SRC_FILES_APP src/main.cpp) find_package( OpenCV REQUIRED ) -add_executable(${PROJECT_NAME} ${SRC_FILES}) +add_library(${PROJECT_NAME} SHARED ${SRC_FILES_LIB}) +target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS}) +target_include_directories(${PROJECT_NAME} PRIVATE ${OpenCV_INCLUDE_DIRS}) +target_compile_options(${PROJECT_NAME} PRIVATE "-std=c++17" "-Wall" "-O2" "-fno-strict-aliasing") + +link_directories(${CMAKE_CURRENT_BINARY_DIR}) + +add_executable(${PROJECT_NAME}_cli ${SRC_FILES_APP}) +target_link_libraries( ${PROJECT_NAME}_cli ${OpenCV_LIBS} -l${PROJECT_NAME}) +target_include_directories(${PROJECT_NAME}_cli PRIVATE ${OpenCV_INCLUDE_DIRS} ) +target_compile_options(${PROJECT_NAME}_cli PRIVATE "-std=c++17" "-Wall" "-O2" "-fno-strict-aliasing") -target_link_libraries( ${PROJECT_NAME} ${LIBS} -lopencv_core -lopencv_aruco -lopencv_imgcodecs -lopencv_highgui -lopencv_features2d -lopencv_imgcodecs -lopencv_imgproc -lopencv_video -lopencv_stitching) -target_include_directories(${PROJECT_NAME} PRIVATE "/usr/include/opencv4") -add_definitions(" -std=c++17 -Wall -O2 -fno-strict-aliasing") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s") set(CMAKE_INSTALL_PREFIX "/usr") -install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin) +install(TARGETS ${PROJECT_NAME}_cli RUNTIME DESTINATION bin) +install(TARGETS ${PROJECT_NAME} DESTINATION lib) +install(DIRECTORY src/uvosunwrap/ DESTINATION include/${PROJECT_NAME} FILES_MATCHING PATTERN "*.h") diff --git a/src/bgremoval.cpp b/src/bgremoval.cpp index cf87d2c..fc154ca 100644 --- a/src/bgremoval.cpp +++ b/src/bgremoval.cpp @@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -#include "bgremoval.h" +#include "uvosunwrap/bgremoval.h" #include #include #include diff --git a/src/charuco.cpp b/src/charuco.cpp index 54f167f..14f8b2b 100644 --- a/src/charuco.cpp +++ b/src/charuco.cpp @@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -#include "charuco.h" +#include "uvosunwrap/charuco.h" #include #include diff --git a/src/harris.cpp b/src/harris.cpp index 4ef2503..4b21f63 100644 --- a/src/harris.cpp +++ b/src/harris.cpp @@ -20,7 +20,7 @@ #include #include #include -#include "harris.h" +#include "uvosunwrap/harris.h" #include "log.h" #include "matutils.h" #include "drawing.h" diff --git a/src/main.cpp b/src/main.cpp index 58f0cf7..213ee5f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,12 +26,12 @@ #include #include #include "argpopt.h" -#include "unwrap.h" -#include "bgremoval.h" -#include "normalize.h" +#include "uvosunwrap/unwrap.h" +#include "uvosunwrap/bgremoval.h" +#include "uvosunwrap/normalize.h" #include "log.h" -#include "charuco.h" -#include "harris.h" +#include "uvosunwrap/charuco.h" +#include "uvosunwrap/harris.h" #define IMREAD_SIZE pow(2, 20) diff --git a/src/unwrap.cpp b/src/unwrap.cpp index a7def43..d509ad0 100644 --- a/src/unwrap.cpp +++ b/src/unwrap.cpp @@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ -#include "unwrap.h" +#include "uvosunwrap/unwrap.h" #include #include diff --git a/src/bgremoval.h b/src/uvosunwrap/bgremoval.h similarity index 100% rename from src/bgremoval.h rename to src/uvosunwrap/bgremoval.h diff --git a/src/charuco.h b/src/uvosunwrap/charuco.h similarity index 100% rename from src/charuco.h rename to src/uvosunwrap/charuco.h diff --git a/src/detectedpoint.h b/src/uvosunwrap/detectedpoint.h similarity index 100% rename from src/detectedpoint.h rename to src/uvosunwrap/detectedpoint.h diff --git a/src/harris.h b/src/uvosunwrap/harris.h similarity index 100% rename from src/harris.h rename to src/uvosunwrap/harris.h diff --git a/src/normalize.h b/src/uvosunwrap/normalize.h similarity index 100% rename from src/normalize.h rename to src/uvosunwrap/normalize.h diff --git a/src/unwrap.h b/src/uvosunwrap/unwrap.h similarity index 100% rename from src/unwrap.h rename to src/uvosunwrap/unwrap.h