Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt support #884

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
/*.pc
*.dSYM
tags
build

2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ IF(NOT DISABLE_TESTS)
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/test.sh)
ENDIF()

ADD_SUBDIRECTORY(adapters)

# Add examples
IF(ENABLE_EXAMPLES)
ADD_SUBDIRECTORY(examples)
Expand Down
19 changes: 19 additions & 0 deletions adapters/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
find_package(Qt5Core)
IF (Qt5Core_FOUND)
set(CMAKE_AUTOMOC ON)
ADD_LIBRARY(hiredis-qt-adapter SHARED qt.h)
TARGET_COMPILE_DEFINITIONS(hiredis-qt-adapter PRIVATE ${Qt5Core_DEFINITIONS})
TARGET_INCLUDE_DIRECTORIES(hiredis-qt-adapter PRIVATE ${Qt5Core_INCLUDES})
TARGET_LINK_LIBRARIES(hiredis-qt-adapter hiredis ${Qt5Core_LIBRARIES})

ADD_LIBRARY(hiredis-qt-adapter_static STATIC qt.h)
TARGET_COMPILE_DEFINITIONS(hiredis-qt-adapter_static PRIVATE ${Qt5Core_DEFINITIONS})
TARGET_INCLUDE_DIRECTORIES(hiredis-qt-adapter_static PRIVATE ${Qt5Core_INCLUDES})
TARGET_LINK_LIBRARIES(hiredis-qt-adapter_static hiredis ${Qt5Core_LIBRARIES})

INSTALL(TARGETS hiredis-qt-adapter hiredis-qt-adapter_static
EXPORT hiredis-qt-adapter-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
ENDIF()
9 changes: 9 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ IF (ENABLE_SSL)
TARGET_LINK_LIBRARIES(example-ssl hiredis hiredis_ssl)
ENDIF()

find_package(Qt5Core)
IF (Qt5Core_FOUND)
SET(CMAKE_AUTOMOC ON)
ADD_EXECUTABLE(example-qt example-qt.cpp)
TARGET_COMPILE_DEFINITIONS(example-qt PRIVATE ${Qt5Core_DEFINITIONS})
TARGET_INCLUDE_DIRECTORIES(example-qt PRIVATE ${Qt5Core_INCLUDES})
TARGET_LINK_LIBRARIES(example-qt hiredis hiredis-qt-adapter ${Qt5Core_LIBRARIES})
ENDIF()

ADD_EXECUTABLE(example example.c)
TARGET_LINK_LIBRARIES(example hiredis)

Expand Down