aboutsummaryrefslogtreecommitdiffhomepage
path: root/backends
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2021-06-28 22:30:02 +0200
committercbdev <cb@cbcdn.com>2021-06-28 22:30:02 +0200
commit979ca16917cfca16b42f6f0464ff6c5cd41473b1 (patch)
tree21f26046109ccfcff9a431c111487269e6593495 /backends
parent17551fe56c8dc20630811b1726559b00cb911abd (diff)
downloadmidimonster-979ca16917cfca16b42f6f0464ff6c5cd41473b1.tar.gz
midimonster-979ca16917cfca16b42f6f0464ff6c5cd41473b1.tar.bz2
midimonster-979ca16917cfca16b42f6f0464ff6c5cd41473b1.zip
Improve windows build
Diffstat (limited to 'backends')
-rw-r--r--backends/Makefile3
-rw-r--r--backends/libmmbackend.c8
-rw-r--r--backends/python.c4
3 files changed, 13 insertions, 2 deletions
diff --git a/backends/Makefile b/backends/Makefile
index 6c46007..be870d6 100644
--- a/backends/Makefile
+++ b/backends/Makefile
@@ -93,6 +93,9 @@ lua.dll: LDLIBS += -L../ -llua53
# info from this one seems to include the actual interpreter library only on some systems, which makes it worse than useless.
python.so: CFLAGS += $(shell python3-config --includes || pkg-config --cflags python3 || pkg-config --cflags python || echo "-DBUILD_ERROR=\"Missing pkg-config data for python3\"")
python.so: LDLIBS += $(shell pkg-config --libs python3-embed || python3-config --libs || pkg-config --libs python3 || echo "-DBUILD_ERROR=\"Missing pkg-config data for python3\"")
+python.so: LDFLAGS += $(shell python3-config --ldflags || echo "-DBUILD_ERROR=\"Missing pkg-config data for python3\"")
+python.dll: CFLAGS += $(shell python3-config --includes || echo "-DBUILD_ERROR=\"Missing pkg-config data for python3\"")
+python.dll: LDLIBS += -L../ -lpython3
# Generic rules on how to build .SO/.DLL's from C and CPP sources
%.so :: %.c %.h $(BACKEND_LIB)
diff --git a/backends/libmmbackend.c b/backends/libmmbackend.c
index bad048c..18611e1 100644
--- a/backends/libmmbackend.c
+++ b/backends/libmmbackend.c
@@ -3,6 +3,10 @@
#define LOGPF(format, ...) fprintf(stderr, "libmmbe\t" format "\n", __VA_ARGS__)
#define LOG(message) fprintf(stderr, "libmmbe\t%s\n", (message))
+#ifndef _WIN32
+ #define closesocket close
+#endif
+
int mmbackend_strdup(char** dest, char* src){
if(*dest){
free(*dest);
@@ -186,14 +190,14 @@ int mmbackend_socket(char* host, char* port, int socktype, uint8_t listener, uin
if(listener){
status = bind(fd, addr_it->ai_addr, addr_it->ai_addrlen);
if(status < 0){
- close(fd);
+ closesocket(fd);
continue;
}
}
else{
status = connect(fd, addr_it->ai_addr, addr_it->ai_addrlen);
if(status < 0){
- close(fd);
+ closesocket(fd);
continue;
}
}
diff --git a/backends/python.c b/backends/python.c
index c1a21be..9c0caa1 100644
--- a/backends/python.c
+++ b/backends/python.c
@@ -1,6 +1,10 @@
#define BACKEND_NAME "python"
//#define DEBUG
+#ifdef _WIN32
+ #include <direct.h>
+#endif
+
#define PY_SSIZE_T_CLEAN
#include <string.h>
#include <Python.h>