cmake_minimum_required(VERSION 3.16) project(MiaCob-P VERSION 0.1 LANGUAGES CXX) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) # your home director if(UNIX OR APPLE) set(HOME_DIR $ENV{HOME}) elseif(WIN32) set(HOME_DIR $ENV{USERPROFILE}) endif() # print for debugging message(STATUS "Home directory: ${HOME_DIR}") set(QT_DEBUG_FIND_PACKAGE ON) # Add WebEngineWidgets to your needs. find_package(QT NAMES Qt6 QT5 REQUIRED COMPONENTS Core Gui Widgets Sql Network OpcUa Multimedia MultimediaWidgets Designer Charts WebView PrintSupport WebEngineWidgets) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets Sql Network OpcUa Multimedia MultimediaWidgets Designer Charts WebView PrintSupport WebEngineWidgets) #find_package(Qt6 REQUIRED COMPONENTS WebEngineWidgets) # Set variables. set(SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}") set(BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}") # Paths to Open62541 include and library directories set(OPEN62541_INCDIR "${CMAKE_CURRENT_SOURCE_DIR}/src/3rdparty/open62541") set(OPEN62541_LIBDIR "/usr/local/lib") # Define the .qrc file set(RESOURCE_FILES stylessheet.qrc # Change this to your actual .qrc file name ) # Include Open62541 directory include_directories(${OPEN62541_INCDIR}) # Link Open62541 library directory link_directories(${OPEN62541_LIBDIR}) # Set includepaths for header files etc. include_directories(${SRC_DIR}/../) include_directories(${SRC_DIR}/../../) include_directories(${HOME_DIR}/linuxcnc-source-dir/src) include_directories(${HOME_DIR}/linuxcnc-source-dir/src/emc) include_directories(${HOME_DIR}/linuxcnc-source-dir/src/emc) include_directories(${HOME_DIR}/linuxcnc-source-dir/src/emc/tooldata) include_directories(${HOME_DIR}/linuxcnc-source-dir/src/emc/nml_intf) include_directories(${HOME_DIR}/linuxcnc-source-dir/src/emc/motion) include_directories(${HOME_DIR}/linuxcnc-source-dir/src/rtapi) include_directories(${HOME_DIR}/linuxcnc-source-dir/src/libnml/nml) include_directories(${HOME_DIR}/linuxcnc-source-dir/src/libnml/rcs) include_directories(${HOME_DIR}/linuxcnc-source-dir/src/libnml/cms) include_directories(${HOME_DIR}/linuxcnc-source-dir/src/libnml/posemath) include_directories(${HOME_DIR}/linuxcnc-source-dir/src/emc/rs274ngc) include_directories(${HOME_DIR}/linuxcnc-source-dir/src/emc/usr_intf/axis/extensions) include_directories(${HOME_DIR}/linuxcnc-source-dir/src/hal) include_directories(${HOME_DIR}/Qt/Tools/QtCreator/lib/Qt/plugins/designer) include_directories(${HOME_DIR}/.progetti/wled-designer-plugin) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/plugins/opcua/open62541) # Check for Open62541 library #set(OPEN62541_FOUND OFF) # Check if system Open62541 is being used #if(NOT QT_USE_SYSTEM_OPEN62541) # Optionally include the open62541.pri equivalent, if necessary # include(${CMAKE_CURRENT_SOURCE_DIR}/src/3rdparty/open62541.cmake) # Create this file for equivalent CMake config # set(OPEN62541_FOUND ON) #else() # If the system version is used, you can handle it as necessary # You may also want to find the system-installed Open62541 library # find_package(Open62541 REQUIRED) # Assuming Open62541 has a CMake config #endif() set(PROJECT_SOURCES WLED.cpp adduser.cpp bmeccircularprog.cpp bmecdia2.cpp diatraspwin.cpp donutbreakdownchart.cpp gcopcuaserver.cpp global_const_comm.cpp helpassistances.cpp helpbar.cpp helpcobot.cpp helpgraphic.cpp helphome.cpp helpimpostazioni.cpp helpinout.cpp helpricette.cpp highlightrectitem.cpp highlightrectitemh.cpp login.cpp main.cpp mainslice.cpp mainwindow.cpp #opcuamodel.cpp palletscene.cpp qledv.cpp qtoggleableqlabel.cpp rettangolo.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/plugins/opcua/open62541/qopen62541utils.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/plugins/opcua/open62541/qopen62541valueconverter.cpp videoplayer.cpp StdNameData.h WLED.h adduser.h bmeccircularprog.h bmecdia2.h boxStdData.h diatraspwin.h donutbreakdownchart.h gcBusBoxData.h gcopcuaserver.h get_command.h global_const_comm.h hal_priv.h helpassistances.h helpbar.h helpcobot.h helpgraphic.h helphome.h helpimpostazioni.h helpinout.h helpricette.h highlightrectitem.h highlightrectitemh.h login.h mainslice.h mainwindow.h palletscene.h qledv.h qtoggleableqlabel.h rettangolo.h send_command.h videoplayer.h adduser.ui bmecdia2.ui diatraspwin.ui helpassistances.ui helpbar.ui helpcobot.ui helpgraphic.ui helphome.ui helpimpostazioni.ui helpinout.ui helpricette.ui login.ui mainwindow.ui ) # Add the resource file using qt6_add_resources qt6_add_resources(PROJECT_RESOURCES ${RESOURCE_FILES}) if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) qt_add_executable(MiaCob-P MANUAL_FINALIZATION ${PROJECT_SOURCES} get_command.h send_command.h ) # Define target properties for Android with Qt 6 as: # set_property(TARGET bkt APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR # ${CMAKE_CURRENT_SOURCE_DIR}/android) # For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation #else() # if(ANDROID) # add_library(bkt SHARED # ${PROJECT_SOURCES} # ) # Define properties for Android with Qt 5 after find_package() calls as: # set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") # else() # add_executable(bkt # ${PROJECT_SOURCES} # ) # endif() endif() #add_library(open62541_ SHARED IMPORTED) # or STATIC instead of SHARED #add_library(open62541_ SHARED IMPORTED) #set_target_properties(open62541_ PROPERTIES # IMPORTED_LOCATION "/usr/local/lib/libopen62541.so" # INTERFACE_INCLUDE_DIRECTORIES "/usr/local/include/open62541" #) # Set include paths for libraries to link. add_library(linuxcnchal SHARED IMPORTED) # or STATIC instead of SHARED set_target_properties(linuxcnchal PROPERTIES IMPORTED_LOCATION "${HOME_DIR}/linuxcnc-source-dir/lib/liblinuxcnchal.so" INTERFACE_INCLUDE_DIRECTORIES "${HOME_DIR}/linuxcnc-source-dir/include" ) add_library(linuxcncini SHARED IMPORTED) # or STATIC instead of SHARED set_target_properties(linuxcncini PROPERTIES IMPORTED_LOCATION "${HOME_DIR}/linuxcnc-source-dir/lib/liblinuxcncini.so" INTERFACE_INCLUDE_DIRECTORIES "${HOME_DIR}/linuxcnc-source-dir/include" ) add_library(linuxcnc_a STATIC IMPORTED) # or STATIC instead of SHARED set_target_properties(linuxcnc_a PROPERTIES # IMPORTED_LOCATION "/home/user/lcncladdertest/lib/liblinuxcnc.a" IMPORTED_LOCATION "${HOME_DIR}/linuxcnc-source-dir/lib//liblinuxcnc.a" INTERFACE_INCLUDE_DIRECTORIES "${HOME_DIR}/linuxcnc-source-dir/include" ) # Set include paths for libraries to link. add_library(nml SHARED IMPORTED) # or STATIC instead of SHARED set_target_properties(nml PROPERTIES IMPORTED_LOCATION "${HOME_DIR}/linuxcnc-source-dir/lib/libnml.so" INTERFACE_INCLUDE_DIRECTORIES "${HOME_DIR}/linuxcnc-source-dir/include" ) add_library(rs274_ SHARED IMPORTED) # or STATIC instead of SHARED set_target_properties(rs274_ PROPERTIES IMPORTED_LOCATION "${HOME_DIR}/linuxcnc-source-dir/lib/librs274.so" INTERFACE_INCLUDE_DIRECTORIES "${HOME_DIR}/linuxcnc-source-dir/include" ) add_library(tooldata SHARED IMPORTED) # or STATIC instead of SHARED set_target_properties(tooldata PROPERTIES # IMPORTED_LOCATION "/home/user/lcncladdertest/lib/libtooldata.so" IMPORTED_LOCATION "${HOME_DIR}/linuxcnc-source-dir/lib/libtooldata.so" INTERFACE_INCLUDE_DIRECTORIES "${HOME_DIR}/linuxcnc-source-dir/include" ) target_sources(MiaCob-P PRIVATE ${PROJECT_RESOURCES}) if (BUILD_USPACE) add_definitions(-DULAPI) else () add_definitions(-DRTAPI) endif () target_link_libraries(MiaCob-P PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Sql Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Multimedia Qt${QT_VERSION_MAJOR}::MultimediaWidgets Qt${QT_VERSION_MAJOR}::Designer Qt${QT_VERSION_MAJOR}::Charts Qt${QT_VERSION_MAJOR}::WebView Qt${QT_VERSION_MAJOR}::PrintSupport Qt${QT_VERSION_MAJOR}::WebEngineWidgets Qt${QT_VERSION_MAJOR}::OpcUa Qt${QT_VERSION_MAJOR}::OpcUaPrivate ${OPEN62541_LIBDIR}/libopen62541.so linuxcnchal linuxcncini linuxcnc_a nml rs274_ tooldata GLU GL tirpc ) # Optionally include Open62541 headers if they are part of the include path #if(OPEN62541_FOUND) # target_include_directories(MiaCob-P PRIVATE ${OPEN62541_INCLUDE_DIRS}) #endif() #target_link_libraries(bkt PRIVATE Qt${QT_VERSION_MAJOR}::Widgets) # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. # If you are developing for iOS or macOS you should consider setting an # explicit, fixed bundle identifier manually though. if(${QT_VERSION} VERSION_LESS 6.1.0) set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.MiaCob-P) endif() set_target_properties(MiaCob-P PROPERTIES ${BUNDLE_ID_OPTION} MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} MACOSX_BUNDLE TRUE WIN32_EXECUTABLE TRUE ) include(GNUInstallDirs) install(TARGETS MiaCob-P BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) if(QT_VERSION_MAJOR EQUAL 6) qt_finalize_executable(MiaCob-P) endif()