Re: WIN32 compilation issues patch

Jorge Santos Simón <[email protected]>
Newsgroups gmane.science.robotics.playerstage
Message-ID <[email protected]>
Hi all,

I have regenerated the patch with your suggestions:
-#define SIGQUIT 3

replaced by

+#ifdef SIGINT
  signal(SIGINT, sig_quit);
+#endif
+#ifdef SIGQUIT
  signal(SIGQUIT, sig_quit);
+#endif

And an extra include on pmap.cc to avoid the precomp. option _USE_MATH_DEFINES
I have uploaded it on the project patch tracker (2993776)

I attach also the opencv.pc file I use. It is the one contained in the
unix-install directory,
generated by CMake. It contains windows-like paths, so my pkg-config
executable for
windows (the one packaged with GTK+) has no problems.

I hope this will help. Let me know what linkage problems you have.
Maybe I can help.

If you want, I can send you the list of tweaks I have made to compile
all the stuff.

The big idea, I think, is to reduce at minimum the tweaks required to
compile on Windows,
but I should learn CMake to succeed in the task.

Best regards,
Jorge


> If you use pykg-config, you shouldn't have any problems with paths if
> you use /. It also handles things like spaces properly on Windows.
>
> http://github.com/gbiggs/pykg-config
>
> If you have problems using it, please file a bug. :)
>
> Geoff

On 28/04/2010 4:40 a.m., Paul Osmialowski wrote:


> >> I have managed to include OpenCV; it's not so tricky. The steps are:
> >>
> >> * Configure + generate OpenCV with CMake to obtain the opencv.pc file
> >
> > Well, I tried to write my own opencv.pc file for downloaded OpenCV
> > binaries (library with installer), I couldn't figure out how to manage
> > with different path notations in two worlds (Windows vs pkgconfig taken
> > directly from Unix). Also I had some link-time issues, I don't remember
> > now.
> >
> > Can you put your complete patch on a patch tracker for Player project?
> >
> > Paul

------------------------------------------------------------------------------

_______________________________________________
Playerstage-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-developers
win32_compilation_issues.patch (application/octet-stream, 9.3 KB)
Index: libplayerinterface/addr_util.c
===================================================================
--- libplayerinterface/addr_util.c	(revision 8631)
+++ libplayerinterface/addr_util.c	(working copy)
@@ -43,7 +43,7 @@
 #include <assert.h>
 #include <sys/types.h>
 #if defined WIN32
-  #include <Winsock2.h>
+  #include <winsock2.h>
   #define snprintf _snprintf
 #else
   #include <unistd.h>
Index: rtk2/rtk.c
===================================================================
--- rtk2/rtk.c	(revision 8631)
+++ rtk2/rtk.c	(working copy)
@@ -39,7 +39,6 @@
 #include "avcodec.h"
 #endif
 
-//#define DEBUG
 #include "rtk.h"
 #include "rtkprivate.h"
 
@@ -192,7 +191,7 @@
 // Event processing function.  Returns non-zero if the app should quit.
 int rtk_app_main_loop(rtk_app_t *app)
 {
-  int ret;
+  int ret = 0;
   rtk_canvas_t *canvas;
   rtk_table_t *table;
   
Index: rtk2/rtk_fig.c
===================================================================
--- rtk2/rtk_fig.c	(revision 8631)
+++ rtk2/rtk_fig.c	(working copy)
@@ -38,6 +38,10 @@
 #include "rtk.h"
 #include "rtkprivate.h"
 
+#ifndef M_PI
+	#define M_PI 3.14159265358979323846
+#endif
+
 // Draw the selection
 void rtk_fig_render_selection(rtk_fig_t *fig);
 
Index: server/drivers/camera/imageseq/imageseq.cc
===================================================================
--- server/drivers/camera/imageseq/imageseq.cc	(revision 8631)
+++ server/drivers/camera/imageseq/imageseq.cc	(working copy)
@@ -86,19 +86,19 @@
 /** @} */
 
 #include <string.h>
-#include <stdlib.h>
 #include <stddef.h>
 #ifndef WIN32
-#include <unistd.h>
+  #include <unistd.h>
 #endif
 #include <time.h>         // for nanosleep() and struct timespec
 #include <stdlib.h>       // for atoi(3)
 #include <math.h>
 
+#include <libplayercore/playercore.h>
+
 #include <cv.h>
 #include <highgui.h>
 
-#include <libplayercore/playercore.h>
 
 class ImageSeq : public ThreadedDriver
 {
Index: server/drivers/mixed/mricp/include/Timer.h
===================================================================
--- server/drivers/mixed/mricp/include/Timer.h	(revision 8631)
+++ server/drivers/mixed/mricp/include/Timer.h	(working copy)
@@ -20,8 +20,15 @@
 
 #ifndef TIMER_H_
 #define TIMER_H_
-#include <sys/time.h>
+
+#if defined WIN32
+  #include <replace.h>
+  #include <Winsock2.h>  // For struct timeval
+#else
+  #include <sys/time.h>
+#endif
 #include <iostream>
+
 class Timer
 {
 	private:
Index: server/drivers/mixed/mricp/src/map.cpp
===================================================================
--- server/drivers/mixed/mricp/src/map.cpp	(revision 8631)
+++ server/drivers/mixed/mricp/src/map.cpp	(working copy)
@@ -24,6 +24,9 @@
 #include <iostream>
 using namespace std;
 
+#if defined WIN32
+  #define snprintf _snprintf
+#endif
 
 MAP::MAP(char * Mapname, double pixel_size, double map_size)
 {
Index: server/drivers/mixed/mricp/src/mricp_driver.cpp
===================================================================
--- server/drivers/mixed/mricp/src/mricp_driver.cpp	(revision 8631)
+++ server/drivers/mixed/mricp/src/mricp_driver.cpp	(working copy)
@@ -31,11 +31,16 @@
 #include <config.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/time.h>
+#if defined WIN32
+  #define snprintf _snprintf
+#else
+  #include <unistd.h>
+  #include <sys/time.h>
+  #include <termios.h>
+  #include <netinet/in.h>
+#endif
 #include <fcntl.h>
-#include <termios.h>
 #include <cstdio>
-#include <unistd.h>
 #include <cstdlib>
 #include <cstddef>
 #include <cerrno>
@@ -47,7 +52,6 @@
 #include <iostream>
 #include <csignal>
 #include <vector>
-#include <netinet/in.h>
 // Player includes
 #include <libplayercore/playercore.h>
 
Index: server/drivers/planner/wavefront/wavefront.cc
===================================================================
--- server/drivers/planner/wavefront/wavefront.cc	(revision 8631)
+++ server/drivers/planner/wavefront/wavefront.cc	(working copy)
@@ -215,16 +215,18 @@
 #include <string.h>
 #include <stddef.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <assert.h>
 #include <math.h>
 
+#ifndef WIN32
+  #include <unistd.h>
+  #include <sys/time.h>
+#endif
 
 #include <libplayercore/playercore.h>
 #include <libplayerinterface/functiontable.h>
 #include "plan.h"
 
-#include <sys/time.h>
 static double get_time(void);
 //extern "C" { void draw_cspace(plan_t* plan, const char* fname); }
 
Index: utils/playercam/playercam.c
===================================================================
--- utils/playercam/playercam.c	(revision 8631)
+++ utils/playercam/playercam.c	(working copy)
@@ -78,9 +78,15 @@
 
 #include "config.h"
 
-#include <stdint.h>
+#if defined WIN32
+  #include <replace.h>
+  #define strcasecmp _stricmp
+#else
+  #include <stdint.h>
+  #include <unistd.h>
+#endif
+
 #include <assert.h>
-#include <unistd.h>
 #include <math.h>
 #include <string.h>
 #include <stdlib.h>
Index: utils/playernav/gui.c
===================================================================
--- utils/playernav/gui.c	(revision 8631)
+++ utils/playernav/gui.c	(working copy)
@@ -21,7 +21,12 @@
  */
 
 #include <math.h>
-#include <sys/time.h>
+#if defined WIN32
+  #define PATH_MAX 260
+  #define snprintf _snprintf
+#else
+  #include <sys/time.h>
+#endif
 
 #include <gdk/gdkkeysyms.h>
 
Index: utils/playernav/playernav.c
===================================================================
--- utils/playernav/playernav.c	(revision 8631)
+++ utils/playernav/playernav.c	(working copy)
@@ -134,7 +134,9 @@
 #include <signal.h>
 #include <string.h>
 #include <math.h>
-#include <sys/time.h>
+#ifndef WIN32
+  #include <sys/time.h>
+#endif
 
 #include "playernav.h"
 
Index: utils/playerv/opt.h
===================================================================
--- utils/playerv/opt.h	(revision 8631)
+++ utils/playerv/opt.h	(working copy)
@@ -27,6 +27,9 @@
 #ifndef OPT_H
 #define OPT_H
 
+#if defined WIN32
+  #define snprintf _snprintf
+#endif
 
 // Structure describing a single option.
 // This structure is opaque.
Index: utils/playerv/playerv.c
===================================================================
--- utils/playerv/playerv.c	(revision 8631)
+++ utils/playerv/playerv.c	(working copy)
@@ -120,8 +120,12 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <time.h>
+#if defined WIN32
+  #include <replace.h>
+#else
+  #include <unistd.h>
+#endif
 #include "playerv.h"
 
 #define GUI_UPDATE_RATE 20.0
@@ -175,8 +179,12 @@
   rtk_init(&argc, &argv);
 
   // Register signal handlers
+#ifdef SIGINT
   signal(SIGINT, sig_quit);
+#endif
+#ifdef SIGQUIT
   signal(SIGQUIT, sig_quit);
+#endif
 
   // Load program options
   opt = opt_init(argc, argv, NULL);
Index: utils/playerv/pv_dev_map.c
===================================================================
--- utils/playerv/pv_dev_map.c	(revision 8631)
+++ utils/playerv/pv_dev_map.c	(working copy)
@@ -27,6 +27,9 @@
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
+#if defined WIN32
+  #include <replace.h>
+#endif
 #include "playerv.h"
 
 
@@ -159,20 +162,21 @@
 
   for( x=0; x<map->proxy->width; x++ )
     for( y=0; y<map->proxy->height; y++ )
+    {
+	  int8_t val = map->proxy->cells[ x + y * map->proxy->width ];
+      if (val != 0)
       {
-	int8_t val = map->proxy->cells[ x + y * map->proxy->width ];
-	if (val == 0)
-	  continue;
-	double color = (double)val/map->proxy->data_range; // scale to[-1,1]
-	color *= -1; //flip sign for coloring occupied to black
-	color = (color+1)/2.0; // scale to [0,1]
-	rtk_fig_color(map->fig, color, color, color );
-	rtk_fig_rectangle(map->fig,
-			  (x - map->proxy->width/2.0) * scale + scale/2.0,
-			  (y - map->proxy->height/2.0) * scale + scale/2.0,
-			  0,
-			  scale, scale, 1);
+        double color = (double)val/map->proxy->data_range; // scale to[-1,1]
+        color *= -1; //flip sign for coloring occupied to black
+        color = (color+1)/2.0; // scale to [0,1]
+        rtk_fig_color(map->fig, color, color, color );
+        rtk_fig_rectangle(map->fig,
+		                  (x - map->proxy->width/2.0) * scale + scale/2.0,
+		                  (y - map->proxy->height/2.0) * scale + scale/2.0,
+		                  0,
+		                  scale, scale, 1);
       }
+    }
 
   return;
 }
Index: utils/pmap/lodo_driver.cc
===================================================================
--- utils/pmap/lodo_driver.cc	(revision 8631)
+++ utils/pmap/lodo_driver.cc	(working copy)
@@ -146,9 +146,11 @@
 
 */
 
-#include <unistd.h>
 #include <string.h>
-#include <netinet/in.h>
+#ifndef WIN32
+  #include <unistd.h>
+  #include <netinet/in.h>
+#endif
 
 #include <libplayercore/playercore.h>
 
Index: utils/pmap/pmap.cpp
===================================================================
--- utils/pmap/pmap.cpp	(revision 8631)
+++ utils/pmap/pmap.cpp	(working copy)
@@ -30,6 +30,7 @@
 #include <float.h>
 #if defined (WIN32)
   #define finite _finite
+  #include <gsl/gsl_math.h>
 #endif
 #include <stdlib.h>
 #include <stdio.h>
Index: utils/pmap/slap.cpp
===================================================================
--- utils/pmap/slap.cpp	(revision 8631)
+++ utils/pmap/slap.cpp	(working copy)
@@ -27,6 +27,10 @@
 #include <math.h>
 #include "slap.h"
 
+#if defined WIN32
+  #include <float.h>
+  #define isnan _isnan
+#endif
 
 /* Set vector elements. */
 vector2_t vector2_set(double v0, double v1)
opencv.pc (application/octet-stream, 342 B) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.