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

109 lines
3.6 KiB
CMake
Raw Normal View History

2021-07-16 11:14:21 +02:00
add_subdirectory(SteamSDK)
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD 20)
find_package(
QT NAMES Qt6 Qt5
2021-07-16 16:44:28 +02:00
COMPONENTS Quick QML Widgets Gui
2021-07-16 11:14:21 +02:00
REQUIRED)
find_package(
2021-07-16 16:44:28 +02:00
Qt${QT_VERSION_MAJOR}
COMPONENTS Quick QML Widgets Gui
REQUIRED)
2021-07-16 11:14:21 +02:00
add_library(
2021-07-16 16:44:28 +02:00
workshopplugin SHARED
2021-07-16 11:14:21 +02:00
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
2021-07-16 16:44:28 +02:00
${qml_resources})
2021-07-16 11:14:21 +02:00
2021-07-21 15:44:48 +02:00
set(WORKSHOP_PLUGIN_DIR ${CMAKE_BINARY_DIR}/bin/workshop)
file(MAKE_DIRECTORY ${WORKSHOP_PLUGIN_DIR})
2021-07-21 15:44:48 +02:00
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})
2021-07-16 11:14:21 +02:00
set(steam_lib_path "${CMAKE_CURRENT_SOURCE_DIR}/SteamSDK/redistributable_bin/")
if(WIN32)
2021-07-16 16:44:28 +02:00
set(steam_lib "${steam_lib_path}/win64/steam_api64.lib")
2021-07-16 11:14:21 +02:00
elseif(APPLE)
2021-07-16 16:44:28 +02:00
set(steam_lib "${steam_lib_path}/osx/libsteam_api.dylib")
2021-07-16 11:14:21 +02:00
elseif(UNIX)
2021-07-16 16:44:28 +02:00
set(steam_lib "${steam_lib_path}/linux64/libsteam_api.so")
2021-07-16 11:14:21 +02:00
endif()
2021-07-16 16:44:28 +02:00
target_link_libraries(workshopplugin PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick ${steam_lib} ScreenPlayUtil SteamSDK)
2021-07-16 11:14:21 +02:00
if(WIN32)
2021-07-16 16:44:28 +02:00
set(steam_bin "${steam_lib_path}/win64/steam_api64.dll")
2021-07-16 11:14:21 +02:00
elseif(APPLE)
2021-07-16 16:44:28 +02:00
set(steam_bin "${steam_lib_path}/osx/libsteam_api.dylib")
2021-07-16 11:14:21 +02:00
elseif(UNIX)
2021-07-16 16:44:28 +02:00
set(steam_bin "${steam_lib_path}/linux64/libsteam_api.so")
2021-07-16 11:14:21 +02:00
endif()
2021-07-16 11:36:02 +02:00
if(APPLE)
set(workshop_install_dir ${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/Workshop)
2021-07-16 16:44:28 +02:00
add_custom_target(
build-time-make-directory
2021-07-16 11:36:02 +02:00
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${workshop_install_dir})
2021-07-16 16:44:28 +02:00
add_custom_command(
TARGET workshopplugin
2021-07-16 11:36:02 +02:00
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})
2021-07-16 16:44:28 +02:00
add_custom_command(
TARGET workshopplugin
2021-07-16 11:36:02 +02:00
POST_BUILD
COMMENT "Copying steam library into ScreenPlay.app bundle"
COMMAND ${CMAKE_COMMAND} -E copy ${steam_bin} ${workshop_install_dir})
if(NOT ${SCREENPLAY_STEAM_DEPLOY})
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()
2021-07-16 11:36:02 +02:00
else()
if(NOT ${SCREENPLAY_STEAM_DEPLOY})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/steam_appid.txt ${CMAKE_BINARY_DIR}/bin/steam_appid.txt COPYONLY)
endif()
2021-07-25 15:31:35 +02:00
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/qmldir ${WORKSHOP_PLUGIN_DIR}/qmldir COPYONLY)
configure_file(${steam_bin} ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
2021-07-16 11:36:02 +02:00
endif()