cmake: windows build fixes

works with cygwin and x86_64-w64-mingw32-gcc/x86_64-w64-mingw32-g++
from the package installer of cygwin.
To use that add the following lines to .bash_profile

export CC=x86_64-w64-mingw32-gcc
export CXX=x86_64-w64-mingw32-g++

you also need cmake from cygwin
This commit is contained in:
Davide Gerhard 2019-09-02 11:40:16 +02:00
parent 184b2af329
commit 8cd1f87ef6
No known key found for this signature in database
GPG Key ID: 7CBEFA144857DC97
13 changed files with 184 additions and 47 deletions

View File

@ -31,7 +31,7 @@ add_definitions("-DCOPYRIGHT=\"${COPYRIGHT}\"")
set(IDENTIFIER "com.${COMPANY}.${APPLICATION_NAME}") set(IDENTIFIER "com.${COMPANY}.${APPLICATION_NAME}")
add_definitions("-DIDENTIFIER=\"${IDENTIFIER}\"") add_definitions("-DIDENTIFIER=\"${IDENTIFIER}\"")
# raspberry as only lxterminal not xterm # raspberry as only lxterminal not xterm
if(NOT WIN32) if(NOT (WIN32 OR CYGWIN))
find_program(BINARY_TERMINAL_BIN lxterminal) find_program(BINARY_TERMINAL_BIN lxterminal)
if(BINARY_TERMINAL_BIN) if(BINARY_TERMINAL_BIN)
set(APPLICATION_DESKTOP_EXEC "${BINARY_TERMINAL_BIN} -e ${CMAKE_PROJECT_NAME}") set(APPLICATION_DESKTOP_EXEC "${BINARY_TERMINAL_BIN} -e ${CMAKE_PROJECT_NAME}")
@ -86,6 +86,7 @@ if(NOT DEFINED CMAKE_BUILD_TYPE OR "${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
endif() endif()
message(STATUS "Build type set to: ${CMAKE_BUILD_TYPE}") message(STATUS "Build type set to: ${CMAKE_BUILD_TYPE}")
message("CMake system: ${CMAKE_SYSTEM_NAME}")
# set compiler # set compiler
include(FindCompiler) include(FindCompiler)
@ -174,12 +175,19 @@ if(LINUX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_CM108") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_CM108")
endif() endif()
elseif (NOT WIN32) elseif (NOT WIN32 AND NOT CYGWIN)
find_package(portaudio REQUIRED) find_package(portaudio REQUIRED)
if(PORTAUDIO_FOUND) if(PORTAUDIO_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_PORTAUDIO") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_PORTAUDIO")
endif() endif()
else()
set(ALSA_INCLUDE_DIRS "")
set(ALSA_LIBRARIES "")
set(UDEV_INCLUDE_DIRS "")
set(UDEV_LIBRARIES "")
set(PORTAUDIO_INCLUDE_DIRS "")
set(PORTAUDIO_LIBRARIES "")
endif() endif()
# manage and fetch new data # manage and fetch new data
@ -194,13 +202,9 @@ add_subdirectory(${CUSTOM_MISC_DIR})
add_subdirectory(src) add_subdirectory(src)
# ctest # ctest
# Note CMake will generate tests only if the enable_testing() command
# has been invoked. The CTest module invokes the command automatically
# when the BUILD_TESTING option is ON.
include(CTest) include(CTest)
if(BUILD_TESTING) enable_testing()
add_subdirectory(test) add_subdirectory(test)
endif()
# manage scripts # manage scripts
add_subdirectory(scripts) add_subdirectory(scripts)

View File

@ -80,6 +80,7 @@ else (GPSD_LIBRARIES AND GPSD_INCLUDE_DIRS)
endif (GPSD_LIBRARIES AND GPSD_INCLUDE_DIRS) endif (GPSD_LIBRARIES AND GPSD_INCLUDE_DIRS)
# maybe on CYGWIN gpsd works
if (WIN32) if (WIN32)
set(GPSD_FOUND FALSE) set(GPSD_FOUND FALSE)
set(GPSD_LIBRARIES "") set(GPSD_LIBRARIES "")

View File

@ -5,7 +5,7 @@ if(LINUX)
string(REGEX REPLACE "\n%W%[^\n]*" "" file_content "${file_content}") string(REGEX REPLACE "\n%W%[^\n]*" "" file_content "${file_content}")
string(REGEX REPLACE "\n%M%[^\n]*" "" file_content "${file_content}") string(REGEX REPLACE "\n%M%[^\n]*" "" file_content "${file_content}")
string(REGEX REPLACE "\n%L%([^\n]*)" "\n\\1" file_content "${file_content}") string(REGEX REPLACE "\n%L%([^\n]*)" "\n\\1" file_content "${file_content}")
elseif(WIN32) elseif(WIN32 OR CYGWIN)
string(REGEX REPLACE "\n%M%[^\n]*" "" file_content "${file_content}") string(REGEX REPLACE "\n%M%[^\n]*" "" file_content "${file_content}")
string(REGEX REPLACE "\n%L%[^\n]*" "" file_content "${file_content}") string(REGEX REPLACE "\n%L%[^\n]*" "" file_content "${file_content}")
string(REGEX REPLACE "\n%W%([^\n]*)" "\n\\1" file_content "${file_content}") string(REGEX REPLACE "\n%W%([^\n]*)" "\n\\1" file_content "${file_content}")
@ -36,7 +36,7 @@ install(FILES "${CUSTOM_CONF_DIR}/sdr.conf" DESTINATION share/doc/${CMAKE_PROJEC
# This step would be done as ordinary user. # This step would be done as ordinary user.
# Some people like to put the direwolf config file in /etc/ax25. # Some people like to put the direwolf config file in /etc/ax25.
# Note that all of these are also in $(DESTDIR)/share/doc/direwolf/examples/. # Note that all of these are also in $(DESTDIR)/share/doc/direwolf/examples/.
if(NOT WIN32) if(NOT (WIN32 OR CYGWIN))
add_custom_target(install-conf add_custom_target(install-conf
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-DCUSTOM_BINARY_DIR="${CMAKE_BINARY_DIR}" -DCUSTOM_BINARY_DIR="${CMAKE_BINARY_DIR}"

View File

@ -86,8 +86,8 @@ ExternalProject_Add(download_symbolsx
TEST_COMMAND "" TEST_COMMAND ""
) )
add_custom_target(data-update) add_custom_target(update-data)
add_dependencies(data-update data_rename download_tocalls download_symbols-new download_symbolsx) add_dependencies(update-data data_rename download_tocalls download_symbols-new download_symbolsx)
install(FILES "${CUSTOM_BINARY_DATA_DIR}/${TOCALLS_TXT}" DESTINATION share/${PROJECT_NAME}) install(FILES "${CUSTOM_BINARY_DATA_DIR}/${TOCALLS_TXT}" DESTINATION share/${PROJECT_NAME})
install(FILES "${CUSTOM_BINARY_DATA_DIR}/${SYMBOLS-NEW_TXT}" DESTINATION share/${PROJECT_NAME}) install(FILES "${CUSTOM_BINARY_DATA_DIR}/${SYMBOLS-NEW_TXT}" DESTINATION share/${PROJECT_NAME})

View File

@ -2,8 +2,7 @@
set(GEOTRANZ_LIBRARIES geotranz CACHE INTERNAL "geotranz") set(GEOTRANZ_LIBRARIES geotranz CACHE INTERNAL "geotranz")
set(geotranz_SOURCES list(APPEND geotranz_SOURCES
${geotranz_SOURCES}
error_string.c error_string.c
mgrs.c mgrs.c
polarst.c polarst.c
@ -13,6 +12,6 @@ set(geotranz_SOURCES
utm.c utm.c
) )
ADD_LIBRARY(geotranz STATIC add_library(geotranz STATIC
${geotranz_SOURCES} ${geotranz_SOURCES}
) )

View File

@ -6,19 +6,20 @@ include_directories(
) )
if(LINUX) if(LINUX)
set(misc_SOURCES list(APPEND misc_SOURCES
${misc_SOURCES}
# Provide our own copy of strlcpy and strlcat # Provide our own copy of strlcpy and strlcat
# because they are not included with Linux. # because they are not included with Linux.
${CUSTOM_MISC_DIR}/strlcpy.c ${CUSTOM_MISC_DIR}/strlcpy.c
${CUSTOM_MISC_DIR}/strlcat.c ${CUSTOM_MISC_DIR}/strlcat.c
) )
ADD_LIBRARY(misc STATIC
add_library(misc STATIC
${misc_SOURCES} ${misc_SOURCES}
) )
elseif(WIN32) # windows
set(misc_SOURCES elseif(WIN32 OR CYGWIN) # windows
${misc_SOURCES}
list(APPEND misc_SOURCES
# There are several string functions found in Linux # There are several string functions found in Linux
# but not on Windows. Need to provide our own copy. # but not on Windows. Need to provide our own copy.
${CUSTOM_MISC_DIR}/strsep.c ${CUSTOM_MISC_DIR}/strsep.c
@ -27,10 +28,14 @@ elseif(WIN32) # windows
${CUSTOM_MISC_DIR}/strlcpy.c ${CUSTOM_MISC_DIR}/strlcpy.c
${CUSTOM_MISC_DIR}/strlcat.c ${CUSTOM_MISC_DIR}/strlcat.c
) )
ADD_LIBRARY(misc STATIC
add_library(misc STATIC
${misc_SOURCES} ${misc_SOURCES}
) )
else() else()
# on macOS, OpenBSD and FreeBSD not misc is necessary # on macOS, OpenBSD and FreeBSD not misc is necessary
set(MISC_LIBRARIES "" CACHE INTERNAL "") set(MISC_LIBRARIES "" CACHE INTERNAL "")
endif() endif()

View File

@ -1,21 +1,24 @@
set(REGEX_LIBRARIES "" CACHE INTERNAL "") set(REGEX_LIBRARIES "" CACHE INTERNAL "")
if(WIN32) # windows if(WIN32 OR CYGWIN) # windows
set(REGEX_LIBRARIES regex CACHE INTERNAL "regex") set(REGEX_LIBRARIES regex CACHE INTERNAL "regex")
set(regex_SOURCES list(APPEND regex_SOURCES
${regex_SOURCES}
# When building for Linux, we use regular expression # When building for Linux, we use regular expression
# functions supplied by the gnu C library. # functions supplied by the gnu C library.
# For the native WIN32 version, we need to use our own copy. # For the native WIN32 version, we need to use our own copy.
# These were copied from http://gnuwin32.sourceforge.net/packages/regex.htm # These were copied from http://gnuwin32.sourceforge.net/packages/regex.htm
# Consider upgrading from https://www.gnu.org/software/libc/sources.html # Consider upgrading from https://www.gnu.org/software/libc/sources.html
#
# check if needed: -Dbool=int -Dtrue=1 -Dfalse=0
${CUSTOM_REGEX_DIR}/regex.c ${CUSTOM_REGEX_DIR}/regex.c
) )
ADD_LIBRARY(regex STATIC
add_library(regex STATIC
${regex_SOURCES} ${regex_SOURCES}
) )
set_target_properties(regex
PROPERTIES COMPILE_FLAGS "-Dbool=int -Dtrue=1 -Dfalse=0 -DUSE_REGEX_STATIC"
)
endif() endif()

View File

@ -1,5 +1,5 @@
if(NOT WIN32) if(NOT (WIN32 OR CYGWIN))
install(PROGRAMS "${CUSTOM_SCRIPTS_DIR}/dwespeak.sh" DESTINATION bin) install(PROGRAMS "${CUSTOM_SCRIPTS_DIR}/dwespeak.sh" DESTINATION bin)
install(PROGRAMS "${CUSTOM_SCRIPTS_DIR}/dw-start.sh" DESTINATION share/doc/${CMAKE_PROJECT_NAME}/examples) install(PROGRAMS "${CUSTOM_SCRIPTS_DIR}/dw-start.sh" DESTINATION share/doc/${CMAKE_PROJECT_NAME}/examples)
add_subdirectory(telemetry-toolkit) add_subdirectory(telemetry-toolkit)

View File

@ -10,6 +10,12 @@ include_directories(
${CUSTOM_GEOTRANZ_DIR} ${CUSTOM_GEOTRANZ_DIR}
) )
if(WIN32 OR CYGWIN)
include_directories(
${CUSTOM_REGEX_DIR}
)
endif()
# build gen_fff to create fsk_fast_filter.h # build gen_fff to create fsk_fast_filter.h
# optimization for slow processors # optimization for slow processors
list(APPEND gen_fff_SOURCES list(APPEND gen_fff_SOURCES
@ -105,17 +111,21 @@ if(LINUX)
cm108.c cm108.c
) )
endif() endif()
elseif(WIN32) # windows elseif(WIN32 OR CYGWIN) # windows
list(APPEND direwolf_SOURCES list(APPEND direwolf_SOURCES
audio_win.c audio_win.c
# icon # icon
${CMAKE_SOURCE_DIR}/cmake/cpack/direwolf.rc # require plain gcc binary or link
#${CMAKE_SOURCE_DIR}/cmake/cpack/direwolf.rc
)
list(REMOVE_ITEM direwolf_SOURCES
dwgpsd.c
)
else() # macOS freebsd openbsd
list(APPEND direwolf_SOURCES
audio_portaudio.c
) )
else() # macOS freebsd openbsd
list(APPEND direwolf_SOURCES
audio_portaudio.c
)
endif() endif()
add_executable(direwolf add_executable(direwolf
@ -136,6 +146,13 @@ target_link_libraries(direwolf
${PORTAUDIO_LIBRARIES} ${PORTAUDIO_LIBRARIES}
) )
if(WIN32 OR CYGWIN)
set_target_properties(direwolf
PROPERTIES COMPILE_FLAGS "-DUSE_REGEX_STATIC"
)
target_link_libraries(direwolf winmm ws2_32)
endif()
# decode_aprs # decode_aprs
list(APPEND decode_aprs_SOURCES list(APPEND decode_aprs_SOURCES
decode_aprs.c decode_aprs.c
@ -154,6 +171,12 @@ list(APPEND decode_aprs_SOURCES
tt_text.c tt_text.c
) )
if(WIN32 OR CYGWIN)
list(REMOVE_ITEM decode_aprs_SOURCES
dwgpsd.c
)
endif()
add_executable(decode_aprs add_executable(decode_aprs
${decode_aprs_SOURCES} ${decode_aprs_SOURCES}
) )
@ -161,11 +184,12 @@ add_executable(decode_aprs
add_dependencies(decode_aprs gen_fff) add_dependencies(decode_aprs gen_fff)
set_target_properties(decode_aprs set_target_properties(decode_aprs
PROPERTIES COMPILE_FLAGS "-DDECAMAIN" PROPERTIES COMPILE_FLAGS "-DDECAMAIN -DUSE_REGEX_STATIC"
) )
target_link_libraries(decode_aprs target_link_libraries(decode_aprs
${MISC_LIBRARIES} ${MISC_LIBRARIES}
${REGEX_LIBRARIES}
Threads::Threads Threads::Threads
${GPSD_LIBRARIES} ${GPSD_LIBRARIES}
) )
@ -306,6 +330,12 @@ list(APPEND atest_SOURCES
textcolor.c textcolor.c
) )
if(WIN32 OR CYGWIN)
list(REMOVE_ITEM atest_SOURCES
dwgpsd.c
)
endif()
add_executable(atest add_executable(atest
${atest_SOURCES} ${atest_SOURCES}
) )
@ -315,9 +345,16 @@ add_dependencies(atest gen_fff)
target_link_libraries(atest target_link_libraries(atest
${MISC_LIBRARIES} ${MISC_LIBRARIES}
${GPSD_LIBRARIES} ${GPSD_LIBRARIES}
${REGEX_LIBRARIES}
Threads::Threads Threads::Threads
) )
if(WIN32 OR CYGWIN)
set_target_properties(atest
PROPERTIES COMPILE_FLAGS "-DUSE_REGEX_STATIC"
)
endif()
# Multiple AGWPE network or serial port clients to test TNCs side by side. # Multiple AGWPE network or serial port clients to test TNCs side by side.
# aclients # aclients
@ -337,6 +374,10 @@ target_link_libraries(aclients
Threads::Threads Threads::Threads
) )
if(WIN32 OR CYGWIN)
target_link_libraries(aclients ws2_32)
endif()
# Talk to a KISS TNC. # Talk to a KISS TNC.
# Note: kiss_frame.c has conditional compilation on KISSUTIL. # Note: kiss_frame.c has conditional compilation on KISSUTIL.
@ -365,6 +406,10 @@ target_link_libraries(kissutil
Threads::Threads Threads::Threads
) )
if(WIN32 OR CYGWIN)
target_link_libraries(kissutil ws2_32)
endif()
# List USB audio adapters than can use GPIO for PTT. # List USB audio adapters than can use GPIO for PTT.
# cm108 # cm108
@ -406,6 +451,9 @@ target_link_libraries(ttcalc
${MISC_LIBRARIES} ${MISC_LIBRARIES}
) )
if(WIN32 OR CYGWIN)
target_link_libraries(ttcalc ws2_32)
endif()
install(TARGETS direwolf DESTINATION bin) install(TARGETS direwolf DESTINATION bin)
install(TARGETS decode_aprs DESTINATION bin) install(TARGETS decode_aprs DESTINATION bin)

View File

@ -59,7 +59,6 @@
#include "mheard.h" #include "mheard.h"
/* /*
* Save pointers to configuration settings. * Save pointers to configuration settings.
*/ */

View File

@ -113,7 +113,6 @@
#define SLEEP_MS(n) usleep((n)*1000) #define SLEEP_MS(n) usleep((n)*1000)
#endif #endif
#if __WIN32__ #if __WIN32__
#define PTW32_STATIC_LIB #define PTW32_STATIC_LIB
@ -124,7 +123,7 @@
#define _POSIX_C_SOURCE 1 #define _POSIX_C_SOURCE 1
#else #else
#include <pthread.h> #include <pthread.h>
#endif #endif

View File

@ -84,7 +84,6 @@ double dtime_now (void)
} }
/*------------------------------------------------------------------ /*------------------------------------------------------------------
* *
* Name: timestamp_now * Name: timestamp_now

View File

@ -1,4 +1,4 @@
# this is a trick to avoid to more complication # this is a trick to avoid more complication
# because configure_file() is done a configuration time # because configure_file() is done a configuration time
set(CUSTOM_TEST_BINARY_DIR "${CMAKE_BINARY_DIR}/test") set(CUSTOM_TEST_BINARY_DIR "${CMAKE_BINARY_DIR}/test")
set(GEN_PACKETS_BIN "${CMAKE_BINARY_DIR}/src/gen_packets${CMAKE_EXECUTABLE_SUFFIX}") set(GEN_PACKETS_BIN "${CMAKE_BINARY_DIR}/src/gen_packets${CMAKE_EXECUTABLE_SUFFIX}")
@ -83,6 +83,12 @@ include_directories(
${CMAKE_BINARY_DIR}/src ${CMAKE_BINARY_DIR}/src
) )
if(WIN32 OR CYGWIN)
include_directories(
${CUSTOM_REGEX_DIR}
)
endif()
# Unit test for demodulators # Unit test for demodulators
list(APPEND atest9_SOURCES list(APPEND atest9_SOURCES
@ -111,6 +117,12 @@ list(APPEND atest9_SOURCES
${CUSTOM_SRC_DIR}/tt_text.c ${CUSTOM_SRC_DIR}/tt_text.c
) )
if(WIN32 OR CYGWIN)
list(REMOVE_ITEM atest9_SOURCES
${CUSTOM_SRC_DIR}/dwgpsd.c
)
endif()
add_executable(atest9 add_executable(atest9
${atest9_SOURCES} ${atest9_SOURCES}
) )
@ -119,10 +131,18 @@ add_dependencies(atest9 gen_fff)
target_link_libraries(atest9 target_link_libraries(atest9
${MISC_LIBRARIES} ${MISC_LIBRARIES}
${REGEX_LIBRARIES}
${GPSD_LIBRARIES} ${GPSD_LIBRARIES}
Threads::Threads Threads::Threads
) )
if(WIN32 OR CYGWIN)
set_target_properties(atest9
PROPERTIES COMPILE_FLAGS "-DUSE_REGEX_STATIC"
)
target_link_libraries(atest9 ws2_32)
endif()
# Unit test for inner digipeater algorithm # Unit test for inner digipeater algorithm
list(APPEND dtest_SOURCES list(APPEND dtest_SOURCES
@ -144,12 +164,18 @@ list(APPEND dtest_SOURCES
${CUSTOM_SRC_DIR}/tt_text.c ${CUSTOM_SRC_DIR}/tt_text.c
) )
if(WIN32 OR CYGWIN)
list(REMOVE_ITEM dtest_SOURCES
${CUSTOM_SRC_DIR}/dwgpsd.c
)
endif()
add_executable(dtest add_executable(dtest
${dtest_SOURCES} ${dtest_SOURCES}
) )
set_target_properties(dtest set_target_properties(dtest
PROPERTIES COMPILE_FLAGS "-DDIGITEST" PROPERTIES COMPILE_FLAGS "-DDIGITEST -DUSE_REGEX_STATIC"
) )
target_link_libraries(dtest target_link_libraries(dtest
@ -159,6 +185,10 @@ target_link_libraries(dtest
Threads::Threads Threads::Threads
) )
if(WIN32 OR CYGWIN)
target_link_libraries(dtest ws2_32)
endif()
# Unit test for APRStt tone seqence parsing. # Unit test for APRStt tone seqence parsing.
list(APPEND ttest_SOURCES list(APPEND ttest_SOURCES
@ -218,12 +248,18 @@ list(APPEND pftest_SOURCES
${CUSTOM_SRC_DIR}/tt_text.c ${CUSTOM_SRC_DIR}/tt_text.c
) )
if(WIN32 OR CYGWIN)
list(REMOVE_ITEM pftest_SOURCES
${CUSTOM_SRC_DIR}/dwgpsd.c
)
endif()
add_executable(pftest add_executable(pftest
${pftest_SOURCES} ${pftest_SOURCES}
) )
set_target_properties(pftest set_target_properties(pftest
PROPERTIES COMPILE_FLAGS "-DPFTEST" PROPERTIES COMPILE_FLAGS "-DPFTEST -DUSE_REGEX_STATIC"
) )
target_link_libraries(pftest target_link_libraries(pftest
@ -233,6 +269,9 @@ target_link_libraries(pftest
Threads::Threads Threads::Threads
) )
if(WIN32 OR CYGWIN)
target_link_libraries(pftest ws2_32)
endif()
# Unit test for telemetry decoding. # Unit test for telemetry decoding.
list(APPEND tlmtest_SOURCES list(APPEND tlmtest_SOURCES
@ -242,12 +281,18 @@ list(APPEND tlmtest_SOURCES
${CUSTOM_SRC_DIR}/textcolor.c ${CUSTOM_SRC_DIR}/textcolor.c
) )
if(WIN32 OR CYGWIN)
list(REMOVE_ITEM tlmtest_SOURCES
${CUSTOM_SRC_DIR}/dwgpsd.c
)
endif()
add_executable(tlmtest add_executable(tlmtest
${tlmtest_SOURCES} ${tlmtest_SOURCES}
) )
set_target_properties(tlmtest set_target_properties(tlmtest
PROPERTIES COMPILE_FLAGS "-DTEST" PROPERTIES COMPILE_FLAGS "-DTEST -DUSE_REGEX_STATIC"
) )
target_link_libraries(tlmtest target_link_libraries(tlmtest
@ -255,6 +300,10 @@ target_link_libraries(tlmtest
${REGEX_LIBRARIES} ${REGEX_LIBRARIES}
) )
if(WIN32 OR CYGWIN)
target_link_libraries(tlmtest ws2_32)
endif()
# Unit test for location coordinate conversion. # Unit test for location coordinate conversion.
list(APPEND lltest_SOURCES list(APPEND lltest_SOURCES
@ -322,7 +371,7 @@ add_executable(pad2test
) )
set_target_properties(pad2test set_target_properties(pad2test
PROPERTIES COMPILE_FLAGS "-DPAD2TEST" PROPERTIES COMPILE_FLAGS "-DPAD2TEST -DUSE_REGEX_STATIC"
) )
target_link_libraries(pad2test target_link_libraries(pad2test
@ -330,6 +379,10 @@ target_link_libraries(pad2test
${REGEX_LIBRARIES} ${REGEX_LIBRARIES}
) )
if(WIN32 OR CYGWIN)
target_link_libraries(pad2test ws2_32)
endif()
# Unit Test for XID frame encode/decode. # Unit Test for XID frame encode/decode.
list(APPEND xidtest_SOURCES list(APPEND xidtest_SOURCES
@ -414,6 +467,12 @@ if(OPTIONAL_TEST)
${CUSTOM_SRC_DIR}/symbols.c ${CUSTOM_SRC_DIR}/symbols.c
) )
if(WIN32 OR CYGWIN)
list(REMOVE_ITEM itest_SOURCES
${CUSTOM_SRC_DIR}/dwgpsd.c
)
endif()
add_executable(itest add_executable(itest
${itest_SOURCES} ${itest_SOURCES}
) )
@ -428,6 +487,10 @@ if(OPTIONAL_TEST)
Threads::Threads Threads::Threads
) )
if(WIN32 OR CYGWIN)
target_link_libraries(itest ws2_32)
endif()
# For demodulator tweaking experiments. # For demodulator tweaking experiments.
list(APPEND testagc_SOURCES list(APPEND testagc_SOURCES
@ -456,6 +519,12 @@ if(OPTIONAL_TEST)
${CUSTOM_SRC_DIR}/textcolor.c ${CUSTOM_SRC_DIR}/textcolor.c
) )
if(WIN32 OR CYGWIN)
list(REMOVE_ITEM testagc_SOURCES
${CUSTOM_SRC_DIR}/dwgpsd.c
)
endif()
add_executable(testagc add_executable(testagc
${testagc_SOURCES} ${testagc_SOURCES}
) )
@ -468,6 +537,10 @@ if(OPTIONAL_TEST)
Threads::Threads Threads::Threads
) )
if(WIN32 OR CYGWIN)
target_link_libraries(testagc ws2_32)
endif()
# Send GPS location to KISS TNC each second. # Send GPS location to KISS TNC each second.
list(APPEND walk96_SOURCES list(APPEND walk96_SOURCES
@ -515,10 +588,13 @@ if(OPTIONAL_TEST)
${CUSTOM_SRC_DIR}/cm108.c ${CUSTOM_SRC_DIR}/cm108.c
) )
endif() endif()
elseif(WIN32) # windows elseif(WIN32 OR CYGWIN) # windows
list(APPEND walk96_SOURCES list(APPEND walk96_SOURCES
${CUSTOM_SRC_DIR}/audio_win.c ${CUSTOM_SRC_DIR}/audio_win.c
) )
list(REMOVE_ITEM walk96_SOURCES
${CUSTOM_SRC_DIR}/dwgpsd.c
)
else() # macOS freebsd openbsd else() # macOS freebsd openbsd
list(APPEND walk96_SOURCES list(APPEND walk96_SOURCES
${CUSTOM_SRC_DIR}/audio_portaudio.c ${CUSTOM_SRC_DIR}/audio_portaudio.c
@ -530,7 +606,7 @@ if(OPTIONAL_TEST)
) )
set_target_properties(walk96 set_target_properties(walk96
PROPERTIES COMPILE_FLAGS "-DWALK96" PROPERTIES COMPILE_FLAGS "-DWALK96 -DUSE_REGEX_STATIC"
) )
target_link_libraries(walk96 target_link_libraries(walk96
@ -544,6 +620,10 @@ if(OPTIONAL_TEST)
Threads::Threads Threads::Threads
) )
if(WIN32 OR CYGWIN)
target_link_libraries(walk96 ws2_32)
endif()
# TODO miss the audio file # TODO miss the audio file