add yaml-cpp

This commit is contained in:
b1ek 2023-04-16 01:53:32 +10:00
parent b77ff2a368
commit c070286284
Signed by: blek
GPG Key ID: 14546221E3595D0C
5 changed files with 50 additions and 13 deletions

View File

@ -12,7 +12,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
file(GLOB_RECURSE PROJECT_SOURCES "src/*.cpp" "src/*.cxx" "src/*.h" "src/*.hpp") file(GLOB_RECURSE PROJECT_SOURCES "src/**.cpp" "src/**.cxx" "src/**.h" "src/**.hpp")
list(APPEND PROJECT_SOURCES "main.cpp") list(APPEND PROJECT_SOURCES "main.cpp")
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
@ -38,7 +38,26 @@ else()
endif() endif()
endif() endif()
target_link_libraries(CuteSchedule PRIVATE Qt${QT_VERSION_MAJOR}::Widgets) # --- External projects include --- #
# Add yaml-cpp
include(ExternalProject)
set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external)
ExternalProject_Add(yaml-cpp
GIT_REPOSITORY "https://github.com/jbeder/yaml-cpp"
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION}
)
include_directories(${EXTERNAL_INSTALL_LOCATION}/include)
link_directories(${EXTERNAL_INSTALL_LOCATION}/lib)
add_dependencies(CuteSchedule yaml-cpp)
# --- End external projects --- #
target_link_libraries(CuteSchedule
PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
)
set_target_properties(CuteSchedule PROPERTIES set_target_properties(CuteSchedule PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com

5
default/config.yml Normal file
View File

@ -0,0 +1,5 @@
version: '2'
config:
title: 'CuteSchedule'
fullscreen_mode: true

6
src/config/config.cpp Normal file
View File

@ -0,0 +1,6 @@
#include "config.h"
Config::Config()
{
}

12
src/config/config.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef CONFIG_H
#define CONFIG_H
#include <QObject>
class Config
{
public:
Config();
};
#endif // CONFIG_H

View File

@ -18,18 +18,13 @@
background: white background: white
}</string> }</string>
</property> </property>
<widget class="QWidget" name="centralwidget"/> <widget class="QWidget" name="centralwidget">
<widget class="QMenuBar" name="menubar"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="geometry"> <item>
<rect> <widget class="QWidget" name="widget" native="true"/>
<x>0</x> </item>
<y>0</y> </layout>
<width>800</width>
<height>22</height>
</rect>
</property>
</widget> </widget>
<widget class="QStatusBar" name="statusbar"/>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>