chore(Storybook): CMakeLists - common lib for app and tests defined

This commit is contained in:
Michał Cieślak 2022-11-25 11:05:20 +01:00 committed by Michał
parent 8e39d761dc
commit 5dcd3dde23
1 changed files with 27 additions and 18 deletions

View File

@ -20,12 +20,13 @@ find_package(
COMPONENTS Core Quick QuickControls2 Test
REQUIRED)
file(GLOB_RECURSE QML_FILES "stubs/*.qml" "mocks/*.qml" "pages/*.qml" "src/*.qml" "src/qmldir" "../ui/StatusQ/*.qml" "../ui/app/*.qml")
file(GLOB_RECURSE QML_FILES "stubs/*.qml" "mocks/*.qml" "pages/*.qml"
"src/*.qml" "src/qmldir" "../ui/StatusQ/*.qml" "../ui/app/*.qml")
file(GLOB_RECURSE JS_FILES "../ui/StatusQ/*.js" "../ui/app/*.js")
add_executable(
${PROJECT_NAME}
main.cpp
set(PROJECT_LIB "${PROJECT_NAME}Lib")
add_library(${PROJECT_LIB}
cachecleaner.cpp cachecleaner.h
directorieswatcher.cpp directorieswatcher.h
figmadecoratormodel.cpp figmadecoratormodel.h
@ -35,7 +36,13 @@ add_executable(
figmalinkssource.cpp figmalinkssource.h
modelutils.cpp modelutils.h
sectionsdecoratormodel.cpp sectionsdecoratormodel.h
${QML_FILES} main.qml PagesModel.qml
)
add_executable(
${PROJECT_NAME}
main.cpp
main.qml PagesModel.qml
${QML_FILES}
${JS_FILES}
figma.json
)
@ -44,17 +51,19 @@ target_compile_definitions(${PROJECT_NAME}
PRIVATE QML_IMPORT_ROOT="${CMAKE_CURRENT_LIST_DIR}")
target_link_libraries(
${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Quick Qt5::QuickControls2 SortFilterProxyModel)
${PROJECT_LIB} PUBLIC Qt5::Core Qt5::Quick Qt5::QuickControls2)
target_link_libraries(
${PROJECT_NAME} PRIVATE ${PROJECT_LIB} SortFilterProxyModel)
enable_testing()
add_executable(SectionsDecoratorModelTest tests/tst_SectionsDecoratorModel.cpp sectionsdecoratormodel.cpp modelutils.cpp)
add_test(NAME SectionsDecoratorModelTest COMMAND SectionsDecoratorModelTest)
target_link_libraries(SectionsDecoratorModelTest PRIVATE Qt5::Test)
add_executable(FigmaDecoratorModelTest tests/tst_FigmaDecoratorModel.cpp figmadecoratormodel.cpp figmalinkssource.cpp
figmalinks.cpp figmaio.cpp modelutils.cpp figmalinksmodel.cpp)
add_executable(SectionsDecoratorModelTest tests/tst_SectionsDecoratorModel.cpp)
target_link_libraries(SectionsDecoratorModelTest PRIVATE Qt5::Test ${PROJECT_LIB})
add_test(NAME SectionsDecoratorModelTest COMMAND SectionsDecoratorModelTest)
add_executable(FigmaDecoratorModelTest tests/tst_FigmaDecoratorModel.cpp)
target_link_libraries(FigmaDecoratorModelTest PRIVATE Qt5::Test ${PROJECT_LIB})
add_test(NAME FigmaModelTest COMMAND FigmaModelTest)
target_link_libraries(FigmaDecoratorModelTest PRIVATE Qt5::Test Qt5::Qml)
list(APPEND QML_DIRS "${CMAKE_SOURCE_DIR}/../ui/StatusQ/src")
list(APPEND QML_DIRS "${CMAKE_SOURCE_DIR}/../ui/app")