feat(CMakeLists): package qml and resources into the application
This commit is contained in:
parent
94fb05a764
commit
0ff1b51223
|
@ -1,21 +1,73 @@
|
|||
cmake_minimum_required(VERSION 3.28)
|
||||
project(itat_challange_olympics)
|
||||
|
||||
find_package(Qt6 6.2 COMPONENTS Core Quick Quick REQUIRED)
|
||||
|
||||
qt_standard_project_setup(REQUIRES 6.5)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
add_executable(itat_challange_olympics src/main/main.cpp
|
||||
|
||||
qt_add_executable(itat_challange_olympics src/main/main.cpp
|
||||
src/api/OlympicsAPI.cpp
|
||||
src/api/OlympicsAPI.h
|
||||
src/discipline/Sport.cpp
|
||||
src/discipline/Sport.h
|
||||
src/model/Sport.cpp
|
||||
src/model/Sport.h
|
||||
)
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS Core)
|
||||
target_link_libraries(itat_challange_olympics PRIVATE Qt6::Core)
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS Quick)
|
||||
target_link_libraries(itat_challange_olympics PRIVATE Qt6::Quick)
|
||||
qt_add_qml_module(itat_challange_olympics
|
||||
URI itat
|
||||
QML_FILES
|
||||
res/gui/application.qml
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS Network)
|
||||
target_link_libraries(itat_challange_olympics PRIVATE Qt6::Network)
|
||||
RESOURCES
|
||||
res/pictograms/ARC_small.svg
|
||||
res/pictograms/ATH_small.svg
|
||||
res/pictograms/BDM_small.svg
|
||||
res/pictograms/BK3_small.svg
|
||||
res/pictograms/BKB_small.svg
|
||||
res/pictograms/BKG_small.svg
|
||||
res/pictograms/BMF_small.svg
|
||||
res/pictograms/BMX_small.svg
|
||||
res/pictograms/BOX_small.svg
|
||||
res/pictograms/CER_small.svg
|
||||
res/pictograms/CLB_small.svg
|
||||
res/pictograms/CRD_small.svg
|
||||
res/pictograms/CSL_small.svg
|
||||
res/pictograms/CSP_small.svg
|
||||
res/pictograms/CTR_small.svg
|
||||
res/pictograms/DIV_small.svg
|
||||
res/pictograms/EQU_small.svg
|
||||
res/pictograms/FBL_small.svg
|
||||
res/pictograms/FEN_small.svg
|
||||
res/pictograms/GAR_small.svg
|
||||
res/pictograms/GLF_small.svg
|
||||
res/pictograms/GRY_small.svg
|
||||
res/pictograms/GTR_small.svg
|
||||
res/pictograms/HBL_small.svg
|
||||
res/pictograms/HOC_small.svg
|
||||
res/pictograms/JUD_small.svg
|
||||
res/pictograms/MPN_small.svg
|
||||
res/pictograms/MTB_small.svg
|
||||
res/pictograms/OWS_small.svg
|
||||
res/pictograms/ROW_small.svg
|
||||
res/pictograms/RU7_small.svg
|
||||
res/pictograms/SAL_small.svg
|
||||
res/pictograms/SHO_small.svg
|
||||
res/pictograms/SKB_small.svg
|
||||
res/pictograms/SRF_small.svg
|
||||
res/pictograms/SWA_small.svg
|
||||
res/pictograms/SWM_small.svg
|
||||
res/pictograms/TEN_small.svg
|
||||
res/pictograms/TKW_small.svg
|
||||
res/pictograms/TRI_small.svg
|
||||
res/pictograms/TTE_small.svg
|
||||
res/pictograms/VBV_small.svg
|
||||
res/pictograms/VVO_small.svg
|
||||
res/pictograms/WLF_small.svg
|
||||
res/pictograms/WPO_small.svg
|
||||
res/pictograms/WRE_small.svg
|
||||
)
|
||||
|
||||
target_link_libraries(itat_challange_olympics PRIVATE d3d12.lib dxgi.lib d3dcompiler.lib dxguid.lib)
|
||||
target_link_libraries(itat_challange_olympics PRIVATE Qt6::Core Qt6::Quick Qt6::Network)
|
||||
|
||||
# target_link_libraries(itat_challange_olympics PRIVATE d3d12.lib dxgi.lib d3dcompiler.lib dxguid.lib)
|
||||
|
|
|
@ -28,7 +28,7 @@ int main(int argc, char *argv[])
|
|||
QQmlEngine engine;
|
||||
QQmlContext *objectContext = new QQmlContext(engine.rootContext());
|
||||
|
||||
QQmlComponent component(&engine, "../../res/gui/application.qml");
|
||||
QQmlComponent component(&engine, "qrc:/qt/qml/itat/res/gui/application.qml");
|
||||
QObject *object = component.create(objectContext);
|
||||
|
||||
// ... delete object and objectContext when necessary
|
||||
|
|
Loading…
Reference in a new issue