Add SKIPQT support to cmake

This commit is contained in:
Philippe Teuwen 2020-06-09 00:34:41 +02:00
commit 6358c07ec1

View file

@ -13,6 +13,7 @@ if(CMAKE_VERSION VERSION_LESS "3.7.0")
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
endif() endif()
if (NOT SKIPQT EQUAL 1)
if(APPLE AND EXISTS /usr/local/opt/qt5) if(APPLE AND EXISTS /usr/local/opt/qt5)
# Homebrew installs Qt5 (up to at least 5.11.0) in # Homebrew installs Qt5 (up to at least 5.11.0) in
# /usr/local/qt5. Ensure that it can be found by CMake # /usr/local/qt5. Ensure that it can be found by CMake
@ -22,7 +23,7 @@ if(APPLE AND EXISTS /usr/local/opt/qt5)
# QT_FIND_PACKAGE_OPTIONS should be passed to find_package, # QT_FIND_PACKAGE_OPTIONS should be passed to find_package,
# e.g. find_package(Qt5Core ${QT_FIND_PACKAGE_OPTIONS}) # e.g. find_package(Qt5Core ${QT_FIND_PACKAGE_OPTIONS})
list(APPEND QT_FIND_PACKAGE_OPTIONS PATHS /usr/local/opt/qt5) list(APPEND QT_FIND_PACKAGE_OPTIONS PATHS /usr/local/opt/qt5)
endif() endif(APPLE AND EXISTS /usr/local/opt/qt5)
set(QT_PACKAGELIST set(QT_PACKAGELIST
Qt5Core Qt5Core
Qt5Widgets Qt5Widgets
@ -36,6 +37,7 @@ foreach(_qt_package IN LISTS QT_PACKAGELIST)
set(Qt5_FOUND OFF) set(Qt5_FOUND OFF)
endif(NOT ${_qt_package}_FOUND) endif(NOT ${_qt_package}_FOUND)
endforeach() endforeach()
endif (NOT SKIPQT EQUAL 1)
find_package(PkgConfig) find_package(PkgConfig)
if (NOT SKIPBT EQUAL 1) if (NOT SKIPBT EQUAL 1)
@ -203,8 +205,7 @@ if (APPLE)
set(ADDITIONAL_LNK "-framework Foundation" "-framework AppKit") set(ADDITIONAL_LNK "-framework Foundation" "-framework AppKit")
endif (APPLE) endif (APPLE)
if (Qt5_FOUND) if ((NOT SKIPQT EQUAL 1) AND (Qt5_FOUND))
message("Qt5 library found, building gui :)")
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON) set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)
@ -215,12 +216,11 @@ if (Qt5_FOUND)
add_definitions("-DHAVE_GUI") add_definitions("-DHAVE_GUI")
set(ADDITIONAL_LNK ${Qt5_LIBRARIES} ${ADDITIONAL_LNK}) set(ADDITIONAL_LNK ${Qt5_LIBRARIES} ${ADDITIONAL_LNK})
else (Qt5_FOUND) else ((NOT SKIPQT EQUAL 1) AND (Qt5_FOUND))
message("Qt5 library not found, not building gui")
set(TARGET_SOURCES set(TARGET_SOURCES
${PM3_ROOT}/client/src/guidummy.cpp ${PM3_ROOT}/client/src/guidummy.cpp
${TARGET_SOURCES}) ${TARGET_SOURCES})
endif (Qt5_FOUND) endif ((NOT SKIPQT EQUAL 1) AND (Qt5_FOUND))
if (NOT SKIPBT EQUAL 1) if (NOT SKIPBT EQUAL 1)
if (BLUEZ_FOUND) if (BLUEZ_FOUND)
@ -243,7 +243,17 @@ elseif (PYTHON3_FOUND)
set(ADDITIONAL_LNKDIRS ${PYTHON3_LIBRARY_DIRS} ${ADDITIONAL_LNKDIRS}) set(ADDITIONAL_LNKDIRS ${PYTHON3_LIBRARY_DIRS} ${ADDITIONAL_LNKDIRS})
endif (PYTHON3EMBED_FOUND) endif (PYTHON3EMBED_FOUND)
message(" ===================================================================)") message("===================================================================")
if (SKIPQT EQUAL 1)
message("GUI support: skipped")
else (SKIPQT EQUAL 1)
if (Qt5_FOUND)
message("GUI support: QT5 found, enabled")
else (Qt5_FOUND)
message("GUI support: QT5 not found, disabled")
endif (Qt5_FOUND)
endif (SKIPQT EQUAL 1)
if (SKIPBT EQUAL 1) if (SKIPBT EQUAL 1)
message("native BT support: skipped") message("native BT support: skipped")
else (SKIPBT EQUAL 1) else (SKIPBT EQUAL 1)
@ -253,7 +263,7 @@ else (SKIPBT EQUAL 1)
message("native BT support: Bluez not found, disabled") message("native BT support: Bluez not found, disabled")
endif (BLUEZ_FOUND) endif (BLUEZ_FOUND)
endif(SKIPBT EQUAL 1) endif(SKIPBT EQUAL 1)
message(" ===================================================================)") message("===================================================================")
add_executable(proxmark3 add_executable(proxmark3
${PM3_ROOT}/client/src/proxmark3.c ${PM3_ROOT}/client/src/proxmark3.c