mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-18 04:51:33 -07:00
Add lock around deleting arrows for commanding cards Add support for Qt6 w/ Backwards Qt5 Handle Qt5/6 cross compilation better Last cleanups caps matter Fix serv Prevent crash on 6.3.0 Linux & bump to 5.8 min Prevent out of bounds indexing Delete shutdown timer if it exists Fixup ticket comments, remove unneeded guards Try to add support for missing OSes Update .ci/release_template.md Update PR based on comments Update XML name after done and remove Hirsute Address local game crash Address comments from PR (again) Tests don't work on mac, will see if a problem on other OSes make soundengine more consistent across qt versions disable tests on distros that are covered by others Fix Oracle Crash due to bad memory access Update Oracle to use new Qt6 way of adding translations Add support for Qt5/Qt6 compiling of Cockatrice Remove unneeded calls to QtMath/cmath/math.h Update how we handle bitwise comparisons for enums with Tray Icon Change header guards to not duplicate function Leave comment & Fix Path for GHA Qt Update common/server.h Update cockatrice/src/window_main.cpp Rollback change on cmake module path for NSIS check docker image requirements add size limit to ccache put variables in quotes properly set build type on mac avoid names used in cmake fix up cmake module path cmake 3.10 does not recognize prepend Support Tests in FindQtRuntime set ccache size on non debug builds as well immediately return when removing non existing client handle incTxBytes with a signal instead don't set common link libraries in cockatrice/CMakeLists.txt add comments set macos qt version to 6 Try upgrading XCode versions to latest they can be supported on Ensure Qt gets linked add tmate so i can see what's going on Qt6 points two directories further down than Qt5 with regard to the top lib path, so we need to account for this Establish Plugins directory for Qt6 Establish TLS plugins for Qt6 services Minor change for release channel network manager Let windows build in parallel cores Wrong symbols Qt6 patch up for signal add missing qt6 package on deb builds boolean expressions are hard negative indexes should go to the end Intentionally fail cache move size checks to individual zone types Hardcode libs needed for building on Windows, as the regex was annoying Update wording use the --parallel option in all builds clean up the .ci scripts some more tweak fedora build add os parameter to compile.sh I don't really like this but it seems the easiest way I'd prefer if these types of quirks would live in the main configuration file, the yml fixup yml readd appended cache key to vcpkg step fix windows 32 quirk the json hash is already added to the key as well remove os parameter and clean up ci files set name_build.sh to output relative paths set backwards compatible version of xcode and qt on mac set QTDIR for mac builds on qt5 has no effect for qt6 export BUILD_DIR to name_build.sh merge mac build steps merge homebrew steps, set package suffix link qt5 remove brew link set qtdir to qt5 only compile.sh vars need to be empty not 0 fix sets manager search bar on qt 5.12/15 fix oracle subprocess errors being ignored on qt 5 clean up translation loading move en@source translation file so it will not get included in packages NOTE: this needs to be done at transifex as well! Use generator platform over osname Short circuit if not Win defined
185 lines
7.2 KiB
CMake
185 lines
7.2 KiB
CMake
# CMakeLists for servatrice directory
|
|
#
|
|
# provides the servatrice binary
|
|
|
|
PROJECT(Servatrice VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
|
|
|
SET(servatrice_SOURCES
|
|
src/main.cpp
|
|
src/servatrice.cpp
|
|
src/servatrice_connection_pool.cpp
|
|
src/servatrice_database_interface.cpp
|
|
src/server_logger.cpp
|
|
src/serversocketinterface.cpp
|
|
src/settingscache.cpp
|
|
src/isl_interface.cpp
|
|
src/signalhandler.cpp
|
|
${VERSION_STRING_CPP}
|
|
src/smtpclient.cpp
|
|
src/smtp/qxthmac.cpp
|
|
src/smtp/qxtmailattachment.cpp
|
|
src/smtp/qxtmailmessage.cpp
|
|
src/smtp/qxtsmtp.cpp
|
|
)
|
|
|
|
set(servatrice_RESOURCES servatrice.qrc)
|
|
|
|
if(WIN32)
|
|
set(servatrice_SOURCES ${servatrice_SOURCES} servatrice.rc)
|
|
endif(WIN32)
|
|
|
|
# Under FreeBSD we need libexecinfo to use backtrace_symbols_fd()
|
|
if(CMAKE_HOST_SYSTEM MATCHES "FreeBSD")
|
|
find_package(Libexecinfo REQUIRED)
|
|
set(SYSTEM_LIBRARIES ${EXECINFO_LIBRARY} ${SYSTEM_LIBRARIES})
|
|
endif()
|
|
|
|
|
|
if(APPLE)
|
|
set(MACOSX_BUNDLE_ICON_FILE appicon.icns)
|
|
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/resources/appicon.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
|
set(servatrice_SOURCES ${servatrice_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/resources/appicon.icns)
|
|
ENDIF(APPLE)
|
|
|
|
IF(Qt6_FOUND)
|
|
Qt6_ADD_RESOURCES(servatrice_RESOURCES_RCC ${servatrice_RESOURCES})
|
|
ELSEIF(Qt5_FOUND)
|
|
Qt5_ADD_RESOURCES(servatrice_RESOURCES_RCC ${servatrice_RESOURCES})
|
|
ENDIF()
|
|
|
|
SET(QT_DONT_USE_QTGUI TRUE)
|
|
|
|
# Mysql connector
|
|
if(UNIX)
|
|
if(APPLE)
|
|
SET(MYSQLCLIENT_DEFAULT_PATHS "/usr/local/lib" "/opt/local/lib/mysql55/mysql/" "/opt/local/lib/mysql56/mysql/")
|
|
else()
|
|
SET(MYSQLCLIENT_DEFAULT_PATHS "/usr/lib64" "/usr/local/lib64" "/usr/lib" "/usr/local/lib")
|
|
endif()
|
|
elseif(WIN32)
|
|
SET(MYSQLCLIENT_DEFAULT_PATHS "C:\\Program Files\\MySQL\\MySQL Server 5.7\\lib" "C:\\Program Files (x86)\\MySQL\\MySQL Server 5.7\\lib")
|
|
endif()
|
|
|
|
find_library(MYSQL_CLIENT_LIBRARIES NAMES mysqlclient PATHS ${MYSQLCLIENT_DEFAULT_PATHS} PATH_SUFFIXES mysql mariadb)
|
|
if(${MYSQL_CLIENT_LIBRARIES} MATCHES "NOTFOUND")
|
|
set(MYSQLCLIENT_FOUND FALSE CACHE INTERNAL "")
|
|
MESSAGE(STATUS "MySQL connector NOT FOUND: Servatrice won't be able to connect to a MySQL server")
|
|
unset(MYSQL_CLIENT_LIBRARIES)
|
|
else()
|
|
set(MYSQLCLIENT_FOUND TRUE CACHE INTERNAL "")
|
|
get_filename_component(MYSQLCLIENT_LIBRARY_DIR ${MYSQL_CLIENT_LIBRARIES} PATH)
|
|
MESSAGE(STATUS "Found MySQL connector at: ${MYSQL_CLIENT_LIBRARIES}")
|
|
endif()
|
|
|
|
# Declare path variables
|
|
set(ICONDIR share/icons CACHE STRING "icon dir")
|
|
set(DESKTOPDIR share/applications CACHE STRING "desktop file destination")
|
|
|
|
# Include directories
|
|
INCLUDE_DIRECTORIES(../common)
|
|
INCLUDE_DIRECTORIES(${PROTOBUF_INCLUDE_DIR})
|
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../common)
|
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
# Build servatrice binary and link it
|
|
ADD_EXECUTABLE(servatrice MACOSX_BUNDLE ${servatrice_SOURCES} ${servatrice_RESOURCES_RCC} ${servatrice_MOC_SRCS})
|
|
|
|
if(CMAKE_HOST_SYSTEM MATCHES "FreeBSD")
|
|
TARGET_LINK_LIBRARIES(servatrice cockatrice_common Threads::Threads ${SERVATRICE_QT_MODULES} ${LIBEXECINFO_LIBRARY})
|
|
else()
|
|
TARGET_LINK_LIBRARIES(servatrice cockatrice_common Threads::Threads ${SERVATRICE_QT_MODULES})
|
|
endif()
|
|
|
|
# install rules
|
|
if(UNIX)
|
|
if(APPLE)
|
|
set(MACOSX_BUNDLE_INFO_STRING "${PROJECT_NAME}")
|
|
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.cockatrice.${PROJECT_NAME}")
|
|
set(MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_NAME}-${PROJECT_VERSION}")
|
|
set(MACOSX_BUNDLE_BUNDLE_NAME ${PROJECT_NAME})
|
|
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION})
|
|
set(MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION})
|
|
|
|
INSTALL(TARGETS servatrice BUNDLE DESTINATION ./)
|
|
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/servatrice.ini.example DESTINATION ./servatrice.app/Contents/Resources/)
|
|
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/servatrice.sql DESTINATION ./servatrice.app/Contents/Resources/)
|
|
else()
|
|
# Assume linux
|
|
INSTALL(TARGETS servatrice RUNTIME DESTINATION bin/)
|
|
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/servatrice.ini.example DESTINATION share/servatrice/)
|
|
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/servatrice.sql DESTINATION share/servatrice/)
|
|
|
|
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/servatrice.png DESTINATION ${ICONDIR}/hicolor/48x48/apps)
|
|
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/servatrice.svg DESTINATION ${ICONDIR}/hicolor/scalable/apps)
|
|
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/servatrice.desktop DESTINATION ${DESKTOPDIR})
|
|
endif()
|
|
elseif(WIN32)
|
|
INSTALL(TARGETS servatrice RUNTIME DESTINATION ./)
|
|
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/servatrice.ini.example DESTINATION ./)
|
|
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/servatrice.sql DESTINATION ./)
|
|
endif()
|
|
|
|
if(APPLE)
|
|
# these needs to be relative to CMAKE_INSTALL_PREFIX
|
|
set(plugin_dest_dir servatrice.app/Contents/Plugins)
|
|
set(qtconf_dest_dir servatrice.app/Contents/Resources)
|
|
|
|
# Qt plugins: platforms, sqldrivers/mysql, tls (Qt6)
|
|
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime
|
|
FILES_MATCHING
|
|
PATTERN "*.dSYM" EXCLUDE
|
|
PATTERN "*_debug.dylib" EXCLUDE
|
|
PATTERN "platforms/*.dylib"
|
|
PATTERN "sqldrivers/libqsqlmysql*.dylib"
|
|
PATTERN "tls/*.dylib"
|
|
)
|
|
|
|
install(CODE "
|
|
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]
|
|
Plugins = Plugins
|
|
Translations = Resources/translations\")
|
|
" COMPONENT Runtime)
|
|
|
|
install(CODE "
|
|
file(GLOB_RECURSE QTPLUGINS
|
|
\"\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/*.dylib\")
|
|
set(BU_CHMOD_BUNDLE_ITEMS ON)
|
|
include(BundleUtilities)
|
|
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/servatrice.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR};${MYSQLCLIENT_LIBRARY_DIR}\")
|
|
" COMPONENT Runtime)
|
|
endif()
|
|
|
|
if(WIN32)
|
|
# these needs to be relative to CMAKE_INSTALL_PREFIX
|
|
set(plugin_dest_dir Plugins)
|
|
set(qtconf_dest_dir .)
|
|
|
|
install(DIRECTORY "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${CMAKE_BUILD_TYPE}/" DESTINATION ./ FILES_MATCHING PATTERN "*.dll")
|
|
|
|
# Qt plugins: platforms, sqldrivers, tls (Qt6)
|
|
install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime FILES_MATCHING
|
|
PATTERN "platforms/qdirect2d.dll"
|
|
PATTERN "platforms/qminimal.dll"
|
|
PATTERN "platforms/qoffscreen.dll"
|
|
PATTERN "platforms/qwindows.dll"
|
|
PATTERN "tls/qcertonlybackend.dll"
|
|
PATTERN "tls/qopensslbackend.dll"
|
|
PATTERN "tls/qschannelbackend.dll"
|
|
PATTERN "sqldrivers/qsqlite.dll"
|
|
PATTERN "sqldrivers/qsqlodbc.dll"
|
|
PATTERN "sqldrivers/qsqlpsql.dll")
|
|
|
|
install(CODE "
|
|
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]
|
|
Plugins = Plugins
|
|
Translations = Resources/translations\")
|
|
" 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}/Servatrice.exe\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR};${MYSQLCLIENT_LIBRARY_DIR}\")
|
|
" COMPONENT Runtime)
|
|
endif()
|