Change the name of the project to smartvos and use a static libary for the core
This commit is contained in:
parent
d69bfb58b9
commit
6c6fc11439
2 changed files with 142 additions and 236 deletions
189
CMakeLists.txt
189
CMakeLists.txt
|
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required(VERSION 4.0)
|
||||
|
||||
project(SHinterface VERSION 1.0 LANGUAGES CXX)
|
||||
project(smartvos VERSION 1.0 LANGUAGES CXX)
|
||||
|
||||
# Set C++ standard
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
|
@ -27,88 +27,113 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|||
# Enable testing framework
|
||||
enable_testing()
|
||||
|
||||
# Define shared sources for static library (core sources used by both main and tests)
|
||||
set(SHINTERFACE_CORE_SOURCES
|
||||
src/sensors/mqttsensorsource.h
|
||||
src/sensors/mqttsensorsource.cpp
|
||||
src/items/mqttitem.h
|
||||
src/items/mqttitem.cpp
|
||||
src/mqttclient.h
|
||||
src/mqttclient.cpp
|
||||
src/microcontroller.h
|
||||
src/microcontroller.cpp
|
||||
src/sun.h
|
||||
src/sun.cpp
|
||||
src/programmode.h
|
||||
src/programmode.cpp
|
||||
|
||||
src/service/service.h
|
||||
src/service/service.cpp
|
||||
src/service/tcpclient.h
|
||||
src/service/tcpclient.cpp
|
||||
src/service/server.h
|
||||
src/service/server.cpp
|
||||
src/service/tcpserver.h
|
||||
src/service/tcpserver.cpp
|
||||
src/service/websocketserver.h
|
||||
src/service/websocketserver.cpp
|
||||
|
||||
src/actors/actor.h
|
||||
src/actors/actor.cpp
|
||||
src/actors/factoractor.h
|
||||
src/actors/factoractor.cpp
|
||||
src/actors/polynomalactor.h
|
||||
src/actors/polynomalactor.cpp
|
||||
src/actors/sensoractor.h
|
||||
src/actors/sensoractor.cpp
|
||||
src/actors/alarmtime.h
|
||||
src/actors/alarmtime.cpp
|
||||
src/actors/regulator.h
|
||||
src/actors/regulator.cpp
|
||||
src/actors/timeractor.h
|
||||
src/actors/timeractor.cpp
|
||||
|
||||
src/sensors/sensor.h
|
||||
src/sensors/sensor.cpp
|
||||
src/sensors/sunsensor.h
|
||||
src/sensors/sunsensor.cpp
|
||||
|
||||
src/items/item.h
|
||||
src/items/item.cpp
|
||||
src/items/relay.h
|
||||
src/items/relay.cpp
|
||||
src/items/poweritem.h
|
||||
src/items/poweritem.cpp
|
||||
src/items/messageitem.h
|
||||
src/items/messageitem.cpp
|
||||
src/items/systemitem.h
|
||||
src/items/systemitem.cpp
|
||||
src/items/auxitem.h
|
||||
src/items/auxitem.cpp
|
||||
src/items/rgbitem.h
|
||||
src/items/rgbitem.cpp
|
||||
src/items/itemsource.h
|
||||
src/items/itemsource.cpp
|
||||
src/items/itemloadersource.h
|
||||
src/items/itemloadersource.cpp
|
||||
src/items/fixeditemsource.h
|
||||
src/items/fixeditemsource.cpp
|
||||
src/items/itemstore.h
|
||||
src/items/itemstore.cpp
|
||||
)
|
||||
|
||||
# Create static library
|
||||
add_library(smartvos_core STATIC ${SHINTERFACE_CORE_SOURCES})
|
||||
|
||||
# Link Qt and system libraries to static library
|
||||
target_link_libraries(smartvos_core
|
||||
Qt6::Core
|
||||
Qt6::Gui
|
||||
Qt6::Widgets
|
||||
Qt6::Network
|
||||
Qt6::Multimedia
|
||||
Qt6::SerialPort
|
||||
Qt6::Mqtt
|
||||
Qt6::WebSockets
|
||||
${PIPEWIRE_LIBRARIES}
|
||||
${LIBNL3_LIBRARIES}
|
||||
)
|
||||
|
||||
# Add include paths to static library
|
||||
target_include_directories(smartvos_core PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
${PIPEWIRE_INCLUDE_DIRS}
|
||||
${LIBNL3_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
# Add subdirectory for tests
|
||||
add_subdirectory(tests)
|
||||
|
||||
# Create executable
|
||||
add_executable(SHinterface
|
||||
src/sensors/mqttsensorsource.h src/sensors/mqttsensorsource.cpp
|
||||
src/items/mqttitem.h src/items/mqttitem.cpp
|
||||
src/mqttclient.h src/mqttclient.cpp
|
||||
|
||||
)
|
||||
|
||||
# Add sources to executable
|
||||
target_sources(SHinterface
|
||||
PRIVATE
|
||||
add_executable(smartvos
|
||||
src/main.cpp
|
||||
src/mainobject.h
|
||||
src/mainobject.cpp
|
||||
src/apgetconnected.h
|
||||
src/apgetconnected.cpp
|
||||
src/microcontroller.h
|
||||
src/microcontroller.cpp
|
||||
src/sun.h
|
||||
src/sun.cpp
|
||||
src/programmode.h
|
||||
src/programmode.cpp
|
||||
src/pipewire.h
|
||||
src/pipewire.cpp
|
||||
|
||||
src/service/service.h
|
||||
src/service/service.cpp
|
||||
src/service/tcpclient.h
|
||||
src/service/tcpclient.cpp
|
||||
src/service/server.h
|
||||
src/service/server.cpp
|
||||
src/service/tcpserver.h
|
||||
src/service/tcpserver.cpp
|
||||
src/service/websocketserver.h
|
||||
src/service/websocketserver.cpp
|
||||
|
||||
src/actors/actor.h
|
||||
src/actors/actor.cpp
|
||||
src/actors/factoractor.h
|
||||
src/actors/factoractor.cpp
|
||||
src/actors/polynomalactor.h
|
||||
src/actors/polynomalactor.cpp
|
||||
src/actors/sensoractor.h
|
||||
src/actors/sensoractor.cpp
|
||||
src/actors/alarmtime.h
|
||||
src/actors/alarmtime.cpp
|
||||
src/actors/regulator.h
|
||||
src/actors/regulator.cpp
|
||||
src/actors/timeractor.h
|
||||
src/actors/timeractor.cpp
|
||||
|
||||
src/sensors/sensor.h
|
||||
src/sensors/sensor.cpp
|
||||
src/sensors/sunsensor.h
|
||||
src/sensors/sunsensor.cpp
|
||||
|
||||
src/items/item.h
|
||||
src/items/item.cpp
|
||||
src/items/relay.h
|
||||
src/items/relay.cpp
|
||||
src/items/poweritem.h
|
||||
src/items/poweritem.cpp
|
||||
src/items/messageitem.h
|
||||
src/items/messageitem.cpp
|
||||
src/items/systemitem.h
|
||||
src/items/systemitem.cpp
|
||||
src/items/auxitem.h
|
||||
src/items/auxitem.cpp
|
||||
src/items/rgbitem.h
|
||||
src/items/rgbitem.cpp
|
||||
src/items/itemsource.h
|
||||
src/items/itemsource.cpp
|
||||
src/items/itemloadersource.h
|
||||
src/items/itemloadersource.cpp
|
||||
src/items/fixeditemsource.h
|
||||
src/items/fixeditemsource.cpp
|
||||
src/items/itemstore.h
|
||||
src/items/itemstore.cpp
|
||||
|
||||
src/ui/mainwindow.h
|
||||
src/ui/mainwindow.cpp
|
||||
src/ui/itemwidget.h
|
||||
|
|
@ -148,7 +173,7 @@ target_sources(SHinterface
|
|||
)
|
||||
|
||||
# Add UI files
|
||||
target_sources(SHinterface
|
||||
target_sources(smartvos
|
||||
PRIVATE
|
||||
src/ui/mainwindow.ui
|
||||
src/ui/itemwidget.ui
|
||||
|
|
@ -169,13 +194,14 @@ target_sources(SHinterface
|
|||
)
|
||||
|
||||
# Add resource file
|
||||
target_sources(SHinterface
|
||||
target_sources(smartvos
|
||||
PRIVATE
|
||||
resources.qrc
|
||||
)
|
||||
|
||||
# Link libraries
|
||||
target_link_libraries(SHinterface
|
||||
# Link libraries - link to static library plus UI-specific dependencies
|
||||
target_link_libraries(smartvos
|
||||
smartvos_core
|
||||
Qt6::Core
|
||||
Qt6::Gui
|
||||
Qt6::Widgets
|
||||
|
|
@ -190,3 +216,16 @@ target_link_libraries(SHinterface
|
|||
|
||||
# Add include paths
|
||||
include_directories(${PIPEWIRE_INCLUDE_DIRS} ${LIBNL3_INCLUDE_DIRS})
|
||||
|
||||
# Installation
|
||||
install(TARGETS smartvos DESTINATION bin)
|
||||
install(TARGETS smartvos_core DESTINATION lib)
|
||||
|
||||
# Install icon
|
||||
install(FILES UVOSicon.bmp DESTINATION share/icons/hicolor/48x48/apps RENAME smartvos.png)
|
||||
|
||||
# Install .desktop file
|
||||
install(FILES smartvos.desktop DESTINATION share/applications)
|
||||
|
||||
# Update icon cache (optional, for icon themes)
|
||||
install(CODE "execute_process(COMMAND gtk-update-icon-cache -f -t ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX})")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue