diff --git a/CMakeLists.txt b/CMakeLists.txt index 0154649f4a5b90ca47116eab992b337f2f152aa1..6baee4fdcb9e08613f84d971b980cd4f89655d79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,8 +68,27 @@ target_link_libraries(Vivy PRIVATE ${AVUTIL_LIBRARY}) target_link_libraries(Vivy PRIVATE ${SWRESAMPLE_LIBRARY}) target_link_libraries(Vivy PRIVATE ${AVFORMAT_LIBRARY}) +# Headers related things target_include_directories(Vivy PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/inc) +target_precompile_headers(Vivy PRIVATE + # ASS headers + "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/src/Ass/Ass.hh>" + "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/src/Ass/Line.hh>" + "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/src/Ass/Syl.hh>" + "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/src/Ass/Style.hh>" + "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/src/Ass/AssFactory.hh>" + "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/src/Ass/Char.hh>" + # Utils + "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/src/Utils.hh>" + + # Document headers + "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/src/Document/VivyDocument.hh>" + "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/src/Document/VivyDocumentStore.hh>" + "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/src/Document/CRTPSubDocument.hh>" +) + +# More options and warnings target_compile_options(Vivy PRIVATE -Wall -Wextra -Wshadow -pedantic -Wcast-align -Wconversion -Wsign-conversion diff --git a/src/Ass/Line.hh b/src/Ass/Line.hh index c4b1a39be5a0234ad7adc11dcdb708e0f07dc6e3..9af49255d8746b9de54cb13b691116b9f37de705 100644 --- a/src/Ass/Line.hh +++ b/src/Ass/Line.hh @@ -7,6 +7,7 @@ namespace Vivy::Ass { + class Line { private: quint64 start{ 0 }; diff --git a/src/Ass/Style.hh b/src/Ass/Style.hh index 82e6c4be083466d8b01545d7779e93b624fdc96b..c56a3fcd8b69bd42f107c3277735888a91c4550a 100644 --- a/src/Ass/Style.hh +++ b/src/Ass/Style.hh @@ -7,6 +7,7 @@ namespace Vivy::Ass { + struct Color { union { quint8 a, r, g, b; diff --git a/src/Ass/Syl.hh b/src/Ass/Syl.hh index cb5c522b0dc7390fc5bb37753c613495d704f7bf..964e755005873b769e3b00289ea74b3dc0bbba38 100644 --- a/src/Ass/Syl.hh +++ b/src/Ass/Syl.hh @@ -8,6 +8,7 @@ namespace Vivy::Ass { + class Line; class Syl { diff --git a/src/MainWindow.hh b/src/MainWindow.hh index a2784f4308294ed9660f4972339b19fff7d16a3b..d53031cc6f52f8796c04e99f3560e4aa2c851867 100644 --- a/src/MainWindow.hh +++ b/src/MainWindow.hh @@ -5,17 +5,13 @@ #error "This is a C++ header" #endif +#include "Utils.hh" #include "AudioVisualizer.hh" #include "Document/VivyDocumentStore.hh" #include <QMainWindow> -class QMenu; -class QAction; -class QTabWidget; - namespace Vivy { -class VivyApplication; class MainWindow final : public QMainWindow { Q_OBJECT diff --git a/src/TimingScene.hh b/src/TimingScene.hh index 53bb00adb220b4ac63afcba919bb40130291e968..a47560c1e9682bd4e2b3bceea2f29d6581c0e574 100644 --- a/src/TimingScene.hh +++ b/src/TimingScene.hh @@ -1,6 +1,7 @@ #ifndef VIVY_TIMING_SCENE_H #define VIVY_TIMING_SCENE_H +#include "Utils.hh" #include "Ass/Ass.hh" #include "TimingBar.hh" @@ -11,8 +12,6 @@ #include <QGraphicsScene> #include <memory> -class QGraphicsPixmapItem; - namespace Vivy { class TimingScene final : public QGraphicsScene { diff --git a/src/TimingView.hh b/src/TimingView.hh index be10d5b924a6b2a3189a079469e929c859ca372f..bb64bc40232cf96feb3520fc51531c0f57def831 100644 --- a/src/TimingView.hh +++ b/src/TimingView.hh @@ -5,6 +5,7 @@ #error "This is a C++ header" #endif +#include "Utils.hh" #include "TimingBar.hh" #include "TimingScene.hh" @@ -13,8 +14,6 @@ #include <QVector> #include <QGraphicsView> -class QGraphicsPixmapItem; - namespace Vivy { class TimingView final : public QGraphicsView { diff --git a/src/Utils.hh b/src/Utils.hh index 1ed7a7dfa32104dc1938ea09b4f13b3c4f48649f..cfe0d3ed88a011dea7f1d505ecd213f6a691dc6f 100644 --- a/src/Utils.hh +++ b/src/Utils.hh @@ -54,4 +54,17 @@ to_underlying(E e) noexcept bool detectDocumentType(const QFileInfo &, DocumentType *); } +/* All forward delcarations are placed here */ + +class QMenu; +class QAction; +class QTabWidget; +class QGraphicsPixmapItem; + +namespace Vivy +{ +class VivyApplication; +class MainWindow; +} + #endif // VIVY_UTILS_H diff --git a/src/VivyApplication.hh b/src/VivyApplication.hh index a9c86f1af90abf19288fd7f1a54fb7a3e4cf5343..16939df780563f686ee9e7c072e87af5719d08c3 100644 --- a/src/VivyApplication.hh +++ b/src/VivyApplication.hh @@ -14,7 +14,6 @@ namespace Vivy { -class MainWindow; class VivyApplication : public QApplication { Q_OBJECT