2023-01-31 12:31:12 +00:00
|
|
|
project(DOtherSide)
|
|
|
|
|
2020-05-25 00:22:41 +00:00
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
2023-01-04 15:50:37 +00:00
|
|
|
option(MONITORING "Tools for real-time inspection of the application." OFF)
|
|
|
|
set(MONITORING_QML_ENTRY_POINT "" CACHE STRING "QML file intended to start the monitoring tool UI.")
|
|
|
|
|
2023-02-06 16:45:18 +00:00
|
|
|
include(../../../ui/StatusQ/StatusQSources.cmake)
|
|
|
|
|
2023-02-07 11:54:31 +00:00
|
|
|
if(MONITORING)
|
|
|
|
include(../../../ui/MonitoringSources.cmake)
|
|
|
|
endif()
|
|
|
|
|
2023-01-31 12:31:12 +00:00
|
|
|
# Macro for merging common code between static and shared
|
|
|
|
macro(add_target name type)
|
2022-02-10 14:03:31 +00:00
|
|
|
find_package(Qt5 COMPONENTS Core Qml Gui Quick QuickControls2 Widgets Network Multimedia REQUIRED)
|
2023-01-31 12:31:12 +00:00
|
|
|
|
2023-01-04 15:50:37 +00:00
|
|
|
file(GLOB HEADERS include/DOtherSide/*.h include/DOtherSide/Status/*.h)
|
|
|
|
file(GLOB SOURCES src/*.cpp src/Status/*.cpp)
|
|
|
|
|
2021-08-23 07:27:57 +00:00
|
|
|
if(APPLE)
|
2023-01-04 15:50:37 +00:00
|
|
|
file(GLOB MM_FILES src/*.mm src/Status/*.mm)
|
2023-01-17 10:57:25 +00:00
|
|
|
#prepend items because .mm files need build priority to override cpp impl
|
2023-02-07 11:54:31 +00:00
|
|
|
list(PREPEND SOURCES ${MM_FILES})
|
2021-05-19 14:09:03 +00:00
|
|
|
endif()
|
|
|
|
|
2023-02-03 16:36:07 +00:00
|
|
|
add_library(${name} ${type}
|
|
|
|
${SOURCES} ${HEADERS}
|
|
|
|
${MONITORING_SOURCES} ${MONITORING_HEADERS}
|
|
|
|
${STATUSQ_HEADERS} ${STATUSQ_SOURCES}
|
|
|
|
)
|
2021-08-23 07:27:57 +00:00
|
|
|
|
2023-01-31 12:31:12 +00:00
|
|
|
if (WIN32)
|
|
|
|
target_compile_definitions(${name} PRIVATE -DWIN32)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set_target_properties(${name} PROPERTIES CXX_STANDARD 11 AUTOMOC ON)
|
|
|
|
|
2023-02-03 16:36:07 +00:00
|
|
|
target_include_directories(${name} PUBLIC include include/Qt ${STATUSQ_DIR}/include)
|
2023-01-31 12:31:12 +00:00
|
|
|
|
2023-03-07 16:08:38 +00:00
|
|
|
target_link_libraries(${name} PRIVATE Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Qml Qt5::Quick Qt5::Network Qt5::Multimedia SortFilterProxyModel qzxing)
|
2023-01-31 12:31:12 +00:00
|
|
|
|
2022-08-11 09:20:13 +00:00
|
|
|
target_compile_definitions(${name} PRIVATE $<$<CONFIG:Debug>:QT_QML_DEBUG>)
|
|
|
|
if(DEFINED QML_DEBUG_PORT)
|
|
|
|
target_compile_definitions(${name} PRIVATE QML_DEBUG_PORT=${QML_DEBUG_PORT})
|
|
|
|
endif()
|
|
|
|
|
2023-01-04 15:50:37 +00:00
|
|
|
if(MONITORING)
|
2023-02-07 11:54:31 +00:00
|
|
|
target_include_directories(${name} PUBLIC ${MONITORING_INCLUDE_PATH})
|
|
|
|
|
2023-01-04 15:50:37 +00:00
|
|
|
target_compile_definitions(${name} PRIVATE MONITORING)
|
|
|
|
target_compile_definitions(${name} PRIVATE MONITORING_QML_ENTRY_POINT="${MONITORING_QML_ENTRY_POINT}")
|
|
|
|
endif()
|
|
|
|
|
2020-05-25 00:22:41 +00:00
|
|
|
# for DOtherSide.pc
|
2023-03-07 16:08:38 +00:00
|
|
|
set(PC_REQUIRES "Qt5Core, Qt5Gui, Qt5Widgets, Qt5Qml, Qt5Quick, Qt5Network, Qt5DBus, Qt5Multimedia, SortFilterProxyModel, qzxing")
|
2023-01-31 12:31:12 +00:00
|
|
|
if (${Qt5QuickControls2_FOUND})
|
|
|
|
target_link_libraries(${name} PRIVATE Qt5::QuickControls2)
|
2020-05-25 00:22:41 +00:00
|
|
|
set(PC_REQUIRES "${PC_REQUIRES}, Qt5QuickControls2")
|
2023-01-31 12:31:12 +00:00
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
set(major 0)
|
|
|
|
set(minor 6)
|
|
|
|
set(patch 4)
|
2020-05-25 00:22:41 +00:00
|
|
|
set(DOTHERSIDE_VERSION "${major}.${minor}.${patch}")
|
|
|
|
|
|
|
|
# Add shared version
|
|
|
|
if(ENABLE_DYNAMIC_LIBS)
|
|
|
|
add_target(${PROJECT_NAME} SHARED)
|
|
|
|
set_target_properties(${PROJECT_NAME}
|
|
|
|
PROPERTIES
|
|
|
|
SOVERSION "${major}.${minor}"
|
|
|
|
VERSION "${major}.${minor}.${patch}"
|
|
|
|
)
|
|
|
|
install(TARGETS ${PROJECT_NAME}
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
)
|
|
|
|
endif(ENABLE_DYNAMIC_LIBS)
|
2023-01-31 12:31:12 +00:00
|
|
|
|
|
|
|
# Add static version
|
2020-05-25 00:22:41 +00:00
|
|
|
if(ENABLE_STATIC_LIBS)
|
|
|
|
add_target(${PROJECT_NAME}Static STATIC)
|
|
|
|
install(TARGETS ${PROJECT_NAME}Static
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
)
|
|
|
|
endif(ENABLE_STATIC_LIBS)
|
2023-01-31 12:31:12 +00:00
|
|
|
|
|
|
|
# Install directive for header files
|
|
|
|
install(FILES
|
2020-05-25 00:22:41 +00:00
|
|
|
include/DOtherSide/DOtherSide.h
|
|
|
|
include/DOtherSide/DOtherSideTypes.h
|
|
|
|
DESTINATION include/DOtherSide
|
2023-01-31 12:31:12 +00:00
|
|
|
)
|
|
|
|
|
2020-05-25 00:22:41 +00:00
|
|
|
# pkg-config file
|
|
|
|
configure_file(${CMAKE_SOURCE_DIR}/DOtherSide.pc.cmake ${CMAKE_BINARY_DIR}/DOtherSide.pc @ONLY)
|
|
|
|
install(FILES ${CMAKE_BINARY_DIR}/DOtherSide.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
|
|
|
|