From e3a61932755bd6f3eff67f2ccd7f66c70bce491f Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Sun, 25 Jul 2021 12:26:55 +0200 Subject: [PATCH] Fix macos compilation and workshop files --- CMakeLists.txt | 18 ------------------ ScreenPlay/CMakeLists.txt | 5 +++++ ScreenPlayWorkshop/CMakeLists.txt | 23 +++++++++++++++++++---- Tools/build.py | 1 + 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 95580b1c..3e80f354 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 -# "$" -# "${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/$/" -# COMMENT "Copying into ScreenPlay.app bundle") -#endif() - diff --git a/ScreenPlay/CMakeLists.txt b/ScreenPlay/CMakeLists.txt index e2cd896a..9f5cf5c8 100644 --- a/ScreenPlay/CMakeLists.txt +++ b/ScreenPlay/CMakeLists.txt @@ -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 diff --git a/ScreenPlayWorkshop/CMakeLists.txt b/ScreenPlayWorkshop/CMakeLists.txt index c8891633..71cbbad5 100644 --- a/ScreenPlayWorkshop/CMakeLists.txt +++ b/ScreenPlayWorkshop/CMakeLists.txt @@ -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() + diff --git a/Tools/build.py b/Tools/build.py index 1ae4b293..21c0be0a 100644 --- a/Tools/build.py +++ b/Tools/build.py @@ -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")