summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Volz <ryan.volz@gmail.com>2021-04-12 12:42:25 -0400
committermormj <34754695+mormj@users.noreply.github.com>2021-04-17 19:52:46 -0400
commit4bfd03936c709187c8bcbf189b9d42096a9e478c (patch)
treee6d790a03957da7f0df62c38416cedce76116609
parent035ed74a765180c1985035e1df428f81861b431c (diff)
runtime, blocks, network: Clean up use of Win headers, fix stream_pdu.
stream_pdu_base was failing to compile on Windows after moving to gr-network since HAVE_IO_H was not checked for or defined. Signed-off-by: Ryan Volz <ryan.volz@gmail.com>
-rw-r--r--gnuradio-runtime/lib/CMakeLists.txt10
-rw-r--r--gr-blocks/lib/CMakeLists.txt3
-rw-r--r--gr-blocks/lib/ConfigChecks.cmake24
-rw-r--r--gr-network/lib/CMakeLists.txt17
4 files changed, 20 insertions, 34 deletions
diff --git a/gnuradio-runtime/lib/CMakeLists.txt b/gnuradio-runtime/lib/CMakeLists.txt
index 9a6cd4488f..17c577c934 100644
--- a/gnuradio-runtime/lib/CMakeLists.txt
+++ b/gnuradio-runtime/lib/CMakeLists.txt
@@ -241,13 +241,9 @@ target_compile_definitions(gnuradio-runtime PRIVATE BOOST_DLL_USE_STD_FS)
endif()
-#Add libraries for winsock2.h on Windows
-check_include_file_cxx(windows.h HAVE_WINDOWS_H)
-if(HAVE_WINDOWS_H)
- target_compile_definitions(gnuradio-runtime PUBLIC -DHAVE_WINDOWS_H -DUSING_WINSOCK -DWIN32_LEAN_AND_MEAN)
- message(STATUS "Adding windows libs to gnuradio runtime libs...")
- target_link_libraries(gnuradio-runtime PUBLIC ws2_32 wsock32)
-endif(HAVE_WINDOWS_H)
+if(WIN32)
+ target_compile_definitions(gnuradio-runtime PUBLIC -DWIN32_LEAN_AND_MEAN)
+endif(WIN32)
#need to link with librt on ubuntu 11.10 for shm_*
if((LINUX) OR (CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD"))
diff --git a/gr-blocks/lib/CMakeLists.txt b/gr-blocks/lib/CMakeLists.txt
index d9dd44692c..7957a0443f 100644
--- a/gr-blocks/lib/CMakeLists.txt
+++ b/gr-blocks/lib/CMakeLists.txt
@@ -8,7 +8,8 @@
########################################################################
# Setup compatibility checks and defines
########################################################################
-include(${CMAKE_CURRENT_SOURCE_DIR}/ConfigChecks.cmake)
+include(GrMiscUtils)
+GR_CHECK_HDR_N_DEF(io.h HAVE_IO_H)
########################################################################
# Setup library
diff --git a/gr-blocks/lib/ConfigChecks.cmake b/gr-blocks/lib/ConfigChecks.cmake
deleted file mode 100644
index e29be361c1..0000000000
--- a/gr-blocks/lib/ConfigChecks.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright 2012 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# SPDX-License-Identifier: GPL-3.0-or-later
-#
-
-########################################################################
-INCLUDE(GrMiscUtils)
-INCLUDE(CheckCXXSourceCompiles)
-
-IF(MSVC) #add this directory for our provided headers
-LIST(APPEND CMAKE_REQUIRED_INCLUDES ${CMAKE_SOURCE_DIR}/msvc)
-ENDIF(MSVC)
-
-GR_CHECK_HDR_N_DEF(io.h HAVE_IO_H)
-
-########################################################################
-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 gr blocks libs...")
- LIST(APPEND blocks_libs ws2_32 wsock32)
-ENDIF(HAVE_WINDOWS_H)
diff --git a/gr-network/lib/CMakeLists.txt b/gr-network/lib/CMakeLists.txt
index 58930ebf17..d71ff34f0d 100644
--- a/gr-network/lib/CMakeLists.txt
+++ b/gr-network/lib/CMakeLists.txt
@@ -6,6 +6,14 @@
#
########################################################################
+# Setup compatibility checks and defines
+########################################################################
+include(GrMiscUtils)
+include(CheckCXXSourceCompiles)
+GR_CHECK_HDR_N_DEF(io.h HAVE_IO_H)
+CHECK_INCLUDE_FILE_CXX(windows.h HAVE_WINDOWS_H)
+
+########################################################################
#Setup library
########################################################################
add_library(gnuradio-network
@@ -21,8 +29,13 @@ add_library(gnuradio-network
target_link_libraries(gnuradio-network PUBLIC gnuradio-runtime)
target_include_directories(gnuradio-network
PUBLIC $<INSTALL_INTERFACE:include>
- PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
-)
+ PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+)
+
+if(HAVE_WINDOWS_H)
+ target_compile_definitions(gnuradio-network PRIVATE -DHAVE_WINDOWS_H)
+ target_link_libraries(gnuradio-network PRIVATE ws2_32 wsock32)
+endif()
#Add Windows DLL resource file if using MSVC
if (MSVC)