From 6a2fbe07e7674794a883a7062ce2225781cf5193 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 4 Apr 2011 16:51:17 -0700 Subject: uhd: a few minor changes to get uhd building under mingw or cygwin --- host/lib/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'host/lib') diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index 8ca7c7dca..268f05df6 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -68,6 +68,14 @@ MACRO(INCLUDE_SUBDIRECTORY subdir) LIST(REMOVE_AT _cmake_binary_dirs 0) ENDMACRO(INCLUDE_SUBDIRECTORY) +######################################################################## +# Cygwin special +######################################################################## +IF(CYGWIN) + ADD_DEFINITIONS(-D__USE_W32_SOCKETS) #boost asio says we need this + LIBUHD_APPEND_LIBS(ws2_32) +ENDIF(CYGWIN) + ######################################################################## # Include subdirectories (different than add) ######################################################################## -- cgit v1.2.3 From dbfbc497a8e0a144e0db2b8daa0f4baba5284775 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 5 Apr 2011 16:32:48 -0700 Subject: uhd: tweaks for cygwin/mingw, always link winsock2, findusb1, __USE_W32_SOCKETS --- host/CMakeLists.txt | 4 ++++ host/Modules/FindUSB1.cmake | 6 +++--- host/lib/CMakeLists.txt | 8 -------- host/lib/transport/CMakeLists.txt | 4 ++++ 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'host/lib') diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index 7df04995c..552fe492c 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -90,6 +90,10 @@ IF(MSVC) ) ENDIF(MSVC) +IF(CYGWIN) + ADD_DEFINITIONS(-D__USE_W32_SOCKETS) #boost asio says we need this +ENDIF(CYGWIN) + IF(WIN32) ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501) #minimum version required is windows xp ADD_DEFINITIONS(-DNOMINMAX) #disables stupidity and enables std::min and std::max diff --git a/host/Modules/FindUSB1.cmake b/host/Modules/FindUSB1.cmake index ebcac99eb..efb2e288b 100644 --- a/host/Modules/FindUSB1.cmake +++ b/host/Modules/FindUSB1.cmake @@ -17,12 +17,12 @@ if (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) set(LIBUSB_FOUND TRUE) else (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) - IF (NOT WIN32) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) - pkg_check_modules(PC_LIBUSB libusb-1.0) - ENDIF(NOT WIN32) + IF(PKG_CONFIG_FOUND) + pkg_check_modules(PC_LIBUSB libusb-1.0) + ENDIF(PKG_CONFIG_FOUND) FIND_PATH(LIBUSB_INCLUDE_DIR libusb.h PATHS ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDE_DIRS}) diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index 268f05df6..8ca7c7dca 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -68,14 +68,6 @@ MACRO(INCLUDE_SUBDIRECTORY subdir) LIST(REMOVE_AT _cmake_binary_dirs 0) ENDMACRO(INCLUDE_SUBDIRECTORY) -######################################################################## -# Cygwin special -######################################################################## -IF(CYGWIN) - ADD_DEFINITIONS(-D__USE_W32_SOCKETS) #boost asio says we need this - LIBUHD_APPEND_LIBS(ws2_32) -ENDIF(CYGWIN) - ######################################################################## # Include subdirectories (different than add) ######################################################################## diff --git a/host/lib/transport/CMakeLists.txt b/host/lib/transport/CMakeLists.txt index a5bf9c5f1..30f8db48a 100644 --- a/host/lib/transport/CMakeLists.txt +++ b/host/lib/transport/CMakeLists.txt @@ -79,6 +79,10 @@ SET_SOURCE_FILES_PROPERTIES( PROPERTIES COMPILE_DEFINITIONS "${IF_ADDRS_DEFS}" ) +IF(WIN32 AND UNIX) #MinGW/Cygwin needs winsock2 + LIBUHD_APPEND_LIBS(ws2_32) +ENDIF() + ######################################################################## # Append to the list of sources for lib uhd ######################################################################## -- cgit v1.2.3 From 74fc8946688d53ccd5d067d3f86e26b990af1bd4 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 6 Apr 2011 09:55:54 -0700 Subject: uhd: always link winsock2 on windows, disable pthread SCHED_RR for cygwin --- host/lib/transport/CMakeLists.txt | 4 +++- host/lib/utils/CMakeLists.txt | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'host/lib') diff --git a/host/lib/transport/CMakeLists.txt b/host/lib/transport/CMakeLists.txt index 30f8db48a..90360977a 100644 --- a/host/lib/transport/CMakeLists.txt +++ b/host/lib/transport/CMakeLists.txt @@ -79,7 +79,9 @@ SET_SOURCE_FILES_PROPERTIES( PROPERTIES COMPILE_DEFINITIONS "${IF_ADDRS_DEFS}" ) -IF(WIN32 AND UNIX) #MinGW/Cygwin needs winsock2 +#On windows, the boost asio implementation uses the winsock2 library. +#Note: we exclude the .lib extension for cygwin and mingw platforms. +IF(WIN32) LIBUHD_APPEND_LIBS(ws2_32) ENDIF() diff --git a/host/lib/utils/CMakeLists.txt b/host/lib/utils/CMakeLists.txt index c0d99b37e..26c02b5b4 100644 --- a/host/lib/utils/CMakeLists.txt +++ b/host/lib/utils/CMakeLists.txt @@ -36,6 +36,11 @@ CHECK_CXX_SOURCE_COMPILES(" " HAVE_PTHREAD_SETSCHEDPARAM ) +IF(CYGWIN) + #SCHED_RR non-operational on cygwin + SET(HAVE_PTHREAD_SETSCHEDPARAM False) +ENDIF(CYGWIN) + CHECK_CXX_SOURCE_COMPILES(" #include int main(){ -- cgit v1.2.3