parent
3f93d5ab9f
commit
94216b0741
@ -0,0 +1,13 @@
|
||||
|
||||
include Makefile.config
|
||||
|
||||
TARGET = $(APP).exe
|
||||
CROSSENV = /opt/W64-cross-compile/
|
||||
CPP = /usr/bin/x86_64-w64-mingw32-g++
|
||||
CPPFLAGS = -ggdb -Wall -O0 `PKG_CONFIG_PATH=$(CROSSENV)/lib/pkgconfig pkg-config --cflags gtk+-3.0 gmodule-export-2.0` -Wl,--export-dynamic -DBUILD_WINDOWS=1 -Wdeprecated
|
||||
INCLUDES =
|
||||
LDFLAGS = -lws2_32 -ljpeg
|
||||
LIBS = `PKG_CONFIG_PATH=$(CROSSENV)/lib/pkgconfig pkg-config --libs gtk+-3.0 gmodule-export-2.0` -L/usr/lib -mwindows
|
||||
|
||||
OBJECTS := $(OBJECTS) windows.oo
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
CROSS_DEST_DIR=/opt/W64-cross-compile/lib
|
||||
CROSS_COMPILER_DIR=/usr/x86_64-w64-mingw32/lib
|
||||
CROSS_GCC_DIR=/usr/lib/gcc/x86_64-w64-mingw32/10-win32
|
||||
|
||||
cp -v $CROSS_COMPILER_DIR/zlib1.dll ./
|
||||
|
||||
# copy dll dependencys
|
||||
copy_dependency() {
|
||||
local I
|
||||
for I in `strings $1 | grep -i '\.dll$' | grep -e "^lib"`
|
||||
do
|
||||
if [ -e ./$I ]
|
||||
then
|
||||
echo "File Exist"
|
||||
|
||||
elif [ -e $CROSS_COMPILER_DIR/$I ]
|
||||
then
|
||||
cp -v $CROSS_COMPILER_DIR/$I ./
|
||||
copy_dependency $CROSS_COMPILER_DIR/$I
|
||||
|
||||
elif [ -e $CROSS_GCC_DIR/$I ]
|
||||
then
|
||||
cp -v $CROSS_GCC_DIR/$I ./
|
||||
copy_dependency $CROSS_GCC_DIR/$I
|
||||
|
||||
elif [ -e $CROSS_DEST_DIR/$I ]
|
||||
then
|
||||
cp -v $CROSS_DEST_DIR/$I ./
|
||||
copy_dependency $CROSS_DEST_DIR/$I
|
||||
fi
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
copy_dependency simpleskycam.exe
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
CROSS_PREFIX=/opt/W64-cross-compile
|
||||
|
||||
mkdir share
|
||||
cp -rf $CROSS_PREFIX/share/glib-2.0 share/glib-2.0
|
||||
cp -rf $CROSS_PREFIX/share/gtk-2.0 share/gtk-4.0
|
||||
cp -rf $CROSS_PREFIX/share/gtk-3.0 share/gtk-3.0
|
||||
cp -rf $CROSS_PREFIX/share/icons share/icons
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <glib.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
GMutex debug_mutex;
|
||||
|
||||
#define LEN 2048
|
||||
|
||||
void debug_init() {
|
||||
g_mutex_init (&debug_mutex);
|
||||
}
|
||||
|
||||
void debug_tofile(char *fname, char *fmt, ...) {
|
||||
static struct timeval tv;
|
||||
static int firstrun = 1;
|
||||
struct timeval tv1;
|
||||
va_list args;
|
||||
char buffer[LEN];
|
||||
int fd, len;
|
||||
long long int ms;
|
||||
|
||||
std::string s = setlocale(LC_ALL, NULL);
|
||||
setlocale (LC_ALL, "C");
|
||||
|
||||
g_mutex_lock(&debug_mutex);
|
||||
|
||||
if (firstrun) {
|
||||
gettimeofday(&tv,NULL);
|
||||
firstrun = 0;
|
||||
}
|
||||
gettimeofday(&tv1,NULL);
|
||||
ms = ((tv1.tv_sec - tv.tv_sec) * 1000) +
|
||||
((tv1.tv_usec - tv.tv_usec) / 1000);
|
||||
#ifdef BUILD_WINDOWS
|
||||
fd = open(fname, O_WRONLY | O_APPEND | O_CREAT);
|
||||
#else
|
||||
fd = open(fname, O_WRONLY | O_APPEND | O_CREAT, S_IRUSR | S_IWUSR);
|
||||
#endif
|
||||
if (fd < 0) errorexit((char*)"%s:%d could not open debug '%s' file. Error:%s\n", __FILE__, __LINE__, fname, strerror(errno));
|
||||
|
||||
snprintf (buffer, 32, "%lld,", ms);
|
||||
len = strlen (buffer);
|
||||
va_start (args, fmt);
|
||||
vsnprintf (buffer+len, LEN-1-len, fmt, args);
|
||||
va_end (args);
|
||||
buffer[LEN-1] = 0;
|
||||
write (fd, buffer, strlen(buffer));
|
||||
close (fd);
|
||||
g_mutex_unlock(&debug_mutex);
|
||||
|
||||
setlocale (LC_ALL, s.c_str());
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include "windows.h"
|
||||
|
||||
void strfromd (char* dest, int len, char *fmt,...) {
|
||||
va_list args;
|
||||
|
||||
va_start (args, fmt);
|
||||
vsnprintf (dest, len-1, fmt, args);
|
||||
va_end (args);
|
||||
dest[len-1] = 0;
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
|
||||
#ifndef _WINDOWS_H_
|
||||
#define _WINDOWS_H_
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
#define _NTDDI_VERSION_FROM_WIN32_WINNT2(ver) ver##0000
|
||||
#define _NTDDI_VERSION_FROM_WIN32_WINNT(ver) _NTDDI_VERSION_FROM_WIN32_WINNT2(ver)
|
||||
|
||||
#ifndef _WIN32_WINNT
|
||||
# define _WIN32_WINNT 0x501
|
||||
#endif
|
||||
#ifndef NTDDI_VERSION
|
||||
# define NTDDI_VERSION _NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
|
||||
#endif
|
||||
|
||||
// #include <winsock.h>
|
||||
#include <winsock2.h>
|
||||
#include <io.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <string.h>
|
||||
|
||||
#define socklen_t size_t
|
||||
|
||||
#ifndef bzero
|
||||
#define bzero(__z__, __x__) memset (__z__, 0x0, __x__)
|
||||
#endif
|
||||
|
||||
#ifndef MSG_NOSIGNAL
|
||||
# define MSG_NOSIGNAL 0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
extern void strfromd (char* dest, int len, char *fmt,...);
|
||||
|
||||
|
||||
#define __u32 uint32_t
|
||||
|
||||
/*
|
||||
* since this application is ported from linux and uses some linux based definitions
|
||||
* we needed to copy some of the definitions and information.
|
||||
*
|
||||
* the following part comes from the Video 4 Linux 2 source more details can be found
|
||||
* at https://linuxtv.org.
|
||||
*/
|
||||
|
||||
#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */
|
||||
#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */
|
||||
#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
|
||||
#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */
|
||||
#define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16 YUV 4:2:2 */
|
||||
#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */
|
||||
#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */
|
||||
#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */
|
||||
#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */
|
||||
#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */
|
||||
#define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */
|
||||
#define V4L2_PIX_FMT_SGRBG16 v4l2_fourcc('G', 'R', '1', '6') /* 16 GRGR.. BGBG.. */
|
||||
|
||||
|
||||
#define v4l2_fourcc(a, b, c, d)\
|
||||
((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24))
|
||||
#define v4l2_fourcc_be(a, b, c, d) (v4l2_fourcc(a, b, c, d) | (1U << 31))
|
||||
|
||||
|
||||
#endif
|
||||
Loading…
Reference in new issue