This commit is contained in:
tooomm 2025-08-03 05:37:06 -03:00 committed by GitHub
commit e07ee45740
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 144 additions and 148 deletions

View file

@ -114,6 +114,11 @@ if [[ $PACKAGE_TYPE ]]; then
flags+=("-DCPACK_GENERATOR=$PACKAGE_TYPE") flags+=("-DCPACK_GENERATOR=$PACKAGE_TYPE")
fi fi
#if [[ $RUNNER_OS == Windows ]]; then
# VCPKG_TOOLCHAIN_FILE="D:/a/Cockatrice/vcpkg/scripts/buildsystems/vcpkg.cmake"
# flags+=("-DCMAKE_TOOLCHAIN_FILE=$VCPKG_TOOLCHAIN_FILE" "-DVCPKG_TARGET_TRIPLET=x64-windows")
#fi
# Add cmake --build flags # Add cmake --build flags
buildflags=(--config "$BUILDTYPE") buildflags=(--config "$BUILDTYPE")
@ -151,19 +156,13 @@ if [[ $USE_CCACHE ]]; then
echo "::endgroup::" echo "::endgroup::"
fi fi
echo "::group::Configure cmake" echo "::group::Configure CMake"
cmake --version cmake --version
cmake .. "${flags[@]}" cmake .. "${flags[@]}"
echo "::endgroup::" echo "::endgroup::"
echo "::group::Build project" echo "::group::Build project"
if [[ $RUNNER_OS == Windows ]]; then cmake --build . "${buildflags[@]}"
# Enable MTT, see https://devblogs.microsoft.com/cppblog/improved-parallelism-in-msbuild/
# and https://devblogs.microsoft.com/cppblog/cpp-build-throughput-investigation-and-tune-up/#multitooltask-mtt
cmake --build . "${buildflags[@]}" -- -p:UseMultiToolTask=true -p:EnableClServerMode=true
else
cmake --build . "${buildflags[@]}"
fi
echo "::endgroup::" echo "::endgroup::"
if [[ $USE_CCACHE ]]; then if [[ $USE_CCACHE ]]; then
@ -184,6 +183,27 @@ if [[ $MAKE_INSTALL ]]; then
echo "::endgroup::" echo "::endgroup::"
fi fi
if [[ $RUNNER_OS == Windows ]]; then
echo "Searching for liblzma.dll after build..."
FOUND_DLL=$(find . -name "liblzma.dll" 2>/dev/null)
if [ -n "$FOUND_DLL" ]; then
echo "liblzma.dll found at:"
echo "$FOUND_DLL"
echo "Cleaning up duplicate debug DLLs"
rm -f ./oracle/liblzma.dll
rm -f ./vcpkg_installed/x64-windows/debug/bin/liblzma.dll
find . -iname "liblzma.dll"
else
echo "ERROR: liblzma.dll not found after build!"
exit 1
fi
fi
if [[ $MAKE_PACKAGE ]]; then if [[ $MAKE_PACKAGE ]]; then
echo "::group::Create package" echo "::group::Create package"

View file

@ -405,20 +405,17 @@ jobs:
needs: configure needs: configure
runs-on: windows-2022 runs-on: windows-2022
env: env:
CMAKE_GENERATOR: 'Visual Studio 17 2022' CMAKE_GENERATOR: 'Ninja'
steps: steps:
- name: Add msbuild to PATH
id: add-msbuild
uses: microsoft/setup-msbuild@v2
with:
msbuild-architecture: x64
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
- name: Install Qt ${{matrix.qt_version}} - name: Install Qt ${{matrix.qt_version}}
uses: jurplel/install-qt-action@v4 uses: jurplel/install-qt-action@v4
with: with:
@ -441,7 +438,6 @@ jobs:
env: env:
PACKAGE_SUFFIX: '-Win${{matrix.target}}' PACKAGE_SUFFIX: '-Win${{matrix.target}}'
CMAKE_GENERATOR: '${{env.CMAKE_GENERATOR}}' CMAKE_GENERATOR: '${{env.CMAKE_GENERATOR}}'
CMAKE_GENERATOR_PLATFORM: 'x64'
QTDIR: '${{github.workspace}}\Qt\${{matrix.qt_version}}\win64_${{matrix.qt_arch}}' QTDIR: '${{github.workspace}}\Qt\${{matrix.qt_version}}\win64_${{matrix.qt_arch}}'
VCPKG_DISABLE_METRICS: 1 VCPKG_DISABLE_METRICS: 1
VCPKG_BINARY_SOURCES: 'clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite' VCPKG_BINARY_SOURCES: 'clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite'

View file

@ -5,7 +5,7 @@
# This file sets all the variables shared between the projects # This file sets all the variables shared between the projects
# like the installation path, compilation flags etc.. # like the installation path, compilation flags etc..
# cmake 3.16 is required if using qt6 # CMake 3.16 is required if using Qt6
cmake_minimum_required(VERSION 3.10) cmake_minimum_required(VERSION 3.10)
# Early detect ccache # Early detect ccache
@ -81,7 +81,7 @@ if(NOT DEFINED GIT_TAG_RELEASENAME)
set(GIT_TAG_RELEASENAME "Omenpath") set(GIT_TAG_RELEASENAME "Omenpath")
endif() endif()
# Use c++20 for all targets # Use C++20 for all targets
set(CMAKE_CXX_STANDARD set(CMAKE_CXX_STANDARD
20 20
CACHE STRING "C++ ISO Standard" CACHE STRING "C++ ISO Standard"
@ -183,7 +183,7 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
endif() endif()
endforeach() endforeach()
else() else()
# other: osx/llvm, bsd/llvm # Other: osx/llvm, bsd/llvm
set(CMAKE_CXX_FLAGS_RELEASE "-O2") set(CMAKE_CXX_FLAGS_RELEASE "-O2")
if(WARNING_AS_ERROR) if(WARNING_AS_ERROR)
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wextra -Werror -Wno-unused-parameter") set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wextra -Werror -Wno-unused-parameter")
@ -232,7 +232,7 @@ if(${Protobuf_VERSION} VERSION_LESS "3.21.0.0" AND NOT EXISTS "${Protobuf_PROTOC
message(FATAL_ERROR "No protoc command found!") message(FATAL_ERROR "No protoc command found!")
endif() endif()
#Find OpenSSL # Find OpenSSL
if(WIN32) if(WIN32)
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
if(OPENSSL_FOUND) if(OPENSSL_FOUND)
@ -245,7 +245,7 @@ if(WIN32)
endif() endif()
endif() endif()
#Find VCredist # Find VCredist
if(MSVC) if(MSVC)
find_package(VCredistRuntime) find_package(VCredistRuntime)
endif() endif()
@ -273,7 +273,7 @@ if(UNIX)
set(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/dmgBackground.tif") set(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/dmgBackground.tif")
set(CPACK_PRE_BUILD_SCRIPTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/SignMacApplications.cmake") set(CPACK_PRE_BUILD_SCRIPTS "${CMAKE_CURRENT_SOURCE_DIR}/cmake/SignMacApplications.cmake")
else() else()
# linux # Linux
if(CPACK_GENERATOR STREQUAL "RPM") if(CPACK_GENERATOR STREQUAL "RPM")
set(CPACK_RPM_PACKAGE_LICENSE "GPLv2") set(CPACK_RPM_PACKAGE_LICENSE "GPLv2")
set(CPACK_RPM_MAIN_COMPONENT "cockatrice") set(CPACK_RPM_MAIN_COMPONENT "cockatrice")
@ -284,7 +284,7 @@ if(UNIX)
endif() endif()
set(CPACK_RPM_PACKAGE_GROUP "Amusements/Games") set(CPACK_RPM_PACKAGE_GROUP "Amusements/Games")
set(CPACK_RPM_PACKAGE_URL "http://github.com/Cockatrice/Cockatrice") set(CPACK_RPM_PACKAGE_URL "http://github.com/Cockatrice/Cockatrice")
# stop directories from making package conflicts # Stop directories from making package conflicts
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION
/usr/share/applications /usr/share/applications
/usr/share/icons /usr/share/icons
@ -314,10 +314,31 @@ elseif(WIN32)
set(TRICE_IS_64_BIT 0) set(TRICE_IS_64_BIT 0)
endif() endif()
# Configure file with custom definitions for NSIS. # Configure file with custom definitions for NSIS
configure_file("${COCKATRICE_CMAKE_PATH}/NSIS.definitions.nsh.in" "${PROJECT_BINARY_DIR}/NSIS.definitions.nsh") configure_file("${COCKATRICE_CMAKE_PATH}/NSIS.definitions.nsh.in" "${PROJECT_BINARY_DIR}/NSIS.definitions.nsh")
# include vcredist into the package; NSIS will take care of running it # Include liblzma.dll into the package
# install(FILES "${CMAKE_SOURCE_DIR}/vcpkg_installed/x64-windows/bin/liblzma.dll" DESTINATION ./)
# install(FILES "${CMAKE_SOURCE_DIR}/vcpkg_installed/x64-windows/bin/liblzma.dll" DESTINATION "bin")
# set(LIBLZMA_DLL "${CMAKE_SOURCE_DIR}/vcpkg_installed/x64-windows/bin/liblzma.dll")
#
# if(EXISTS "${LIBLZMA_DLL}")
# install(FILES "${LIBLZMA_DLL}" DESTINATION ./)
# else()
# message(WARNING "liblzma.dll not found at ${LIBLZMA_DLL}, skipping DLL install.")
# endif()
# Make sure vcpkg's toolchain is in use and lzma is available as a target
# find_package(lzma CONFIG REQUIRED)
# This will install the DLL if present (vcpkg target will point to the correct location)
# install(TARGETS lzma
# RUNTIME DESTINATION .
# LIBRARY DESTINATION lib
# ARCHIVE DESTINATION lib
# )
# Include vcredist into the package; NSIS will take care of running it
if(VCREDISTRUNTIME_FOUND) if(VCREDISTRUNTIME_FOUND)
install(FILES "${VCREDISTRUNTIME_FILE}" DESTINATION ./) install(FILES "${VCREDISTRUNTIME_FILE}" DESTINATION ./)
endif() endif()
@ -352,6 +373,6 @@ if(TEST)
endif() endif()
if(Qt6_FOUND AND Qt6_VERSION_MINOR GREATER_EQUAL 3) if(Qt6_FOUND AND Qt6_VERSION_MINOR GREATER_EQUAL 3)
# Qt6.3+ requires project finalization to support translations # Qt 6.3+ requires project finalization to support translations
qt6_finalize_project() qt6_finalize_project()
endif() endif()

View file

@ -1,12 +1,12 @@
# CMakeLists for cockatrice directory # CMakeLists for cockatrice directory
# #
# provides the cockatrice binary # Provides the cockatrice binary
project(Cockatrice VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") project(Cockatrice VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
set(cockatrice_SOURCES set(cockatrice_SOURCES
${VERSION_STRING_CPP} ${VERSION_STRING_CPP}
# sort by alphabetical order, so that there is no debate about where to add new sources to the list # Sort by alphabetical order, so that there is no debate about where to add new sources to the list
src/client/game_logic/abstract_client.cpp src/client/game_logic/abstract_client.cpp
src/client/game_logic/key_signals.cpp src/client/game_logic/key_signals.cpp
src/client/get_text_with_max.cpp src/client/get_text_with_max.cpp
@ -278,11 +278,11 @@ if(UPDATE_TRANSLATIONS)
set(cockatrice_TS "${CMAKE_CURRENT_SOURCE_DIR}/cockatrice_en@source.ts") set(cockatrice_TS "${CMAKE_CURRENT_SOURCE_DIR}/cockatrice_en@source.ts")
else() else()
file(GLOB cockatrice_TS "${CMAKE_CURRENT_SOURCE_DIR}/translations/*.ts") file(GLOB cockatrice_TS "${CMAKE_CURRENT_SOURCE_DIR}/translations/*.ts")
endif(UPDATE_TRANSLATIONS) endif()
if(WIN32) if(WIN32)
set(cockatrice_SOURCES ${cockatrice_SOURCES} cockatrice.rc) set(cockatrice_SOURCES ${cockatrice_SOURCES} cockatrice.rc)
endif(WIN32) endif()
if(APPLE) if(APPLE)
set(MACOSX_BUNDLE_ICON_FILE appicon.icns) set(MACOSX_BUNDLE_ICON_FILE appicon.icns)
@ -290,7 +290,7 @@ if(APPLE)
${CMAKE_CURRENT_SOURCE_DIR}/resources/appicon.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources ${CMAKE_CURRENT_SOURCE_DIR}/resources/appicon.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources
) )
set(cockatrice_SOURCES ${cockatrice_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/resources/appicon.icns) set(cockatrice_SOURCES ${cockatrice_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/resources/appicon.icns)
endif(APPLE) endif()
if(Qt6_FOUND) if(Qt6_FOUND)
qt6_add_resources(cockatrice_RESOURCES_RCC ${cockatrice_RESOURCES}) qt6_add_resources(cockatrice_RESOURCES_RCC ${cockatrice_RESOURCES})
@ -329,7 +329,7 @@ if(Qt6_FOUND)
MANUAL_FINALIZATION MANUAL_FINALIZATION
) )
elseif(Qt5_FOUND) elseif(Qt5_FOUND)
# Qt5 Translations need to be linked at executable creation time # Qt5 translations need to be linked at executable creation time
if(Qt5LinguistTools_FOUND) if(Qt5LinguistTools_FOUND)
if(UPDATE_TRANSLATIONS) if(UPDATE_TRANSLATIONS)
qt5_create_translation(cockatrice_QM ${translate_SRCS} ${cockatrice_TS}) qt5_create_translation(cockatrice_QM ${translate_SRCS} ${cockatrice_TS})
@ -371,7 +371,7 @@ if(UNIX)
install(TARGETS cockatrice BUNDLE DESTINATION ./) install(TARGETS cockatrice BUNDLE DESTINATION ./)
else() else()
# Assume linux # Assume Linux
install(TARGETS cockatrice RUNTIME DESTINATION bin/) install(TARGETS cockatrice RUNTIME DESTINATION bin/)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/cockatrice.png DESTINATION ${ICONDIR}/hicolor/48x48/apps) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/cockatrice.png DESTINATION ${ICONDIR}/hicolor/48x48/apps)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/cockatrice.svg DESTINATION ${ICONDIR}/hicolor/scalable/apps) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/cockatrice.svg DESTINATION ${ICONDIR}/hicolor/scalable/apps)
@ -381,27 +381,17 @@ elseif(WIN32)
install(TARGETS cockatrice RUNTIME DESTINATION ./) install(TARGETS cockatrice RUNTIME DESTINATION ./)
endif() endif()
include(BundleUtilities)
if(APPLE) if(APPLE)
# these needs to be relative to CMAKE_INSTALL_PREFIX # These needs to be relative to CMAKE_INSTALL_PREFIX
set(plugin_dest_dir cockatrice.app/Contents/Plugins) set(plugin_dest_dir cockatrice.app/Contents/Plugins)
set(qtconf_dest_dir cockatrice.app/Contents/Resources) set(qtconf_dest_dir cockatrice.app/Contents/Resources)
# Qt plugins: audio (Qt5), iconengines, imageformats, multimedia (Qt6), platforms, printsupport (Qt5), styles, tls (Qt6) install(DIRECTORY "${QT_PLUGINS_DIR}/"
install( DESTINATION cockatrice.app/Contents/Plugins
DIRECTORY "${QT_PLUGINS_DIR}/"
DESTINATION ${plugin_dest_dir}
COMPONENT Runtime COMPONENT Runtime
FILES_MATCHING FILES_MATCHING PATTERN "*.dylib"
PATTERN "*.dSYM" EXCLUDE
PATTERN "*_debug.dylib" EXCLUDE
PATTERN "audio/*.dylib"
PATTERN "iconengines/*.dylib"
PATTERN "imageformats/*.dylib"
PATTERN "multimedia/*.dylib"
PATTERN "platforms/*.dylib"
PATTERN "printsupport/*.dylib"
PATTERN "styles/*.dylib"
PATTERN "tls/*.dylib"
) )
install( install(
@ -411,94 +401,53 @@ if(APPLE)
PATTERN "*.ini" PATTERN "*.ini"
) )
install( # Copy qt.conf with correct paths
CODE " install(CODE "
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths] file(WRITE \"\${CMAKE_INSTALL_PREFIX}/cockatrice.app/Contents/Resources/qt.conf\" \"[Paths]
Plugins = Plugins Plugins = Plugins
Translations = Resources/translations Translations = Resources/translations
Data = Resources\") Data = Resources\")
" ")
COMPONENT Runtime
)
install( install(CODE "
CODE " set(BU_CHMOD_BUNDLE_ITEMS ON)
file(GLOB_RECURSE QTPLUGINS file(GLOB_RECURSE QTPLUGINS
\"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/*.dylib\") \"\${CMAKE_INSTALL_PREFIX}/cockatrice.app/Contents/Plugins/*.dylib\")
set(BU_CHMOD_BUNDLE_ITEMS ON) fixup_bundle(
include(BundleUtilities) \"\${CMAKE_INSTALL_PREFIX}/cockatrice.app\"
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/cockatrice.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") \"\${QTPLUGINS}\"
" \"${QT_LIBRARY_DIR}\"
COMPONENT Runtime )
) ")
endif() endif()
if(WIN32) if(WIN32)
# these needs to be relative to CMAKE_INSTALL_PREFIX # These needs to be relative to CMAKE_INSTALL_PREFIX
set(plugin_dest_dir Plugins) set(plugin_dest_dir Plugins)
set(qtconf_dest_dir .) set(qtconf_dest_dir .)
install( install(DIRECTORY "${QT_PLUGINS_DIR}/"
DIRECTORY "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${CMAKE_BUILD_TYPE}/" DESTINATION Plugins
DESTINATION ./ COMPONENT Runtime
FILES_MATCHING FILES_MATCHING PATTERN "*.dll"
PATTERN "*.dll"
) )
install( install(
DIRECTORY "${CMAKE_BINARY_DIR}/cockatrice/" DIRECTORY "${CMAKE_BINARY_DIR}/cockatrice/"
DESTINATION ./ DESTINATION ./
FILES_MATCHING FILES_MATCHING PATTERN "*.ini"
PATTERN "*.ini"
) )
# Qt plugins: audio (Qt5), iconengines, imageformats, multimedia (Qt6) platforms, printsupport (Qt5), styles, tls (Qt6) install(CODE "
install( set(BU_CHMOD_BUNDLE_ITEMS ON)
DIRECTORY "${QT_PLUGINS_DIR}/" file(GLOB_RECURSE QTPLUGINS
DESTINATION ${plugin_dest_dir} \"\${CMAKE_INSTALL_PREFIX}/Plugins/*.dll\")
COMPONENT Runtime fixup_bundle(
FILES_MATCHING \"\${CMAKE_INSTALL_PREFIX}/Cockatrice.exe\"
PATTERN "audio/qtaudio_wasapi.dll" \"\${QTPLUGINS}\"
PATTERN "audio/qtaudio_windows.dll" \"${QT_LIBRARY_DIR}\"
PATTERN "iconengines/qsvgicon.dll" )
PATTERN "imageformats/*.dll" ")
PATTERN "mediaservice/dsengine.dll"
PATTERN "mediaservice/wmfengine.dll"
PATTERN "multimedia/*.dll"
PATTERN "platforms/qdirect2d.dll"
PATTERN "platforms/qminimal.dll"
PATTERN "platforms/qoffscreen.dll"
PATTERN "platforms/qwindows.dll"
PATTERN "printsupport/windowsprintersupport.dll"
PATTERN "styles/qcertonlybackend.dll"
PATTERN "styles/qopensslbackend.dll"
PATTERN "styles/qschannelbackend.dll"
PATTERN "styles/qwindowsvistastyle.dll"
PATTERN "tls/qcertonlybackend.dll"
PATTERN "tls/qopensslbackend.dll"
PATTERN "tls/qschannelbackend.dll"
)
install(
CODE "
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]
Plugins = Plugins
Translations = Resources/translations
Data = Resources\")
"
COMPONENT Runtime
)
install(
CODE "
file(GLOB_RECURSE QTPLUGINS
\"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/*.dll\")
set(BU_CHMOD_BUNDLE_ITEMS ON)
include(BundleUtilities)
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/Cockatrice.exe\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\")
"
COMPONENT Runtime
)
if(OPENSSL_FOUND) if(OPENSSL_FOUND)
install(FILES ${OPENSSL_INCLUDE_DIRS} DESTINATION ./) install(FILES ${OPENSSL_INCLUDE_DIRS} DESTINATION ./)

View file

@ -49,11 +49,11 @@ if(UPDATE_TRANSLATIONS)
set(oracle_TS "${CMAKE_CURRENT_SOURCE_DIR}/oracle_en@source.ts") set(oracle_TS "${CMAKE_CURRENT_SOURCE_DIR}/oracle_en@source.ts")
else() else()
file(GLOB oracle_TS "${CMAKE_CURRENT_SOURCE_DIR}/translations/*.ts") file(GLOB oracle_TS "${CMAKE_CURRENT_SOURCE_DIR}/translations/*.ts")
endif(UPDATE_TRANSLATIONS) endif()
if(WIN32) if(WIN32)
set(oracle_SOURCES ${oracle_SOURCES} oracle.rc) set(oracle_SOURCES ${oracle_SOURCES} oracle.rc)
endif(WIN32) endif()
if(APPLE) if(APPLE)
set(MACOSX_BUNDLE_ICON_FILE appicon.icns) set(MACOSX_BUNDLE_ICON_FILE appicon.icns)
@ -61,7 +61,7 @@ if(APPLE)
${CMAKE_CURRENT_SOURCE_DIR}/resources/appicon.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources ${CMAKE_CURRENT_SOURCE_DIR}/resources/appicon.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources
) )
set(oracle_SOURCES ${oracle_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/resources/appicon.icns) set(oracle_SOURCES ${oracle_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/resources/appicon.icns)
endif(APPLE) endif()
if(Qt6_FOUND) if(Qt6_FOUND)
qt6_add_resources(oracle_RESOURCES_RCC ${oracle_RESOURCES}) qt6_add_resources(oracle_RESOURCES_RCC ${oracle_RESOURCES})
@ -72,12 +72,11 @@ endif()
include_directories(../cockatrice/src) include_directories(../cockatrice/src)
include_directories(../common) include_directories(../common)
# Libz is required to support zipped files # Libz is required to support zip files
find_package(ZLIB) find_package(ZLIB)
if(ZLIB_FOUND) if(ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIRS}) include_directories(${ZLIB_INCLUDE_DIRS})
add_definitions("-DHAS_ZLIB") add_definitions("-DHAS_ZLIB")
set(oracle_SOURCES ${oracle_SOURCES} src/zip/unzip.cpp src/zip/zipglobal.cpp) set(oracle_SOURCES ${oracle_SOURCES} src/zip/unzip.cpp src/zip/zipglobal.cpp)
else() else()
message(STATUS "Oracle: zlib not found; ZIP support disabled") message(STATUS "Oracle: zlib not found; ZIP support disabled")
@ -88,7 +87,6 @@ find_package(LibLZMA)
if(LIBLZMA_FOUND) if(LIBLZMA_FOUND)
include_directories(${LIBLZMA_INCLUDE_DIRS}) include_directories(${LIBLZMA_INCLUDE_DIRS})
add_definitions("-DHAS_LZMA") add_definitions("-DHAS_LZMA")
set(oracle_SOURCES ${oracle_SOURCES} src/lzma/decompress.cpp) set(oracle_SOURCES ${oracle_SOURCES} src/lzma/decompress.cpp)
else() else()
message(STATUS "Oracle: LibLZMA not found; xz support disabled") message(STATUS "Oracle: LibLZMA not found; xz support disabled")
@ -152,7 +150,7 @@ if(UNIX)
install(TARGETS oracle BUNDLE DESTINATION ./) install(TARGETS oracle BUNDLE DESTINATION ./)
else() else()
# Assume linux # Assume Linux
install(TARGETS oracle RUNTIME DESTINATION bin/) install(TARGETS oracle RUNTIME DESTINATION bin/)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/oracle.png DESTINATION ${ICONDIR}/hicolor/48x48/apps) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/oracle.png DESTINATION ${ICONDIR}/hicolor/48x48/apps)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/oracle.svg DESTINATION ${ICONDIR}/hicolor/scalable/apps) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/oracle.svg DESTINATION ${ICONDIR}/hicolor/scalable/apps)
@ -163,7 +161,7 @@ endif()
if(NOT WIN32 AND NOT APPLE) if(NOT WIN32 AND NOT APPLE)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/oracle.desktop DESTINATION ${DESKTOPDIR}) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/oracle.desktop DESTINATION ${DESKTOPDIR})
endif(NOT WIN32 AND NOT APPLE) endif()
if(APPLE) if(APPLE)
# these needs to be relative to CMAKE_INSTALL_PREFIX # these needs to be relative to CMAKE_INSTALL_PREFIX
@ -206,17 +204,17 @@ Translations = Resources/translations\")
endif() endif()
if(WIN32) if(WIN32)
# these needs to be relative to CMAKE_INSTALL_PREFIX # These needs to be relative to CMAKE_INSTALL_PREFIX
set(plugin_dest_dir Plugins) set(plugin_dest_dir Plugins)
set(qtconf_dest_dir .) set(qtconf_dest_dir .)
list(APPEND libSearchDirs ${QT_LIBRARY_DIR}) list(APPEND libSearchDirs ${QT_LIBRARY_DIR})
install( # install(
DIRECTORY "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${CMAKE_BUILD_TYPE}/" # DIRECTORY "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${CMAKE_BUILD_TYPE}/"
DESTINATION ./ # DESTINATION ./
FILES_MATCHING # FILES_MATCHING
PATTERN "*.dll" # PATTERN "*.dll"
) # )
# Qt plugins: iconengines, platforms, styles, tls (Qt6) # Qt plugins: iconengines, platforms, styles, tls (Qt6)
install( install(
@ -247,16 +245,16 @@ Translations = Resources/translations\")
COMPONENT Runtime COMPONENT Runtime
) )
install( # install(
CODE " # CODE "
file(GLOB_RECURSE QTPLUGINS # file(GLOB_RECURSE QTPLUGINS
\"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/*.dll\") # \"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/*.dll\")
set(BU_CHMOD_BUNDLE_ITEMS ON) # set(BU_CHMOD_BUNDLE_ITEMS ON)
include(BundleUtilities) # include(BundleUtilities)
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/Oracle.exe\" \"\${QTPLUGINS}\" \"${libSearchDirs}\") # fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/Oracle.exe\" \"\${QTPLUGINS}\" \"${libSearchDirs}\")
" # "
COMPONENT Runtime # COMPONENT Runtime
) # )
endif() endif()
if(Qt6_FOUND AND Qt6LinguistTools_FOUND) if(Qt6_FOUND AND Qt6LinguistTools_FOUND)
@ -289,3 +287,15 @@ endif()
if(Qt6_FOUND) if(Qt6_FOUND)
qt6_finalize_target(oracle) qt6_finalize_target(oracle)
endif() endif()
if(WIN32)
install(CODE "
include(BundleUtilities)
set(BU_CHMOD_BUNDLE_ITEMS ON)
fixup_bundle(
\"\${CMAKE_INSTALL_PREFIX}/Oracle.exe\"
\"\"
\"\${CMAKE_INSTALL_PREFIX}\"
)
")
endif()