1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-25 12:13:00 +01:00

Fix macos compilation and workshop files

This commit is contained in:
Elias Steurer 2021-07-25 12:26:55 +02:00
parent 65dcf79aa5
commit e3a6193275
4 changed files with 25 additions and 22 deletions

View File

@ -21,15 +21,6 @@ elseif(APPLE)
set(VCPKG_ARCH "x64-osx")
endif()
# Assume built-in pthreads on MacOS https://stackoverflow.com/questions/54587052/cmake-on-mac-could-not-find-threads-missing-threads-found
if(APPLE)
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_WIN32_THREADS_INIT 0)
set(CMAKE_USE_PTHREADS_INIT 1)
set(THREADS_PREFER_PTHREAD_FLAG ON)
endif()
set(VCPKG_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../ScreenPlay-vcpkg")
set(VCPKG_INSTALLED_PATH "${VCPKG_PATH}/installed/${VCPKG_ARCH}")
@ -81,12 +72,3 @@ if(WIN32)
add_subdirectory(ScreenPlaySysInfo)
endif()
#if(APPLE)
#add_custom_target(CopyDependencies DEPENDS ScreenPlay)
#add_custom_command(TARGET CopyDependencies POST_BUILD
# COMMAND "ScreenPlayWallpaper" -E copy_directory
# "$<TARGET_FILE:ScreenPlayWallpaper>"
# "${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/$<TARGET_FILE_NAME:ScreenPlayWallpaper>/"
# COMMENT "Copying into ScreenPlay.app bundle")
#endif()

View File

@ -62,6 +62,9 @@ set(l10n
translations/ScreenPlay_ru.ts
translations/ScreenPlay_vi.ts)
# Needed on macos
find_package(Threads REQUIRED)
set_source_files_properties(${l10n} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/translations")
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
@ -95,6 +98,7 @@ if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
benchmark::benchmark_main
doctest::doctest
sentry::sentry
Threads::Threads
Qt${QT_VERSION_MAJOR}::Quick
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets
@ -133,6 +137,7 @@ else()
benchmark::benchmark_main
doctest::doctest
sentry::sentry
Threads::Threads
Qt${QT_VERSION_MAJOR}::Quick
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets

View File

@ -75,15 +75,30 @@ if(APPLE)
add_custom_command(
TARGET workshopplugin
POST_BUILD
COMMENT "Copying into ScreenPlay.app bundle"
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/qmldir ${workshop_install_dir})
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 into ScreenPlay.app bundle"
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libworkshopplugin.dylib ${workshop_install_dir})
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})
add_custom_command(
TARGET workshopplugin
POST_BUILD
COMMENT "Copying steam_appid.txt into ScreenPlay.app bundle"
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/steam_appid.txt ${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/)
else()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/qmldir ${WORKSHOP_PLUGIN_DIR}/qmldir COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/steam_appid.txt ${CMAKE_BINARY_DIR}/bin/steam_appid.txt COPYONLY)
configure_file(${steam_bin} ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
endif()

View File

@ -96,6 +96,7 @@ print("deploy_command: %s" % deploy_command)
process = subprocess.run(cmake_configure_command, capture_output=True,shell=True)
if process.returncode != 0:
print("deploy_command error: %s" % process.stderr)
sys.exit(process.returncode)
os.system("cmake --build . --target all")