1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-06 19:12:30 +01:00
ScreenPlay/ScreenPlayWorkshop/CMakeLists.txt
Elias Steurer 6b653bdfdc Merge branch 'master' into qt6-support
# Conflicts:
#	.gitlab-ci.yml
#	CMakeLists.txt
#	ScreenPlay/CMakeLists.txt
#	ScreenPlay/qml/Workshop/Workshop.qml
#	ScreenPlay/qml/Workshop/upload/UploadProjectItem.qml
#	ScreenPlay/translations/ScreenPlay_.ts
#	ScreenPlay/translations/ScreenPlay_de.ts
#	ScreenPlay/translations/ScreenPlay_es.ts
#	ScreenPlay/translations/ScreenPlay_fr.ts
#	ScreenPlay/translations/ScreenPlay_ko.ts
#	ScreenPlay/translations/ScreenPlay_pt_br.ts
#	ScreenPlay/translations/ScreenPlay_ru.ts
#	ScreenPlay/translations/ScreenPlay_vi.qm
#	ScreenPlay/translations/ScreenPlay_vi.ts
#	ScreenPlay/translations/ScreenPlay_zh_cn.ts
2021-09-26 17:56:40 +02:00

105 lines
3.5 KiB
CMake

add_subdirectory(SteamSDK)
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD 20)
find_package(
Qt6
COMPONENTS Quick QML Widgets Gui
REQUIRED)
add_library(
workshopplugin SHARED
src/steamapiwrapper.h
src/steamapiwrapper.cpp
src/steamworkshoplistmodel.h
src/uploadlistmodel.h
src/steamworkshopitem.h
src/steamworkshopitem.cpp
src/workshop.cpp
src/workshop.h
src/workshopitem.h
src/installedlistmodel.cpp
src/installedlistmodel.h
src/screenplayworkshop_plugin.cpp
src/screenplayworkshop_plugin.h
src/steamworkshop.cpp
src/steamworkshop.h
src/steamworkshoplistmodel.cpp
src/steamaccount.cpp
src/steamaccount.h
src/steamqmlimageprovider.cpp
src/steamqmlimageprovider.h
qmldir
${qml_resources})
set(WORKSHOP_PLUGIN_DIR ${CMAKE_BINARY_DIR}/bin/workshop)
file(MAKE_DIRECTORY ${WORKSHOP_PLUGIN_DIR})
set_target_properties(workshopplugin PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${WORKSHOP_PLUGIN_DIR})
set_target_properties(workshopplugin PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${WORKSHOP_PLUGIN_DIR})
set_target_properties(workshopplugin PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${WORKSHOP_PLUGIN_DIR})
set(steam_lib_path "${CMAKE_CURRENT_SOURCE_DIR}/SteamSDK/redistributable_bin/")
if(WIN32)
set(steam_lib "${steam_lib_path}/win64/steam_api64.lib")
elseif(APPLE)
set(steam_lib "${steam_lib_path}/osx/libsteam_api.dylib")
elseif(UNIX)
set(steam_lib "${steam_lib_path}/linux64/libsteam_api.so")
endif()
target_link_libraries(workshopplugin PRIVATE Qt6::Core Qt6::Quick ${steam_lib} ScreenPlayUtil SteamSDK)
if(WIN32)
set(steam_bin "${steam_lib_path}/win64/steam_api64.dll")
elseif(APPLE)
set(steam_bin "${steam_lib_path}/osx/libsteam_api.dylib")
elseif(UNIX)
set(steam_bin "${steam_lib_path}/linux64/libsteam_api.so")
endif()
if(APPLE)
set(workshop_install_dir ${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/Workshop)
add_custom_target(
build-time-make-directory
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${workshop_install_dir})
add_custom_command(
TARGET workshopplugin
POST_BUILD
COMMENT "Copying qmldir info into ScreenPlay.app bundle"
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/qmldir ${workshop_install_dir})
add_custom_command(
TARGET workshopplugin
POST_BUILD
COMMENT "Copying workshop plugin into ScreenPlay.app bundle"
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/Workshop/libworkshopplugin.dylib ${workshop_install_dir})
add_custom_command(
TARGET workshopplugin
POST_BUILD
COMMENT "Copying steam library into ScreenPlay.app bundle"
COMMAND ${CMAKE_COMMAND} -E copy ${steam_bin} ${workshop_install_dir})
if(${SCREENPLAY_STEAM})
add_custom_command(
TARGET workshopplugin
POST_BUILD
COMMENT "Copying steam_appid.txt into ScreenPlay.app bundle. This is for development only!"
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/steam_appid.txt
${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/)
endif()
else()
if(${SCREENPLAY_STEAM})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/steam_appid.txt ${CMAKE_BINARY_DIR}/bin/steam_appid.txt COPYONLY)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/qmldir ${WORKSHOP_PLUGIN_DIR}/qmldir COPYONLY)
configure_file(${steam_bin} ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
endif()