1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-06 19:12:30 +01:00
ScreenPlay/ScreenPlayShader/CMakeLists.txt

57 lines
1.7 KiB
CMake
Raw Normal View History

2020-10-29 18:53:52 +01:00
project(ScreenPlayShader LANGUAGES CXX)
2020-09-10 11:40:07 +02:00
set(CMAKE_CXX_STANDARD 20)
2020-09-10 11:40:07 +02:00
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
2020-09-10 11:40:07 +02:00
find_package(
Qt6
2020-10-29 18:53:52 +01:00
COMPONENTS Quick Core
REQUIRED)
2020-09-10 11:40:07 +02:00
2020-10-29 18:53:52 +01:00
set(src screenplayshader_plugin.cpp shaderlibrary.cpp)
2020-09-10 11:40:07 +02:00
2020-10-29 18:53:52 +01:00
set(headers screenplayshader_plugin.h shaderlibrary.h)
2020-09-10 11:40:07 +02:00
set(shader shader.qrc)
2020-10-29 18:53:52 +01:00
add_library(${PROJECT_NAME} SHARED ${src} ${headers} ${shader})
2020-09-10 11:40:07 +02:00
2020-10-29 18:53:52 +01:00
target_include_directories(${PROJECT_NAME} PUBLIC inc)
2020-09-10 11:40:07 +02:00
# QML module deployment
set(URI "ScreenPlay/Shader")
string(REPLACE "." "/" TARGETPATH ${URI})
2020-10-29 18:53:52 +01:00
if(NOT DEFINED QT_QMAKE_EXECUTABLE)
get_target_property(QT_QMAKE_EXECUTABLE Qt6::qmake IMPORTED_LOCATION)
2020-10-29 18:53:52 +01:00
if(NOT QT_QMAKE_EXECUTABLE)
2020-09-10 11:40:07 +02:00
message(FATAL_ERROR "Cannot find qmake")
endif()
endif()
execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_QML OUTPUT_VARIABLE QT_INSTALL_QML_RAW)
string(STRIP ${QT_INSTALL_QML_RAW} QT_INSTALL_QML)
set(DESTDIR "${QT_INSTALL_QML}/${TARGETPATH}")
message("DESTDIR ${DESTDIR}")
file(MAKE_DIRECTORY ${DESTDIR})
configure_file(qmldir ${DESTDIR} COPYONLY)
2021-03-13 16:17:56 +01:00
if(APPLE)
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMENT "Copying into ScreenPlay.app bundle"
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/bin/$<TARGET_FILE_NAME:${PROJECT_NAME}>
${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/$<TARGET_FILE_NAME:${PROJECT_NAME}>)
2021-03-13 16:17:56 +01:00
else()
# Copies ScreenPlayShader.* into qt qml plugins folder
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:ScreenPlayShader> ${DESTDIR}/$<TARGET_FILE_NAME:ScreenPlayShader>)
2021-03-13 16:17:56 +01:00
endif()
2021-06-25 16:28:30 +02:00
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Quick Qt6::Gui)