diff --git a/Makefile b/Makefile index 9cbae546286ed7839b46527e28a887026ad5e8aa..1becae4afb783bbe199791caa45c3ef6aed89bb4 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,34 @@ -include ./lib/common.mk +include src/common.mk SRCS=$(wildcard ./*.cpp) OBJS=$(SRCS:%.cpp=%.o) OBJSALL=$(shell find . -name '*.o') +LIBNAME=libsandbox +LIB_MINOR_VERS=0.0 +LIB_MAJOR_VERS=1 +LIB_VERS=$(LIB_MAJOR_VERS).$(LIB_MINOR_VERS) +LIB_FULL_NAME=$(LIBNAME).so.$(LIB_VERS) +path=$(shell pwd) +ld_libs=$(shell echo $$LD_LIBRARY_PATH) all: - $(MAKE) -C lib + $(MAKE) -C src $(MAKE) build -C . $(MAKE) pack -C . +# $(MAKE) link -C . build: $(OBJS) %.o: %.cpp - g++ -c $(CFLAGS) $(OPENCVFLAG) $< -o $@ + $(CCP) -c $(CFLAGS) $< -o $@ -# manque tout les autres fichiers .o pack: - gcc -shared $(OBJSALL) $(CFLAGS) $(OPENCVFLAG) -lrealsense2 -o ./libsandbox.so + gcc -shared -Wl,-soname,$(LIB_FULL_NAME) $(OBJSALL) -o $(LIB_FULL_NAME) + +link: + -ln -s $(LIB_FULL_NAME) $(LIBNAME).so.$(LIB_MAJOR_VERS) + -ln -s $(LIB_FULL_NAME) $(LIBNAME).so clean: - -rm -f *.o *.so - $(MAKE) clean -C lib + -rm -f *.o *.so* + $(MAKE) clean -C src diff --git a/export.sh b/export.sh new file mode 100644 index 0000000000000000000000000000000000000000..3a1d7cc5c8cf4d8df9d7b1f7e33fa7bf60f7e870 --- /dev/null +++ b/export.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +export LD_LIBRARY_PATH=$(pwd) && \ +make link diff --git a/lib/components/beamer.h b/includes/beamer.h similarity index 99% rename from lib/components/beamer.h rename to includes/beamer.h index 0a5f4ca36a3e9bb53095fe40ead9b01aa74bdebc..6d24dab804af61668cea571817f463bcfd69a240 100644 --- a/lib/components/beamer.h +++ b/includes/beamer.h @@ -2,6 +2,7 @@ #define BEAMER_H #include <opencv2/opencv.hpp> #include "camera.h" + class Beamer { diff --git a/lib/tools/borderedit.h b/includes/borderedit.h similarity index 100% rename from lib/tools/borderedit.h rename to includes/borderedit.h diff --git a/lib/tools/borderfinder.h b/includes/borderfinder.h similarity index 100% rename from lib/tools/borderfinder.h rename to includes/borderfinder.h diff --git a/lib/components/calibrate.h b/includes/calibrate.h similarity index 100% rename from lib/components/calibrate.h rename to includes/calibrate.h diff --git a/lib/components/camera.h b/includes/camera.h similarity index 100% rename from lib/components/camera.h rename to includes/camera.h diff --git a/lib/controller.h b/includes/controller.h similarity index 87% rename from lib/controller.h rename to includes/controller.h index 0c87a9fc02655042bcd6a5c77ebe14cd97ed4b46..b37c8f01adc6134107498936c7f0b1c8e74bb1e6 100644 --- a/lib/controller.h +++ b/includes/controller.h @@ -1,13 +1,15 @@ #ifndef CONTROLLER_H #define CONTROLLER_H -#include "./components/camera.h" -#include "./components/calibrate.h" -#include "./components/beamer.h" -#include "./tools/borderedit.h" -#include "./tools/borderfinder.h" +#include <opencv2/opencv.hpp> +#include "camera.h" +#include "calibrate.h" +#include "beamer.h" +#include "borderedit.h" +#include "borderfinder.h" -class Controller{ +class Controller +{ public: Controller(); cv::Mat getRGBFrame(); @@ -42,4 +44,4 @@ class Controller{ }; -#endif \ No newline at end of file +#endif diff --git a/lib/tools/log.h b/includes/log.h similarity index 100% rename from lib/tools/log.h rename to includes/log.h diff --git a/sandbox.h b/includes/sandbox.h similarity index 74% rename from sandbox.h rename to includes/sandbox.h index ca8cfce79287f3474f84890c7f2d07e5fb86baeb..6e13e8364e3509cbba053d8abc5463d6869bda70 100644 --- a/sandbox.h +++ b/includes/sandbox.h @@ -1,9 +1,11 @@ #ifndef SANDBOX_H #define SANDBOX_H -#include "./lib/controller.h" +#include <opencv2/opencv.hpp> +#include "controller.h" -class Sandbox{ +class Sandbox +{ public: Sandbox(); cv::Mat getRGBFrame(); @@ -13,4 +15,4 @@ class Sandbox{ private: Controller controller; }; -#endif \ No newline at end of file +#endif diff --git a/sandbox_setup.h b/includes/sandbox_setup.h similarity index 100% rename from sandbox_setup.h rename to includes/sandbox_setup.h diff --git a/sandbox.cpp b/sandbox.cpp index cf2a7db74ebfb7fa0fa1ac8430f37b6b3cb1e106..48d31dab64b7eae75b0702dfac14477e32d35c30 100644 --- a/sandbox.cpp +++ b/sandbox.cpp @@ -1,4 +1,4 @@ -#include "./sandbox.h" +#include "includes/sandbox.h" Sandbox::Sandbox(){ //controller = Controller(); diff --git a/lib/Makefile b/src/Makefile similarity index 85% rename from lib/Makefile rename to src/Makefile index c6661fd568248a27f4bee27789caf8f6060cc85e..4e098e6b88e68789b2e6f61215bd1e04ddb874e9 100644 --- a/lib/Makefile +++ b/src/Makefile @@ -11,7 +11,7 @@ all: build: $(OBJS) %.o: %.cpp - g++ $(CFLAGS) $(OPENCVFLAG) -c $< -o $@ + g++ $(CFLAGS) -c $< -o $@ clean: -rm -f *.o diff --git a/lib/common.mk b/src/common.mk similarity index 74% rename from lib/common.mk rename to src/common.mk index 07b1dcb2520ef69aa5f98a0c020300596ee49d56..dab528a8f90bc07db54e163df53bb33361a28683 100644 --- a/lib/common.mk +++ b/src/common.mk @@ -1,2 +1,4 @@ +CCP=g++ CFLAGS=-std=c++11 -Wall -Wextra -g -Ilib -fPIC OPENCVFLAG=`pkg-config --libs --cflags opencv` +CAMERAFLAG=-lrealsense2 diff --git a/lib/components/Makefile b/src/components/Makefile similarity index 88% rename from lib/components/Makefile rename to src/components/Makefile index bc1883404393c21a58d3da7d8e5ff03ec740c50b..579a1bfcfad079005403fb20689ef095b0301cd2 100644 --- a/lib/components/Makefile +++ b/src/components/Makefile @@ -6,7 +6,7 @@ CAMERAFLAG=-lrealsense2 build: $(OBJS) -camera.o: camera.cpp camera.h +camera.o: camera.cpp g++ -c $(CFLAGS) $(OPENCVFLAG) $(CAMERAFLAG) $< -o $@ %.o: %.cpp diff --git a/lib/components/beamer.cpp b/src/components/beamer.cpp similarity index 99% rename from lib/components/beamer.cpp rename to src/components/beamer.cpp index cccc64cf9364166da3e192211e90445a68874f9c..d953e6c3dd040aea0e37fa0f04b4734d3c292a49 100644 --- a/lib/components/beamer.cpp +++ b/src/components/beamer.cpp @@ -1,4 +1,4 @@ -#include "beamer.h" +#include "../../includes/beamer.h" using namespace cv; using namespace std; diff --git a/lib/components/calibrate.cpp b/src/components/calibrate.cpp similarity index 97% rename from lib/components/calibrate.cpp rename to src/components/calibrate.cpp index 19f017aaaf72401266d33c54a098881a4665152f..3b5935fae76af3a5ac11d1443c1a1c12a44ebd70 100644 --- a/lib/components/calibrate.cpp +++ b/src/components/calibrate.cpp @@ -1,5 +1,5 @@ -#include "calibrate.h" -#include "camera.h" +#include "../../includes/calibrate.h" +#include "../../includes/camera.h" using namespace cv; using namespace std; diff --git a/lib/components/camera.cpp b/src/components/camera.cpp similarity index 99% rename from lib/components/camera.cpp rename to src/components/camera.cpp index ad64a815a9a7d6e34a1eedab1cf04bc0ae35b3e1..423fae0ba754f09cbc02059f070497c0085efa54 100644 --- a/lib/components/camera.cpp +++ b/src/components/camera.cpp @@ -1,4 +1,4 @@ -#include "camera.h" +#include "../../includes/camera.h" using namespace cv; Camera::Camera() {} diff --git a/lib/controller.cpp b/src/controller.cpp similarity index 99% rename from lib/controller.cpp rename to src/controller.cpp index 189acf08ad0cf20efecd2299edbee16bd6ec9fd3..1a9e6bb41b1289d36d70cde276602bbece4551e2 100644 --- a/lib/controller.cpp +++ b/src/controller.cpp @@ -1,4 +1,4 @@ -#include "./controller.h" +#include "../includes/controller.h" #include <numeric> #include <fstream> #include <string> diff --git a/lib/tools/Makefile b/src/tools/Makefile similarity index 100% rename from lib/tools/Makefile rename to src/tools/Makefile diff --git a/lib/tools/borderedit.cpp b/src/tools/borderedit.cpp similarity index 98% rename from lib/tools/borderedit.cpp rename to src/tools/borderedit.cpp index 0d14066cdcdc652c49773f4a9ad7f5c7f577e510..0dba3fcb46409162f493ab1d53e0b2a2f10124bc 100644 --- a/lib/tools/borderedit.cpp +++ b/src/tools/borderedit.cpp @@ -1,5 +1,5 @@ #include <algorithm> -#include "borderedit.h" +#include "../../includes/borderedit.h" using namespace std; using namespace cv; diff --git a/lib/tools/borderfinder.cpp b/src/tools/borderfinder.cpp similarity index 98% rename from lib/tools/borderfinder.cpp rename to src/tools/borderfinder.cpp index bede0052e914c531b84eadd654b793099adbd389..ba800000ba760434250d39c33cbd98ab6f4c602f 100644 --- a/lib/tools/borderfinder.cpp +++ b/src/tools/borderfinder.cpp @@ -1,5 +1,5 @@ #include <algorithm> -#include "borderfinder.h" +#include "../../includes/borderfinder.h" using namespace std; using namespace cv; diff --git a/lib/tools/log.c b/src/tools/log.c similarity index 97% rename from lib/tools/log.c rename to src/tools/log.c index daa9e51722474402e756cda6f24d9a5c9f793c5b..6c7cab54967cf5b899ccad02764e62f0644b4b07 100644 --- a/lib/tools/log.c +++ b/src/tools/log.c @@ -3,7 +3,7 @@ #include <unistd.h> #include <strings.h> #include <stdarg.h> -#include "log.h" +#include "../../includes/log.h"