aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Hauke <mardnh@gmx.de>2018-04-24 20:47:38 +0200
committerSteve Markgraf <steve@steve-m.de>2018-04-24 21:40:14 +0200
commit0325fa9496e622200506ead78db8df2209fb39d2 (patch)
tree42158327d3031ca0b923922619ffde315e62f5f1
parent0d520ba1132eb9ba90904625e4bf7c3002180ef6 (diff)
Fix build with MinGW
Signed-off-by: Steve Markgraf <steve@steve-m.de>
-rw-r--r--CMakeLists.txt4
-rw-r--r--src/CMakeLists.txt9
-rw-r--r--src/rds_mod.c6
3 files changed, 16 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 813e5c7..0a3b5e2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -60,7 +60,9 @@ endif()
########################################################################
find_package(PkgConfig)
find_package(LibUSB)
-set(THREADS_USE_PTHREADS_WIN32 true)
+if(WIN32 AND NOT MINGW)
+ set(THREADS_USE_PTHREADS_WIN32 true)
+endif()
find_package(Threads)
if(NOT LIBUSB_FOUND)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2255598..1d788de 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -61,7 +61,7 @@ endif()
########################################################################
# Setup libraries used in executables
########################################################################
-if(WIN32)
+if(WIN32 AND NOT MINGW)
add_library(libgetopt_static STATIC
getopt/getopt.c
)
@@ -105,7 +105,7 @@ target_link_libraries(fl2k_test m)
target_link_libraries(fl2k_fm m)
endif()
-if(WIN32)
+if(WIN32 AND NOT MINGW)
target_link_libraries(fl2k_file libgetopt_static)
target_link_libraries(fl2k_tcp ws2_32 libgetopt_static)
target_link_libraries(fl2k_test libgetopt_static)
@@ -115,6 +115,11 @@ set_property(TARGET fl2k_tcp APPEND PROPERTY COMPILE_DEFINITIONS "libosmo-fl2k_S
set_property(TARGET fl2k_test APPEND PROPERTY COMPILE_DEFINITIONS "libosmo-fl2k_STATIC" )
set_property(TARGET fl2k_fm APPEND PROPERTY COMPILE_DEFINITIONS "libosmo-fl2k_STATIC" )
endif()
+
+if(MINGW)
+target_link_libraries(fl2k_tcp ws2_32)
+endif()
+
########################################################################
# Install built library files & utilities
########################################################################
diff --git a/src/rds_mod.c b/src/rds_mod.c
index 865ca11..8e31b0d 100644
--- a/src/rds_mod.c
+++ b/src/rds_mod.c
@@ -109,7 +109,13 @@ int get_rds_ct_group(uint16_t *blocks)
utc = localtime(&now);
+ //'struct tm' has no member named 'tm_gmtoff' on Windows+MinGW
+ #if defined(__APPLE__) || defined(__FreeBSD__)
offset = utc->tm_gmtoff / (30 * 60);
+ #else
+ offset = time(NULL) / (30 * 60);
+ #endif
+
blocks[3] |= abs(offset);
if (offset < 0)
blocks[3] |= 0x20;