Commit ad92d8d9 authored by Mathieu L Bouchard's avatar Mathieu L Bouchard
Browse files

settings for compiling & linking C++/Qt code to Pd

parent f2cf4e42
......@@ -10,7 +10,7 @@ AC_SUBST(portmidi, no)
AC_SUBST(binarymode, -m755)
AC_SUBST(fftw, no)
AC_SUBST(tk, yes)
AC_SUBST(qt, yes)
AC_SUBST(qt, no)
AC_SUBST(PDLIB)
AC_SUBST(CPPFLAGS)
AC_SUBST(MORECFLAGS)
......
#include <stdio.h>
#include <sys/time.h>
#include <unistd.h>
#include <QtWidgets/QApplication>
#include "g_qt.h"
int tv_ms_diff (timeval &a, timeval &b) {
return (a.tv_sec-b.tv_sec)*1000 + (a.tv_usec-b.tv_usec)/1000;
}
void qt_thread_main () {
int argc=0; char **argv=0;
//QApplication app(argc,argv);
timeval t0,t1;
gettimeofday(&t0,0);
for (;;) {
gettimeofday(&t1,0);
fprintf(stderr, "Qt thread running... (%d s)\n", tv_ms_diff(t1,t0));
sleep(2);
}
}
......@@ -84,6 +84,10 @@ TYPE_PUNNING_OBJ = $(TYPE_PUNNING_SRC:.c=.o)
OPT_SAFE_OBJ = $(OPT_SAFE_SRC:.c=.o)
OBJ = $(SRC:.c=.o)
ifeq ($(QTGUI), yes)
OBJ += g_qt.moc.o g_qt.o
endif
GSRC = @GUISRC@
GOBJ = $(GSRC:.c=.o)
......@@ -102,6 +106,16 @@ ifneq ($(PD_TEST_VERSION),)
PD_VERSION := $(PD_VERSION)-$(PD_TEST_VERSION)
endif
# C++/Qt
CXX = g++
CXXFLAGS =
MOC = moc
QT_INCLUDE = -I/usr/include/qt5 -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore
ifeq ($(QTGUI),yes)
LDFLAGS += -L/usr/lib/i386-linux-gnu
LIB += -lQt5Core -lQt5Gui -lQt5Widgets
endif
#
# ------------------ targets ------------------------------------
#
......@@ -126,6 +140,15 @@ $(GOBJ) : %.o : %.c
$(ASIOOBJ): %.o : %.cpp
$(CXX) $(CFLAGS) $(INCLUDE) -c -o $(OBJ_DIR)/$*.o $*.cpp
../obj/g_qt.moc.cpp : g_qt.h
$(MOC) $(CPPFLAGS) $(QT_INCLUDE) $< -o ../obj/$@
../obj/g_qt.moc.o : ../obj/g_qt.moc.cpp
$(CXX) $(CFLAGS) $(CXXFLAGS) $(QT_INCLUDE) -c ../obj/g_qt.moc.cpp -o ../obj/g_qt.moc.o
../obj/g_qt.o : g_qt.cpp
$(CXX) $(CFLAGS) $(CXXFLAGS) $(QT_INCLUDE) -fPIC -c g_qt.cpp -o ../obj/g_qt.o
pd: $(PDEXEC)
ifneq ($(GSRC),)
......@@ -148,8 +171,13 @@ $(BIN_DIR)/pdsend: u_pdsend.c $(BIN_DIR)
$(BIN_DIR)/pdreceive: u_pdreceive.c $(BIN_DIR)
$(CC) $(CFLAGS) $(STRIPFLAG) -o $(BIN_DIR)/pdreceive u_pdreceive.c
ifeq ($(QTGUI),yes)
$(PDEXEC): $(OBJ) $(BIN_DIR)
cd ../obj; $(CXX) $(LDFLAGS) $(DBG_CFLAGS) -o $(PDEXEC) $(OBJ) $(LIB)
else
$(PDEXEC): $(OBJ) $(BIN_DIR)
cd ../obj; $(CC) $(LDFLAGS) $(DBG_CFLAGS) -o $(PDEXEC) $(OBJ) $(LIB)
endif
$(BIN_DIR)/pd-gui: $(GOBJ) $(GSRC)
cd ../obj; $(CC) $(INCLUDE) -o $(BIN_DIR)/$(GUINAME) $(GOBJ) $(GLIB)
......@@ -259,6 +287,7 @@ install: all tkpath tkdnd
@echo "Pd install succeeded."
local-clean:
-rm -f -- ../obj/*.moc.cpp
-rm -f -- $(OBJ)
-rm -f ../obj/* $(PDEXEC) $(BIN_DIR)/$(GUINAME) $(BIN_DIR)/pdsend \
$(BIN_DIR)/pdreceive $(BIN_DIR)/pd-watchdog m_stamp.c
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment