summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Corgan <nick.corgan@ettus.com>2013-04-03 12:17:47 -0700
committerNicholas Corgan <nick.corgan@ettus.com>2013-04-03 12:17:47 -0700
commiteb0aa7805889285cbc3d040bc8965f1b54ecc19e (patch)
treeebdc766baa538db932227566b9b584f476c5dc74
parenta332967df614828863684fa93005067ddc1ae877 (diff)
runtime: Windows MSVC compatibility fixes
* pmt_EXPORTS changed to gnuradio_runtime_EXPORTS * WinSock2 used when appropriate * Class definition syntax * Explicit including of ICE_INCLUDE_DIR
-rw-r--r--gnuradio-runtime/ConfigChecks.cmake8
-rw-r--r--gnuradio-runtime/include/gr_logger.h4
-rw-r--r--gnuradio-runtime/include/ice_application_base.h13
-rw-r--r--gnuradio-runtime/include/pmt/api.h2
-rw-r--r--gnuradio-runtime/include/rpcmanager.h4
-rw-r--r--gnuradio-runtime/lib/CMakeLists.txt10
6 files changed, 29 insertions, 12 deletions
diff --git a/gnuradio-runtime/ConfigChecks.cmake b/gnuradio-runtime/ConfigChecks.cmake
index e6c97bada4..46e15b5051 100644
--- a/gnuradio-runtime/ConfigChecks.cmake
+++ b/gnuradio-runtime/ConfigChecks.cmake
@@ -154,14 +154,6 @@ CHECK_CXX_SOURCE_COMPILES("
GR_ADD_COND_DEF(HAVE_CREATEFILEMAPPING)
########################################################################
-CHECK_INCLUDE_FILE_CXX(windows.h HAVE_WINDOWS_H)
-IF(HAVE_WINDOWS_H)
- ADD_DEFINITIONS(-DHAVE_WINDOWS_H -DUSING_WINSOCK)
- MESSAGE(STATUS "Adding windows libs to gnuradio core libs...")
- LIST(APPEND gnuradio_core_libs WS2_32.lib WSock32.lib)
-ENDIF(HAVE_WINDOWS_H)
-
-########################################################################
SET(CMAKE_REQUIRED_LIBRARIES -lrt)
CHECK_CXX_SOURCE_COMPILES("
#include <sys/types.h>
diff --git a/gnuradio-runtime/include/gr_logger.h b/gnuradio-runtime/include/gr_logger.h
index 2c1ee8d8ad..0e82c5134e 100644
--- a/gnuradio-runtime/include/gr_logger.h
+++ b/gnuradio-runtime/include/gr_logger.h
@@ -43,6 +43,10 @@
#include <boost/thread.hpp>
#include <boost/format.hpp>
+#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+typedef int mode_t;
+#endif
+
#ifdef ENABLE_GR_LOG
// We have three configurations... first logging to stdout/stderr
diff --git a/gnuradio-runtime/include/ice_application_base.h b/gnuradio-runtime/include/ice_application_base.h
index f25c7272fc..64ec615e5c 100644
--- a/gnuradio-runtime/include/ice_application_base.h
+++ b/gnuradio-runtime/include/ice_application_base.h
@@ -23,6 +23,11 @@
#ifndef ICE_APPLICATION_BASE_H
#define ICE_APPLICATION_BASE_H
+#ifdef HAVE_WINDOWS_H
+#include <winsock2.h>
+#include <sys/time.h>
+#endif
+
#include <gr_runtime_api.h>
#include <gr_prefs.h>
#include <Ice/Ice.h>
@@ -38,7 +43,6 @@ namespace {
static const unsigned int ICEAPPLICATION_ACTIVATION_TIMEOUT_MS(600);
};
-
class GR_RUNTIME_API ice_application_common : public Ice::Application
{
public:
@@ -48,7 +52,8 @@ class GR_RUNTIME_API ice_application_common : public Ice::Application
static int d_reacquire_attributes;
protected:
- static bool d_main_called, d_have_ice_config;
+ static bool d_main_called;
+ static bool d_have_ice_config;
static std::string d_endpointStr;
static boost::shared_ptr<boost::thread> d_thread;
ice_application_common() {;}
@@ -147,7 +152,11 @@ void ice_application_base<TserverBase, TserverClass>::kickoff()
int iter = 0;
while(!d_this->application_started()) {
+ #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+ ::Sleep(timer_ts.tv_nsec / 1000000);
+ #else
::nanosleep(&timer_ts, &rem_ts);
+ #endif
if(!d_this->application_started())
std::cout << "@";
if(iter++ > 100) {
diff --git a/gnuradio-runtime/include/pmt/api.h b/gnuradio-runtime/include/pmt/api.h
index 5dcc8a84a5..2deba0a2d7 100644
--- a/gnuradio-runtime/include/pmt/api.h
+++ b/gnuradio-runtime/include/pmt/api.h
@@ -24,7 +24,7 @@
#include <attributes.h>
-#ifdef pmt_EXPORTS
+#ifdef gnuradio_runtime_EXPORTS
# define PMT_API __GR_ATTR_EXPORT
#else
# define PMT_API __GR_ATTR_IMPORT
diff --git a/gnuradio-runtime/include/rpcmanager.h b/gnuradio-runtime/include/rpcmanager.h
index 6e1e181c3c..6a385c8998 100644
--- a/gnuradio-runtime/include/rpcmanager.h
+++ b/gnuradio-runtime/include/rpcmanager.h
@@ -50,7 +50,9 @@ class GR_RUNTIME_API rpcmanager : public virtual rpcmanager_base
};
private:
- static bool make_aggregator, booter_registered, aggregator_registered;
+ static bool make_aggregator;
+ static bool booter_registered;
+ static bool aggregator_registered;
static void rpcserver_booter_base_sptr_dest( rpcserver_booter_base* b) {;}
static rpcserver_booter_base* boot;
static std::auto_ptr<rpcserver_booter_aggregator> aggregator;
diff --git a/gnuradio-runtime/lib/CMakeLists.txt b/gnuradio-runtime/lib/CMakeLists.txt
index 429a5a2825..f97abd7481 100644
--- a/gnuradio-runtime/lib/CMakeLists.txt
+++ b/gnuradio-runtime/lib/CMakeLists.txt
@@ -140,6 +140,14 @@ list(APPEND gnuradio_runtime_libs
${LOG4CPP_LIBRARIES}
)
+#Add libraries for winsock2.h on Windows
+CHECK_INCLUDE_FILE_CXX(windows.h HAVE_WINDOWS_H)
+IF(HAVE_WINDOWS_H)
+ ADD_DEFINITIONS(-DHAVE_WINDOWS_H -DUSING_WINSOCK -DWIN32_LEAN_AND_MEAN)
+ MESSAGE(STATUS "Adding windows libs to gnuradio runtime libs...")
+ LIST(APPEND gnuradio_runtime_libs WS2_32.lib WSock32.lib)
+ENDIF(HAVE_WINDOWS_H)
+
#need to link with librt on ubuntu 11.10 for shm_*
if(LINUX)
list(APPEND gnuradio_runtime_libs rt)
@@ -147,6 +155,8 @@ endif()
if(ENABLE_GR_CTRLPORT)
+include_directories(${ICE_INCLUDE_DIR})
+
# Add definition so we can compile in ControlPort to the blocks.
ADD_DEFINITIONS(-DGR_CTRLPORT)