From 738ce8df7d7092036b852d265e48247da235f871 Mon Sep 17 00:00:00 2001 From: MarianoJT88 Date: Fri, 16 Jan 2015 10:12:35 +0100 Subject: [PATCH] Working on compatibility Windows - Linux --- CMakeLists.txt | 19 ++++++++++++------- main_scene_flow_impair.cpp | 3 +-- main_scene_flow_visualization.cpp | 7 ++++--- scene_flow_impair.h | 21 +++++++++++++-------- scene_flow_visualization.h | 12 ++++++++---- 5 files changed, 38 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f2d0206..b681018 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ set(CUDA_NVCC_FLAGS "-arch=sm_20") #Build scene flow CUDA lib CUDA_ADD_LIBRARY(pdflow_cudalib pdflow_cudalib.h pdflow_cudalib.cu) -#message( ${CUDA_LIBRARIES} ) + SET(DEFAULT_BUILD_EVALUATOR ON) SET(BUILD_EVALUATOR ${DEFAULT_BUILD_EVALUATOR} CACHE BOOL "Build the scene flow evaluator for a RGB-D frame pair that uses OpenCV") @@ -32,17 +32,22 @@ IF (BUILD_EVALUATOR) ENDIF (BUILD_EVALUATOR) SET(DEFAULT_BUILD_RT_VISUALIZATION ON) -SET(BUILD_RT_VISUALIZATION ${DEFAULT_BUILD_RT_VISUALIZATION} CACHE BOOL "Build the scene flow estimator with real-time visualization that uses MRPT and OpenNI2") +SET(BUILD_RT_VISUALIZATION ${DEFAULT_BUILD_RT_VISUALIZATION} CACHE BOOL "Build the scene flow estimator with real-time visualization that requires MRPT and OpenNI2") IF (BUILD_RT_VISUALIZATION) FIND_PACKAGE(MRPT REQUIRED base gui opengl) - INCLUDE_DIRECTORIES($ENV{OPENNI2_INCLUDE}) - LINK_DIRECTORIES($ENV{OPENNI2_LIB}) - SET(OpenNI_lib "/usr/lib/libOpenNI2.so") - #SET(OpenNI_lib "C:/Users/Mariano/Programas/OpenNI2_32/Lib/OpenNI2.lib") + IF (WIN32) + INCLUDE_DIRECTORIES($ENV{OPENNI2_INCLUDE}) + LINK_DIRECTORIES($ENV{OPENNI2_LIB}) + SET(OpenNI_lib "$ENV{OPENNI2_LIB}/OpenNI2.lib") + ENDIF (WIN32) + + IF (UNIX) + SET(OpenNI_lib "/usr/lib/libOpenNI2.so") + ENDIF (UNIX) - #message( "jajaj y esto vale ${OPENNI2_INCLUDE}" ) + message( "esto vale ${OpenNI_lib}" ) ADD_EXECUTABLE(Scene-Flow-Visualization main_scene_flow_visualization.cpp diff --git a/main_scene_flow_impair.cpp b/main_scene_flow_impair.cpp index e0b0c82..ef73623 100644 --- a/main_scene_flow_impair.cpp +++ b/main_scene_flow_impair.cpp @@ -54,8 +54,7 @@ int main(int num_arg, char *argv[]) else { if ( string(argv[1]) == "--rows") - //Windows -> rows = stof(string(argv[2])); - rows = strtof(argv[2], NULL); + rows = stoi(argv[2], NULL); } //============================================================================== diff --git a/main_scene_flow_visualization.cpp b/main_scene_flow_visualization.cpp index 907bf0b..be1fab7 100644 --- a/main_scene_flow_visualization.cpp +++ b/main_scene_flow_visualization.cpp @@ -58,13 +58,14 @@ int main(int num_arg, char *argv[]) for (int i=1; i #include +#if BUILD_PLATFORM == WINDOWS_BUILD +#include +#include +#elif BUILD_PLATFORM == LINUX_BUILD #include -//Windows -> #include #include +#endif + #include "pdflow_cudalib.h" #include "legend_pdflow.xpm" #include -//Windows -> #define M_PI 3.14159265f -//Windows -> #define M_LOG2E 1.44269504088896340736f //log2(e) -//Windows -//inline float log2(const float x){ -// return log(x) * M_LOG2E; -//} +#if BUILD_PLATFORM == WINDOWS_BUILD + +#define M_PI 3.14159265f +#define M_LOG2E 1.44269504088896340736f //log2(e) +inline float log2(const float x){ return log(x) * M_LOG2E; } + +#endif class PD_flow_opencv { diff --git a/scene_flow_visualization.h b/scene_flow_visualization.h index fc5de32..2783e43 100644 --- a/scene_flow_visualization.h +++ b/scene_flow_visualization.h @@ -25,17 +25,21 @@ #include #include #include -//Windows #include +#if BUILD_PLATFORM == WINDOWS_BUILD +#include +#elif BUILD_PLATFORM == LINUX_BUILD #include +#endif #include #include "pdflow_cudalib.h" #include "legend_pdflow.xpm" +#if BUILD_PLATFORM == WINDOWS_BUILD + //#define M_LOG2E 1.44269504088896340736f //log2(e) +inline float log2(const float x){ return log(x) * M_LOG2E; } -//inline float log2(const float x){ -// return log(x) * M_LOG2E; -//} +#endif using namespace mrpt;