From 72927d983f1f84127e83bf2d80db6b8ee882bad7 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 26 Mar 2010 15:56:04 -0800 Subject: library loading on windows, status message tweaks, warning tweaks --- host/CMakeLists.txt | 2 +- host/include/uhd/config.hpp | 9 ++++++++- host/lib/CMakeLists.txt | 20 ++++++++++++-------- host/lib/load_modules.cpp | 4 ++-- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index 148ba2d00..05d782abe 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -64,10 +64,10 @@ IF(UNIX) ENDIF(UNIX) IF(WIN32) - ADD_DEFINITIONS(-Dnot=! -Dand=&& -Dor=||) #logical operators ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501) #minimum version required is windows xp ADD_DEFINITIONS(-DNOMINMAX) #disables stupidity and enables std::min and std::max ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS) #avoid warnings from boost::split + ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) #avoid warnings from std::getenv ADD_DEFINITIONS(-DBOOST_ALL_DYN_LINK) #setup boost auto-linking in msvc ENDIF(WIN32) diff --git a/host/include/uhd/config.hpp b/host/include/uhd/config.hpp index 10f9c093f..8e30a8333 100644 --- a/host/include/uhd/config.hpp +++ b/host/include/uhd/config.hpp @@ -35,8 +35,15 @@ # pragma warning(disable: 4275) // non dll-interface class ... used as base for dll-interface class ... //# pragma warning(disable: 4267) // 'var' : conversion from 'size_t' to 'type', possible loss of data //# pragma warning(disable: 4511) // 'class' : copy constructor could not be generated -#endif +#endif +//define logical operators +#ifdef BOOST_MSVC + #define not ! + #define and && + #define or || +#endif + // http://gcc.gnu.org/wiki/Visibility // Generic helper definitions for shared library support #if defined _WIN32 || defined __CYGWIN__ diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index 4dd638336..a0bfd6d0a 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -60,31 +60,35 @@ LIST(APPEND libuhd_sources ######################################################################## # Setup defines for module loading ######################################################################## +MESSAGE(STATUS "Configuring module loading...") + INCLUDE(CheckIncludeFileCXX) CHECK_INCLUDE_FILE_CXX(dlfcn.h HAVE_DLFCN_H) -CHECK_INCLUDE_FILE_CXX(Winbase.h HAVE_WINBASE_H) +CHECK_INCLUDE_FILE_CXX(Windows.h HAVE_WINDOWS_H) IF(HAVE_DLFCN_H) - MESSAGE(STATUS "Module loading supported through dlopen...") + MESSAGE(STATUS " Module loading supported through dlopen.") ADD_DEFINITIONS(-DHAVE_DLFCN_H) -ELSEIF(HAVE_WINBASE_H) - MESSAGE(STATUS "Module loading supported through LoadLibrary...") - ADD_DEFINITIONS(-DHAVE_WINBASE_H) +ELSEIF(HAVE_WINDOWS_H) + MESSAGE(STATUS " Module loading supported through LoadLibrary.") + ADD_DEFINITIONS(-DHAVE_WINDOWS_H) ELSE(HAVE_DLFCN_H) - MESSAGE(STATUS "Module loading not supported...") + MESSAGE(STATUS " Module loading not supported.") ENDIF(HAVE_DLFCN_H) ######################################################################## # Setup defines for interface address discovery ######################################################################## +MESSAGE(STATUS "Configuring interface address discovery...") + INCLUDE(CheckIncludeFileCXX) CHECK_INCLUDE_FILE_CXX(ifaddrs.h HAVE_IFADDRS_H) IF(HAVE_IFADDRS_H) - MESSAGE(STATUS "Interface address discovery supported through getifaddrs...") + MESSAGE(STATUS " Interface address discovery supported through getifaddrs.") ADD_DEFINITIONS(-DHAVE_IFADDRS_H) ELSE(HAVE_IFADDRS_H) - MESSAGE(STATUS "Interface address discovery not supported...") + MESSAGE(STATUS " Interface address discovery not supported.") ENDIF(HAVE_IFADDRS_H) ######################################################################## diff --git a/host/lib/load_modules.cpp b/host/lib/load_modules.cpp index 700afcd3f..bcdff98a6 100644 --- a/host/lib/load_modules.cpp +++ b/host/lib/load_modules.cpp @@ -40,8 +40,8 @@ static void load_module(const std::string &file_name){ } } -#elif HAVE_WINBASE_H -#include +#elif HAVE_WINDOWS_H +#include static void load_module(const std::string &file_name){ if (LoadLibrary(file_name.c_str()) == NULL){ -- cgit v1.2.3