mirror of https://github.com/wb2osz/direwolf.git
64 bit target for Windows.
This commit is contained in:
parent
29c48ddcc8
commit
a7a84269fc
99
Makefile.win
99
Makefile.win
|
@ -2,32 +2,52 @@
|
||||||
# Makefile for native Windows version of Dire Wolf.
|
# Makefile for native Windows version of Dire Wolf.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# This is built in the Cygwin environment but with the
|
# This is built in the Cygwin environment with the MinGW compiler.
|
||||||
# compiler from http://www.mingw.org/ so there is no
|
# MinGW is a special version of gcc that generates native Windows executables.
|
||||||
# dependency on extra DLLs.
|
|
||||||
#
|
|
||||||
# The MinGW/bin directory must be in the PATH for the
|
|
||||||
# compiler. e.g. export PATH=/cygdrive/c/MinGW/bin:$PATH
|
|
||||||
#
|
|
||||||
# Failure to have the path set correctly will result in the
|
|
||||||
# obscure message: Makefile.win:... recipe for target ... failed.
|
|
||||||
#
|
|
||||||
# Type "which gcc" to make sure you are getting the right one!
|
|
||||||
#
|
#
|
||||||
|
# A minimum of Windows XP is required due to some of the system
|
||||||
|
# features being used. XP requires a Pentium processor or later.
|
||||||
|
# The DSP filters can be sped up considerably with the SSE instructions.
|
||||||
|
# The SSE instructions were introduced in 1999 with the Pentium III series.
|
||||||
|
# SSE2 instructions, added in 2000, with the Pentium 4, don't seem to offer any advantage.
|
||||||
|
|
||||||
|
|
||||||
all : direwolf decode_aprs text2tt tt2text ll2utm utm2ll aclients log2gpx gen_packets atest ttcalc tnctest tnctest-issue-132 kissutil
|
|
||||||
|
all : direwolf decode_aprs text2tt tt2text ll2utm utm2ll aclients log2gpx gen_packets atest ttcalc kissutil
|
||||||
|
# tnctest tnctest-issue-132
|
||||||
|
|
||||||
|
|
||||||
# People say we need -mthreads option for threads to work properly.
|
|
||||||
# They also say it creates a dependency on mingwm10.dll but I'm not seeing that.
|
|
||||||
# Maybe that is for pthreads. We are using the Windows threads.
|
|
||||||
|
|
||||||
# -Ofast was added in gcc 4.6 which was the MinGW version back in 2012.
|
# October 2019, version 1.6: 64 bit target for Windows. It runs twice as fast!
|
||||||
|
# Originally I installed MinGW outside of Cygwin and added location to PATH in .bash_profile.
|
||||||
|
# Install these two Cygwin packages so the compiler is in /usr/bin
|
||||||
|
# and no special PATH is required.
|
||||||
|
# mingw64-x86_64-gcc-core (7.4.0-1)
|
||||||
|
# mingw64-x86_64-gcc-g++ (7.4.0-1)
|
||||||
|
|
||||||
|
CC ?= x86_64-w64-mingw32-gcc
|
||||||
|
CXX ?= x86_64-w64-mingw32-g++
|
||||||
|
AR ?= x86_64-w64-mingw32-ar
|
||||||
|
WINDRES ?= x86_64-w64-mingw32-windres
|
||||||
|
|
||||||
|
# MinGW requires "-mthreads" option for threadsafe operation.
|
||||||
|
|
||||||
|
CFLAGS := -Ofast -Iregex -Iutm -Igeotranz -mthreads -DUSE_REGEX_STATIC -Wall -Wlogical-op
|
||||||
|
|
||||||
|
# For a 32 bit target, install these Cygwin packages.
|
||||||
|
# mingw64-i686gcc-core (7.4.0-1)
|
||||||
|
# mingw64-i686gcc-g++ (7.4.0-1)
|
||||||
|
# i686 corresponds to Pentium II.
|
||||||
|
# We need to add Pentium III and SSE instructions to speed things up.
|
||||||
|
# Pentium 4 and SSE2 offers no advantage so no reason to bump up minimum CPU requirement.
|
||||||
|
# Code for the 64 bit target runs about twice as fast, so use that if possible.
|
||||||
|
|
||||||
|
#CC = i686-w64-mingw32-gcc
|
||||||
|
#CXX = i686-w64-mingw32-g++
|
||||||
|
#AR = i686-w64-mingw32-ar
|
||||||
|
#WINDRES = i686-w64-mingw32-windres
|
||||||
|
#CFLAGS += -march=pentium3 -msse
|
||||||
|
|
||||||
CC := gcc
|
|
||||||
CFLAGS := -Ofast -march=pentium3 -msse -Iregex -Iutm -Igeotranz -mthreads -DUSE_REGEX_STATIC -Wall -Wlogical-op
|
|
||||||
AR := ar
|
|
||||||
|
|
||||||
CFLAGS += -g
|
CFLAGS += -g
|
||||||
# TEMP EXPERIMENT - DO NOT RELEASE
|
# TEMP EXPERIMENT - DO NOT RELEASE
|
||||||
|
@ -49,37 +69,10 @@ CFLAGS += -g
|
||||||
CFLAGS += -Wsign-compare
|
CFLAGS += -Wsign-compare
|
||||||
CFLAGS += -Wuninitialized
|
CFLAGS += -Wuninitialized
|
||||||
CFLAGS += -Wold-style-declaration
|
CFLAGS += -Wold-style-declaration
|
||||||
# CFLAGS += -fdelete-null-pointer-checks -Wnull-dereference ---not recognized
|
CFLAGS += -Wnull-dereference
|
||||||
|
CFLAGS += -fdelete-null-pointer-checks
|
||||||
|
#CFLAGS += -Wmissing-prototypes
|
||||||
#CFLAGS += -Wold-style-definition
|
#CFLAGS += -Wold-style-definition
|
||||||
#-Wmissing-prototypes
|
|
||||||
|
|
||||||
#
|
|
||||||
# Let's see impact of various optimization levels.
|
|
||||||
# Benchmark results with MinGW gcc version 4.6.2.
|
|
||||||
#
|
|
||||||
# seconds options, comments
|
|
||||||
# ------ -----------------
|
|
||||||
# 119.8 -O2 Used for version 0.8
|
|
||||||
# 92.1 -O3
|
|
||||||
# 88.7 -Ofast (should be same as -O3 -ffastmath)
|
|
||||||
# 87.5 -Ofast -march=pentium
|
|
||||||
# 74.1 -Ofast -msse
|
|
||||||
# 72.2 -Ofast -march=pentium -msse
|
|
||||||
# 62.0 -Ofast -march=pentium3 (this implies -msse)
|
|
||||||
# 61.9 -Ofast -march=pentium3 -msse
|
|
||||||
#
|
|
||||||
# A minimum of Windows XP is required due to some of the system
|
|
||||||
# features being used. XP requires a Pentium processor or later.
|
|
||||||
# The DSP filters can be sped up considerably with the SSE instructions.
|
|
||||||
# The SSE instructions were introduced in 1999 with the
|
|
||||||
# Pentium III series.
|
|
||||||
# SSE2 instructions, added in 2000, don't seem to offer any advantage.
|
|
||||||
#
|
|
||||||
# For version 0.9, a Pentium 3 or equivalent is now the minimum required
|
|
||||||
# for the prebuilt Windows distribution.
|
|
||||||
# If you insist on using a computer from the previous century,
|
|
||||||
# you can compile this yourself with different options.
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,7 +102,7 @@ direwolf : direwolf.o config.o recv.o demod.o dsp.o demod_afsk.o demod_psk.o dem
|
||||||
$(CC) $(CFLAGS) -o $@ $^ -lwinmm -lws2_32
|
$(CC) $(CFLAGS) -o $@ $^ -lwinmm -lws2_32
|
||||||
|
|
||||||
dw-icon.o : dw-icon.rc dw-icon.ico
|
dw-icon.o : dw-icon.rc dw-icon.ico
|
||||||
windres dw-icon.rc -o $@
|
$(WINDRES) dw-icon.rc -o $@
|
||||||
|
|
||||||
|
|
||||||
# Optimization for slow processors.
|
# Optimization for slow processors.
|
||||||
|
@ -211,7 +204,7 @@ appserver : appserver.o agwlib.o dwsock.o textcolor.o dtime_now.o misc.a
|
||||||
# UTM, USNG, MGRS conversions.
|
# UTM, USNG, MGRS conversions.
|
||||||
|
|
||||||
geotranz.a : error_string.o mgrs.o polarst.o tranmerc.o ups.o usng.o utm.o
|
geotranz.a : error_string.o mgrs.o polarst.o tranmerc.o ups.o usng.o utm.o
|
||||||
ar -cr $@ $^
|
$(AR) -cr $@ $^
|
||||||
|
|
||||||
error_string.o : geotranz/error_string.c
|
error_string.o : geotranz/error_string.c
|
||||||
$(CC) $(CFLAGS) -c -o $@ $^
|
$(CC) $(CFLAGS) -c -o $@ $^
|
||||||
|
@ -243,7 +236,7 @@ utm.o : geotranz/utm.c
|
||||||
# Consider upgrading from https://www.gnu.org/software/libc/sources.html
|
# Consider upgrading from https://www.gnu.org/software/libc/sources.html
|
||||||
|
|
||||||
regex.a : regex.o
|
regex.a : regex.o
|
||||||
ar -cr $@ $^
|
$(AR) -cr $@ $^
|
||||||
|
|
||||||
regex.o : regex/regex.c
|
regex.o : regex/regex.c
|
||||||
$(CC) $(CFLAGS) -Dbool=int -Dtrue=1 -Dfalse=0 -c -o $@ $^
|
$(CC) $(CFLAGS) -Dbool=int -Dtrue=1 -Dfalse=0 -c -o $@ $^
|
||||||
|
@ -254,7 +247,7 @@ regex.o : regex/regex.c
|
||||||
# but not on Windows. Need to provide our own copy.
|
# but not on Windows. Need to provide our own copy.
|
||||||
|
|
||||||
misc.a : strsep.o strtok_r.o strcasestr.o strlcpy.o strlcat.o
|
misc.a : strsep.o strtok_r.o strcasestr.o strlcpy.o strlcat.o
|
||||||
ar -cr $@ $^
|
$(AR) -cr $@ $^
|
||||||
|
|
||||||
strsep.o : misc/strsep.c
|
strsep.o : misc/strsep.c
|
||||||
$(CC) $(CFLAGS) -c -o $@ $^
|
$(CC) $(CFLAGS) -c -o $@ $^
|
||||||
|
|
21
audio_win.c
21
audio_win.c
|
@ -222,8 +222,8 @@ static struct adev_s {
|
||||||
*----------------------------------------------------------------*/
|
*----------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
static void CALLBACK in_callback (HWAVEIN handle, UINT msg, DWORD instance, DWORD param1, DWORD param2);
|
static void CALLBACK in_callback (HWAVEIN handle, UINT msg, DWORD_PTR instance, DWORD_PTR param1, DWORD_PTR param2);
|
||||||
static void CALLBACK out_callback (HWAVEOUT handle, UINT msg, DWORD instance, DWORD param1, DWORD param2);
|
static void CALLBACK out_callback (HWAVEOUT handle, UINT msg, DWORD_PTR instance, DWORD_PTR param1, DWORD_PTR param2);
|
||||||
|
|
||||||
int audio_open (struct audio_s *pa)
|
int audio_open (struct audio_s *pa)
|
||||||
{
|
{
|
||||||
|
@ -684,24 +684,25 @@ int audio_open (struct audio_s *pa)
|
||||||
* Called when input audio block is ready.
|
* Called when input audio block is ready.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void CALLBACK in_callback (HWAVEIN handle, UINT msg, DWORD instance, DWORD param1, DWORD param2)
|
static void CALLBACK in_callback (HWAVEIN handle, UINT msg, DWORD_PTR instance, DWORD_PTR param1, DWORD_PTR param2)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//dw_printf ("in_callback, handle = %p, msg = %d, instance = %I64d\n", handle, msg, instance);
|
||||||
|
|
||||||
int a = instance;
|
int a = instance;
|
||||||
|
|
||||||
//dw_printf ("in_callback, handle = %d, a = %d\n", (int)handle, a);
|
|
||||||
|
|
||||||
assert (a >= 0 && a < MAX_ADEVS);
|
assert (a >= 0 && a < MAX_ADEVS);
|
||||||
struct adev_s *A = &(adev[a]);
|
struct adev_s *A = &(adev[a]);
|
||||||
|
|
||||||
|
|
||||||
if (msg == WIM_DATA) {
|
if (msg == WIM_DATA) {
|
||||||
|
|
||||||
WAVEHDR *p = (WAVEHDR*)param1;
|
WAVEHDR *p = (WAVEHDR*)param1;
|
||||||
|
|
||||||
p->dwUser = -1; /* needs to be unprepared. */
|
p->dwUser = 0x5a5a5a5a; /* needs to be unprepared. */
|
||||||
|
/* dwUser can be 32 or 64 bit unsigned int. */
|
||||||
p->lpNext = NULL;
|
p->lpNext = NULL;
|
||||||
|
|
||||||
|
// dw_printf ("dwBytesRecorded = %ld\n", p->dwBytesRecorded);
|
||||||
|
|
||||||
EnterCriticalSection (&(A->in_cs));
|
EnterCriticalSection (&(A->in_cs));
|
||||||
|
|
||||||
if (A->in_headp == NULL) {
|
if (A->in_headp == NULL) {
|
||||||
|
@ -726,7 +727,7 @@ static void CALLBACK in_callback (HWAVEIN handle, UINT msg, DWORD instance, DWOR
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
static void CALLBACK out_callback (HWAVEOUT handle, UINT msg, DWORD instance, DWORD param1, DWORD param2)
|
static void CALLBACK out_callback (HWAVEOUT handle, UINT msg, DWORD_PTR instance, DWORD_PTR param1, DWORD_PTR param2)
|
||||||
{
|
{
|
||||||
if (msg == WOM_DONE) {
|
if (msg == WOM_DONE) {
|
||||||
|
|
||||||
|
@ -807,7 +808,7 @@ int audio_get (int a)
|
||||||
|
|
||||||
p = (WAVEHDR*)(A->in_headp); /* no need to be volatile at this point */
|
p = (WAVEHDR*)(A->in_headp); /* no need to be volatile at this point */
|
||||||
|
|
||||||
if (p->dwUser == (DWORD)(-1)) {
|
if (p->dwUser == 0x5a5a5a5a) { // dwUser can be 32 or bit unsigned.
|
||||||
waveInUnprepareHeader(A->audio_in_handle, p, sizeof(WAVEHDR));
|
waveInUnprepareHeader(A->audio_in_handle, p, sizeof(WAVEHDR));
|
||||||
p->dwUser = 0; /* Index for next byte. */
|
p->dwUser = 0; /* Index for next byte. */
|
||||||
|
|
||||||
|
|
19
beacon.c
19
beacon.c
|
@ -59,25 +59,6 @@
|
||||||
#include "mheard.h"
|
#include "mheard.h"
|
||||||
|
|
||||||
|
|
||||||
#if __WIN32__
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Windows doesn't have localtime_r.
|
|
||||||
* It should have the equivalent localtime_s, with opposite parameter
|
|
||||||
* order, but I get undefined reference when trying to use it.
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct tm *localtime_r(time_t *clock, struct tm *res)
|
|
||||||
{
|
|
||||||
struct tm *tm;
|
|
||||||
|
|
||||||
tm = localtime (clock);
|
|
||||||
memcpy (res, tm, sizeof(struct tm));
|
|
||||||
return (res);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Save pointers to configuration settings.
|
* Save pointers to configuration settings.
|
||||||
|
|
10
direwolf.h
10
direwolf.h
|
@ -27,6 +27,7 @@
|
||||||
#define _WIN32_WINNT 0x0501 /* Minimum OS version is XP. */
|
#define _WIN32_WINNT 0x0501 /* Minimum OS version is XP. */
|
||||||
#define WINVER 0x0501 /* Minimum OS version is XP. */
|
#define WINVER 0x0501 /* Minimum OS version is XP. */
|
||||||
|
|
||||||
|
#include <winsock2.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -109,11 +110,14 @@
|
||||||
|
|
||||||
|
|
||||||
#if __WIN32__
|
#if __WIN32__
|
||||||
|
|
||||||
#define PTW32_STATIC_LIB
|
#define PTW32_STATIC_LIB
|
||||||
//#include "pthreads/pthread.h"
|
//#include "pthreads/pthread.h"
|
||||||
#define gmtime_r( _clock, _result ) \
|
|
||||||
( *(_result) = *gmtime( (_clock) ), \
|
// This enables definitions of localtime_r and gmtime_r in system time.h.
|
||||||
(_result) )
|
//#define _POSIX_THREAD_SAFE_FUNCTIONS 1
|
||||||
|
#define _POSIX_C_SOURCE 1
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
19
dtime_now.c
19
dtime_now.c
|
@ -84,25 +84,6 @@ double dtime_now (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if __WIN32__
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Windows doesn't have localtime_r.
|
|
||||||
* It should have the equivalent localtime_s, with opposite parameter
|
|
||||||
* order, but I get undefined reference when trying to use it.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static struct tm *localtime_r(time_t *clock, struct tm *res)
|
|
||||||
{
|
|
||||||
struct tm *tm;
|
|
||||||
|
|
||||||
tm = localtime (clock);
|
|
||||||
memcpy (res, tm, sizeof(struct tm));
|
|
||||||
return (res);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------
|
/*------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue