Skip to content

Commit

Permalink
Fix build issues with Qt adapter example
Browse files Browse the repository at this point in the history
Build and run with:
> QT_MOC=$(qmake -query QT_HOST_LIBEXECS)/moc \
    QT_INCLUDE_DIR=$(qmake -query QT_INSTALL_HEADERS) \
    QT_LIBRARY_DIR=$(qmake -query QT_INSTALL_LIBS) \
    make example-async-qt
> ./example-async-qt

Signed-off-by: Björn Svensson <[email protected]>
  • Loading branch information
bjosv committed Aug 22, 2024
1 parent 219a129 commit f53c32d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions examples/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CC?=gcc
CXX?=g++

CFLAGS?=-Wall -Wextra -g -O2 -I../include
CFLAGS?=-fPIC -Wall -Wextra -g -O2 -I../include
STLIBNAME?=../lib/libvalkey.a

# Define examples
Expand Down Expand Up @@ -88,11 +88,11 @@ example-async-qt:
@false
else
example-async-qt: async-qt.cpp $(STLIBNAME)
$(QT_MOC) .adapters/qt.h -I$(QT_INCLUDE_DIR) -I$(QT_INCLUDE_DIR)/QtCore | \
$(QT_MOC) ../include/valkey/adapters/qt.h | \
$(CXX) -x c++ -o qt-adapter-moc.o -c - $(CFLAGS) -I$(QT_INCLUDE_DIR) -I$(QT_INCLUDE_DIR)/QtCore
$(QT_MOC) async-qt.h -I$(QT_INCLUDE_DIR) -I$(QT_INCLUDE_DIR)/QtCore | \
$(QT_MOC) async-qt.h | \
$(CXX) -x c++ -o qt-example-moc.o -c - $(CFLAGS) -I$(QT_INCLUDE_DIR) -I$(QT_INCLUDE_DIR)/QtCore
$(CXX) -o $@ $(CFLAGS) $(LDFLAGS) -I$(QT_INCLUDE_DIR) -I$(QT_INCLUDE_DIR)/QtCore -L$(QT_LIBRARY_DIR) qt-adapter-moc.o qt-example-moc.o $< -pthread $(STLIBNAME) -lQtCore
$(CXX) -o $@ $(CFLAGS) $(LDFLAGS) -I$(QT_INCLUDE_DIR) -I$(QT_INCLUDE_DIR)/QtCore -L$(QT_LIBRARY_DIR) qt-adapter-moc.o qt-example-moc.o $< -pthread $(STLIBNAME) -lQt6Core
endif

example-cluster-async: cluster-async.c $(STLIBNAME)
Expand Down
2 changes: 1 addition & 1 deletion examples/async-qt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using namespace std;
#include <QCoreApplication>
#include <QTimer>

#include "example-qt.h"
#include "async-qt.h"

void getCallback(valkeyAsyncContext *, void * r, void * privdata) {

Expand Down

0 comments on commit f53c32d

Please sign in to comment.