mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 14:32:15 -07:00
Turn Card, Settings and Utility into libraries.
Took 4 hours 3 minutes Took 2 minutes Took 38 seconds Took 5 minutes Took 5 minutes Took 9 minutes Took 15 minutes
This commit is contained in:
parent
30e6b52783
commit
53d80efab8
262 changed files with 1025 additions and 918 deletions
|
|
@ -1,47 +1,48 @@
|
|||
# CMakeLists for dbconverter directory
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(Dbconverter VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
||||
|
||||
# ------------------------
|
||||
# Sources
|
||||
# ------------------------
|
||||
set(dbconverter_SOURCES
|
||||
src/main.cpp
|
||||
src/mocks.cpp
|
||||
../cockatrice/src/card/card_info.cpp
|
||||
../cockatrice/src/card/card_relation.cpp
|
||||
../cockatrice/src/card/card_set.cpp
|
||||
../cockatrice/src/card/card_set_list.cpp
|
||||
../cockatrice/src/card/exact_card.cpp
|
||||
../cockatrice/src/card/printing_info.cpp
|
||||
../cockatrice/src/database/card_database.cpp
|
||||
../cockatrice/src/database/card_database_loader.cpp
|
||||
../cockatrice/src/database/card_database_querier.cpp
|
||||
../cockatrice/src/database/parser/card_database_parser.cpp
|
||||
../cockatrice/src/database/parser/cockatrice_xml_3.cpp
|
||||
../cockatrice/src/database/parser/cockatrice_xml_4.cpp
|
||||
../cockatrice/src/settings/settings_manager.cpp
|
||||
${VERSION_STRING_CPP}
|
||||
)
|
||||
|
||||
# ------------------------
|
||||
# Qt configuration
|
||||
# ------------------------
|
||||
set(QT_DONT_USE_QTGUI TRUE)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
if(Qt6_FOUND)
|
||||
qt6_wrap_cpp(
|
||||
dbconverter_SOURCES ../cockatrice/src/settings/cache_settings.h ../cockatrice/src/settings/card_database_settings.h
|
||||
)
|
||||
elseif(Qt5_FOUND)
|
||||
qt5_wrap_cpp(
|
||||
dbconverter_SOURCES ../cockatrice/src/settings/cache_settings.h ../cockatrice/src/settings/card_database_settings.h
|
||||
)
|
||||
endif()
|
||||
# ------------------------
|
||||
# Build executable
|
||||
# ------------------------
|
||||
add_executable(dbconverter MACOSX_BUNDLE ${dbconverter_SOURCES})
|
||||
|
||||
# ------------------------
|
||||
# Include directories
|
||||
include_directories(../common) # Required due to card_ref.h
|
||||
# ------------------------
|
||||
target_include_directories(dbconverter
|
||||
PRIVATE ../common # shared common headers
|
||||
PRIVATE ../libs/card/include # cardlib public headers
|
||||
)
|
||||
|
||||
# Build servatrice binary and link it
|
||||
add_executable(dbconverter MACOSX_BUNDLE ${dbconverter_MOC_SRCS} ${dbconverter_SOURCES})
|
||||
# ------------------------
|
||||
# Link libraries
|
||||
# ------------------------
|
||||
target_link_libraries(dbconverter
|
||||
PRIVATE cardlib
|
||||
PRIVATE settingslib
|
||||
PRIVATE ${DB_CONVERTER_QT_MODULES}
|
||||
)
|
||||
|
||||
target_link_libraries(dbconverter ${DB_CONVERTER_QT_MODULES})
|
||||
|
||||
# install rules
|
||||
# ------------------------
|
||||
# Install rules
|
||||
# ------------------------
|
||||
if(UNIX)
|
||||
if(APPLE)
|
||||
set(MACOSX_BUNDLE_INFO_STRING "${PROJECT_NAME}")
|
||||
|
|
@ -53,91 +54,90 @@ if(UNIX)
|
|||
|
||||
install(TARGETS dbconverter BUNDLE DESTINATION ./)
|
||||
else()
|
||||
# Assume linux
|
||||
# Linux
|
||||
install(TARGETS dbconverter RUNTIME DESTINATION bin/)
|
||||
endif()
|
||||
elseif(WIN32)
|
||||
install(TARGETS dbconverter RUNTIME DESTINATION ./)
|
||||
endif()
|
||||
|
||||
# ------------------------
|
||||
# Qt plugin handling
|
||||
# ------------------------
|
||||
if(APPLE)
|
||||
# these needs to be relative to CMAKE_INSTALL_PREFIX
|
||||
set(plugin_dest_dir dbconverter.app/Contents/Plugins)
|
||||
set(qtconf_dest_dir dbconverter.app/Contents/Resources)
|
||||
|
||||
# Qt plugins: platforms
|
||||
install(
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/"
|
||||
DESTINATION ${plugin_dest_dir}
|
||||
COMPONENT Runtime
|
||||
FILES_MATCHING
|
||||
PATTERN "*.dSYM" EXCLUDE
|
||||
PATTERN "*_debug.dylib" EXCLUDE
|
||||
PATTERN "platforms/*.dylib"
|
||||
DIRECTORY "${QT_PLUGINS_DIR}/"
|
||||
DESTINATION ${plugin_dest_dir}
|
||||
COMPONENT Runtime
|
||||
FILES_MATCHING
|
||||
PATTERN "*.dSYM" EXCLUDE
|
||||
PATTERN "*_debug.dylib" EXCLUDE
|
||||
PATTERN "platforms/*.dylib"
|
||||
)
|
||||
|
||||
install(
|
||||
CODE "
|
||||
CODE "
|
||||
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]
|
||||
Plugins = Plugins
|
||||
Translations = Resources/translations\")
|
||||
"
|
||||
COMPONENT Runtime
|
||||
"
|
||||
COMPONENT Runtime
|
||||
)
|
||||
|
||||
install(
|
||||
CODE "
|
||||
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}/dbconverter.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR};${MYSQLCLIENT_LIBRARY_DIR}\")
|
||||
"
|
||||
COMPONENT Runtime
|
||||
set(BU_CHMOD_BUNDLE_ITEMS ON)
|
||||
include(BundleUtilities)
|
||||
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/dbconverter.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
|
||||
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"
|
||||
DIRECTORY "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${CMAKE_BUILD_TYPE}/"
|
||||
DESTINATION ./
|
||||
FILES_MATCHING
|
||||
PATTERN "*.dll"
|
||||
)
|
||||
|
||||
install(
|
||||
CODE "
|
||||
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"
|
||||
)
|
||||
|
||||
install(
|
||||
CODE "
|
||||
file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${qtconf_dest_dir}/qt.conf\" \"[Paths]
|
||||
Plugins = Plugins
|
||||
Translations = Resources/translations\")
|
||||
"
|
||||
COMPONENT Runtime
|
||||
"
|
||||
COMPONENT Runtime
|
||||
)
|
||||
|
||||
install(
|
||||
CODE "
|
||||
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}/dbconverter.exe\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\")
|
||||
"
|
||||
COMPONENT Runtime
|
||||
set(BU_CHMOD_BUNDLE_ITEMS ON)
|
||||
include(BundleUtilities)
|
||||
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/dbconverter.exe\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\")
|
||||
"
|
||||
COMPONENT Runtime
|
||||
)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef MAIN_H
|
||||
#define MAIN_H
|
||||
|
||||
#include "../../cockatrice/src/database/card_database.h"
|
||||
#include "../../cockatrice/src/database/parser/cockatrice_xml_4.h"
|
||||
#include "card/card_database/card_database.h"
|
||||
#include "card/card_database/parser/cockatrice_xml_4.h"
|
||||
|
||||
class CardDatabaseConverter : public CardDatabase
|
||||
{
|
||||
|
|
|
|||
|
|
@ -448,7 +448,7 @@ void SettingsCache::setRoundCardCorners(bool /* _roundCardCorners */)
|
|||
{
|
||||
}
|
||||
|
||||
void PictureLoader::clearPixmapCache(CardInfoPtr /* card */)
|
||||
void CardPictureLoader::clearPixmapCache(CardInfoPtr /* card */)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@
|
|||
|
||||
#define PICTURELOADER_H
|
||||
|
||||
#include "../../cockatrice/src/database/card_database.h"
|
||||
#include "../../cockatrice/src/settings/cache_settings.h"
|
||||
#include "../../cockatrice/src/utility/macros.h"
|
||||
#include "card/card_database/card_database.h"
|
||||
#include "settings/cache_settings.h"
|
||||
#include "utility/macros.h"
|
||||
|
||||
extern SettingsCache *settingsCache;
|
||||
|
||||
class PictureLoader
|
||||
class CardPictureLoader
|
||||
{
|
||||
public:
|
||||
static void clearPixmapCache(CardInfoPtr card);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue