From 79c805b8357e79f683838dcc81a5aada7f65a755 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Tue, 10 Jun 2014 14:11:16 +0200 Subject: [PATCH 01/22] Create sounds/zonebg CMakeLists.txt --- CMakeLists.txt | 7 ++----- sounds/CMakeLists.txt | 2 ++ zonebg/CMakeLists.txt | 2 ++ 3 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 sounds/CMakeLists.txt create mode 100644 zonebg/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 69d22d76..d924d307 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,12 +6,9 @@ endif(WITH_SERVER) if (NOT WITHOUT_CLIENT) add_subdirectory(cockatrice) add_subdirectory(oracle) + add_subdirectory(sounds) + add_subdirectory(zonebg) endif(NOT WITHOUT_CLIENT) if (WITH_TESTCLIENT) add_subdirectory(testclient) endif(WITH_TESTCLIENT) - -FILE(GLOB sounds "${CMAKE_CURRENT_SOURCE_DIR}/sounds/*.raw") -INSTALL(FILES ${sounds} DESTINATION share/cockatrice/sounds) -FILE(GLOB zonebg "${CMAKE_CURRENT_SOURCE_DIR}/zonebg/*.*") -INSTALL(FILES ${zonebg} DESTINATION share/cockatrice/zonebg) diff --git a/sounds/CMakeLists.txt b/sounds/CMakeLists.txt new file mode 100644 index 00000000..56a4a029 --- /dev/null +++ b/sounds/CMakeLists.txt @@ -0,0 +1,2 @@ +FILE(GLOB sounds "${CMAKE_CURRENT_SOURCE_DIR}/sounds/*.raw") +INSTALL(FILES ${sounds} DESTINATION share/cockatrice/sounds) diff --git a/zonebg/CMakeLists.txt b/zonebg/CMakeLists.txt new file mode 100644 index 00000000..b3e23a50 --- /dev/null +++ b/zonebg/CMakeLists.txt @@ -0,0 +1,2 @@ +FILE(GLOB zonebg "${CMAKE_CURRENT_SOURCE_DIR}/zonebg/*.*") +INSTALL(FILES ${zonebg} DESTINATION share/cockatrice/zonebg) From 20b9a538faed0ac709ae6108087eff0704abff8a Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Tue, 10 Jun 2014 22:33:21 +0200 Subject: [PATCH 02/22] Split PendingCommand 's implementation to its own cpp to permit automoc --- cockatrice/src/pending_command.cpp | 31 ++++++++++++++++++++++++++++++ cockatrice/src/pending_command.h | 17 ++++++---------- 2 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 cockatrice/src/pending_command.cpp diff --git a/cockatrice/src/pending_command.cpp b/cockatrice/src/pending_command.cpp new file mode 100644 index 00000000..0ebb1d82 --- /dev/null +++ b/cockatrice/src/pending_command.cpp @@ -0,0 +1,31 @@ +#include "pending_command.h" + +PendingCommand::PendingCommand(const CommandContainer &_commandContainer, QVariant _extraData) + : commandContainer(_commandContainer), extraData(_extraData), ticks(0) +{ + +} + +CommandContainer & PendingCommand::getCommandContainer() +{ + return commandContainer; +} + +void PendingCommand::setExtraData(const QVariant &_extraData) { + extraData = _extraData; +} + +QVariant PendingCommand::getExtraData() const { + return extraData; +} + +void PendingCommand::processResponse(const Response &response) +{ + emit finished(response, commandContainer, extraData); + emit finished(response.response_code()); +} + +int PendingCommand::tick() +{ + return ++ticks; +} diff --git a/cockatrice/src/pending_command.h b/cockatrice/src/pending_command.h index 9b092dcd..4ca9035b 100644 --- a/cockatrice/src/pending_command.h +++ b/cockatrice/src/pending_command.h @@ -15,17 +15,12 @@ private: QVariant extraData; int ticks; public: - PendingCommand(const CommandContainer &_commandContainer, QVariant _extraData = QVariant()) - : commandContainer(_commandContainer), extraData(_extraData), ticks(0) { } - CommandContainer &getCommandContainer() { return commandContainer; } - void setExtraData(const QVariant &_extraData) { extraData = _extraData; } - QVariant getExtraData() const { return extraData; } - void processResponse(const Response &response) - { - emit finished(response, commandContainer, extraData); - emit finished(response.response_code()); - } - int tick() { return ++ticks; } + PendingCommand(const CommandContainer &_commandContainer, QVariant _extraData = QVariant()); + CommandContainer &getCommandContainer(); + void setExtraData(const QVariant &_extraData); + QVariant getExtraData() const; + void processResponse(const Response &response); + int tick(); }; #endif From 84503483eb61f561fbf5a69a84c80d44c9718f6b Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Tue, 10 Jun 2014 23:25:59 +0200 Subject: [PATCH 03/22] Added missing ifdefs around keysignals.h --- cockatrice/src/keysignals.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cockatrice/src/keysignals.h b/cockatrice/src/keysignals.h index 23a07b77..693488c5 100644 --- a/cockatrice/src/keysignals.h +++ b/cockatrice/src/keysignals.h @@ -1,3 +1,6 @@ +#ifndef KEYSIGNALS_H +#define KEYSIGNALS_H + #include #include @@ -19,3 +22,5 @@ signals: protected: virtual bool eventFilter(QObject *, QEvent *event); }; + +#endif From c9f10554c6f8d7af4606624730cffcba4da69e26 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Tue, 10 Jun 2014 23:26:37 +0200 Subject: [PATCH 04/22] comment in sounds and zonebg's CMakeLists.txt --- sounds/CMakeLists.txt | 4 ++++ zonebg/CMakeLists.txt | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/sounds/CMakeLists.txt b/sounds/CMakeLists.txt index 56a4a029..6dd10f87 100644 --- a/sounds/CMakeLists.txt +++ b/sounds/CMakeLists.txt @@ -1,2 +1,6 @@ +# CMakeLists for sounds/ directory +# +# Installs default sound files + FILE(GLOB sounds "${CMAKE_CURRENT_SOURCE_DIR}/sounds/*.raw") INSTALL(FILES ${sounds} DESTINATION share/cockatrice/sounds) diff --git a/zonebg/CMakeLists.txt b/zonebg/CMakeLists.txt index b3e23a50..76c7c356 100644 --- a/zonebg/CMakeLists.txt +++ b/zonebg/CMakeLists.txt @@ -1,2 +1,6 @@ +# CMakeLists for zonebg/ directory +# +# Installs default "zone background" files + FILE(GLOB zonebg "${CMAKE_CURRENT_SOURCE_DIR}/zonebg/*.*") INSTALL(FILES ${zonebg} DESTINATION share/cockatrice/zonebg) From 4c1687264d1e9566676ced21ee20769925bf64de Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Tue, 10 Jun 2014 23:29:24 +0200 Subject: [PATCH 05/22] main CMakeLists.txt: major overhaul MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * define CMAKE_INSTALL_PREFIX * define compilation flags * find needed libraries * enable Qt4’s automoc * Added comments --- CMakeLists.txt | 62 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0540ff8b..5004ae66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,20 +1,80 @@ +# Cockatrice's main CMakeLists.txt +# +# This is basically a wrapper to enable/disable the compilation +# of the different projects: servatrice, cockatrice, test +# This file sets all the variables shared between the projects +# like the installation path, compilation flags etc.. + cmake_minimum_required(VERSION 2.6) -IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") +# Set conventional loops +set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) + +# Define a proper install path +if(UNIX) + if(APPLE) + # MacOS X + # Due to the special bundle structure ignore + # the prefix eventually set by the user. + set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/release) + else() + # Linux / BSD + if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + #fix package build + if(PREFIX) + set(CMAKE_INSTALL_PREFIX ${PREFIX}) + else() + set(CMAKE_INSTALL_PREFIX /usr/local) + endif() + endif() + endif() +elseif(WIN32) + set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/release) +endif() + +# Force "Release" build type by default +set(CMAKE_BUILD_TYPE Release) + +# Define proper compilation flags +IF (CMAKE_COMPILER_IS_GNUCC) + # linux/gcc, bsd/gcc, windows/mingw + set(CMAKE_CXX_FLAGS_RELEASE "-s -O2") + set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -O0") +else() + # other: osx/llvm, bsd/llvm + set(CMAKE_CXX_FLAGS_RELEASE "-O2") + set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") +ENDIF (CMAKE_COMPILER_IS_GNUCC) + # GNU systems need to define the Mersenne exponent for the RNG to compile w/o warning +IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") ADD_DEFINITIONS("-DSFMT_MEXP=19937") ENDIF() +#Find Qt4 and enable the needed features +FIND_PACKAGE(Qt4 REQUIRED) + +set(CMAKE_AUTOMOC TRUE) + +# Find other needed libraries +FIND_PACKAGE(Protobuf REQUIRED) +FIND_PACKAGE(Threads) + +# Compile servatrice (default off) add_subdirectory(common) if(WITH_SERVER) add_subdirectory(servatrice) endif(WITH_SERVER) + +# Compile cockatrice+oracle (default on) if (NOT WITHOUT_CLIENT) add_subdirectory(cockatrice) add_subdirectory(oracle) add_subdirectory(sounds) add_subdirectory(zonebg) endif(NOT WITHOUT_CLIENT) + +# Compile testclient (default off) if (WITH_TESTCLIENT) add_subdirectory(testclient) endif(WITH_TESTCLIENT) From 0dd6567583e609200cad3febae6892ee3ac08b0d Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Tue, 10 Jun 2014 23:32:52 +0200 Subject: [PATCH 06/22] cockatrice's CMakeLists.txt: major overhaul * Remove cockatrice_HEADERS (obsoleted by automoc) * Remove compilation flags definition and Qt4 finding calls * Make use of CMAKE_INSTALL_PREFIX * use INSTALL(TARGETS) in place of INSTALL(PROGRAM) * Osx: create a proper application bundle * Added comments --- cockatrice/CMakeLists.txt | 164 +++++++++++++------------------------- 1 file changed, 56 insertions(+), 108 deletions(-) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index d25b9d7c..da75ebd3 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -1,5 +1,7 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) +# CMakeLists for cockatrice directory +# +# provides the cockatrice binary + PROJECT(cockatrice) SET(cockatrice_SOURCES @@ -87,91 +89,9 @@ SET(cockatrice_SOURCES src/priceupdater.cpp src/qt-json/json.cpp src/soundengine.cpp + src/pending_command.cpp ${CMAKE_CURRENT_BINARY_DIR}/version_string.cpp ) -SET(cockatrice_HEADERS - src/abstractcounter.h - src/counter_general.h - src/dlg_creategame.h - src/dlg_filter_games.h - src/dlg_connect.h - src/dlg_create_token.h - src/dlg_edit_tokens.h - src/gamesmodel.h - src/abstractclient.h - src/remoteclient.h - src/window_main.h - src/cardzone.h - src/selectzone.h - src/player.h - src/playertarget.h - src/abstractcarditem.h - src/carditem.h - src/tablezone.h - src/handzone.h - src/handcounter.h - src/carddatabase.h - src/keysignals.h - src/gameview.h - src/gameselector.h - src/decklistmodel.h - src/deck_loader.h - src/dlg_load_deck_from_clipboard.h - src/dlg_load_remote_deck.h - src/cardinfowidget.h - src/cardframe.h - src/cardinfopicture.h - src/cardinfotext.h - src/filterbuilder.h - src/cardfilter.h - src/filtertreemodel.h - src/filtertree.h - src/messagelogwidget.h - src/zoneviewzone.h - src/zoneviewwidget.h - src/pilezone.h - src/stackzone.h - src/carddragitem.h - src/carddatabasemodel.h - src/setsmodel.h - src/window_sets.h - src/abstractgraphicsitem.h - src/abstractcarddragitem.h - src/dlg_settings.h - src/dlg_cardsearch.h - src/phasestoolbar.h - src/gamescene.h - src/arrowitem.h - src/arrowtarget.h - src/tab.h - src/tab_server.h - src/tab_room.h - src/tab_message.h - src/tab_game.h - src/tab_deck_storage.h - src/tab_replays.h - src/tab_supervisor.h - src/tab_admin.h - src/tab_userlists.h - src/tab_deck_editor.h - src/replay_timeline_widget.h - src/deckstats_interface.h - src/chatview.h - src/userlist.h - src/userinfobox.h - src/user_context_menu.h - src/remotedecklist_treewidget.h - src/remotereplaylist_treewidget.h - src/deckview.h - src/playerlistwidget.h - src/settingscache.h - src/localserver.h - src/localserverinterface.h - src/localclient.h - src/priceupdater.h - src/soundengine.h - src/pending_command.h -) if (UNIX AND NOT APPLE) set_source_files_properties(src/main.cpp PROPERTIES COMPILE_FLAGS -DTRANSLATION_PATH=\\"${CMAKE_INSTALL_PREFIX}/share/cockatrice/translations\\") @@ -204,34 +124,26 @@ if(APPLE) set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/resources/appicon.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) set(cockatrice_SOURCES ${cockatrice_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/resources/appicon.icns) ENDIF(APPLE) + +if (NOT QT_QTMULTIMEDIA_FOUND) + FIND_PACKAGE(QtMobility REQUIRED) +endif (NOT QT_QTMULTIMEDIA_FOUND) + SET(QT_USE_QTNETWORK TRUE) SET(QT_USE_QTMULTIMEDIA TRUE) SET(QT_USE_QTXML TRUE) SET(QT_USE_QTSVG TRUE) -FIND_PACKAGE(Qt4 REQUIRED) -if (NOT QT_QTMULTIMEDIA_FOUND) - FIND_PACKAGE(QtMobility REQUIRED) -endif (NOT QT_QTMULTIMEDIA_FOUND) -FIND_PACKAGE(Protobuf REQUIRED) -FIND_PACKAGE(Threads) -IF (CMAKE_COMPILER_IS_GNUCC) - set(CMAKE_CXX_FLAGS_RELEASE "-s -O2") - set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -O0") -ELSE (CMAKE_COMPILER_IS_GNUCC) - set(CMAKE_CXX_FLAGS_RELEASE "-O2") - set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") -ENDIF (CMAKE_COMPILER_IS_GNUCC) - -# paths +# Declare path variables set(ICONDIR share/icons CACHE STRING "icon dir") set(DESKTOPDIR share/applications CACHE STRING "desktop file destination") - -QT4_WRAP_CPP(cockatrice_HEADERS_MOC ${cockatrice_HEADERS}) +# Let cmake chew Qt4's translations and resource files +# Note: header files are MOC-ed automatically by cmake QT4_ADD_TRANSLATION(cockatrice_QM ${cockatrice_TS}) QT4_ADD_RESOURCES(cockatrice_RESOURCES_RCC ${cockatrice_RESOURCES}) +# Include directories INCLUDE(${QT_USE_FILE}) INCLUDE_DIRECTORIES(../common) INCLUDE_DIRECTORIES(${PROTOBUF_INCLUDE_DIR}) @@ -240,14 +152,22 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) INCLUDE_DIRECTORIES(${QT_MOBILITY_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${QT_MOBILITY_MULTIMEDIAKIT_INCLUDE_DIR}) -ADD_EXECUTABLE(cockatrice WIN32 MACOSX_BUNDLE ${cockatrice_SOURCES} ${cockatrice_QM} ${cockatrice_RESOURCES_RCC} ${cockatrice_HEADERS_MOC}) +# Build cockatrice binary and link it +ADD_EXECUTABLE(cockatrice WIN32 MACOSX_BUNDLE ${cockatrice_SOURCES} ${cockatrice_QM} ${cockatrice_RESOURCES_RCC} ${cockatrice_MOC_SRCS}) TARGET_LINK_LIBRARIES(cockatrice cockatrice_common ${QT_LIBRARIES} ${QT_MOBILITY_MULTIMEDIAKIT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) -IF (NOT APPLE) - INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/cockatrice DESTINATION bin) -ELSE (APPLE) - INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/cockatrice.app DESTINATION bin) -ENDIF (NOT APPLE) + +if(UNIX) + if(APPLE) + INSTALL(TARGETS cockatrice BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}) + else() + # Assume linux + INSTALL(TARGETS cockatrice RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) + endif() +elseif(WIN32) + INSTALL(TARGETS cockatrice RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) +endif() + if (NOT WIN32 AND NOT APPLE) 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) @@ -260,3 +180,31 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/../common/getversion.cmake ) +if(APPLE) + set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/cockatrice.app/Contents/Plugins) + set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/cockatrice.app/Contents/Resources) + + # note: no codecs in qt5 + # note: phonon_backend => mediaservice + # note: needs platform on osx + + if (CMAKE_BUILD_TYPE STREQUAL "Debug") + install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime + FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*_debug\\.dylib") + else() + install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime + FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/[^_]*\\.dylib") + endif() + + install(CODE " + file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] +Plugins = Plugins\") + " COMPONENT Runtime) + + install(CODE " + file(GLOB_RECURSE QTPLUGINS + \"${plugin_dest_dir}/*.dylib\") + include(BundleUtilities) + fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/cockatrice.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") + " COMPONENT Runtime) +endif() From 0f02c6b0a2a3ab1168a862c2820eab1c0692bdcb Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Tue, 10 Jun 2014 23:33:33 +0200 Subject: [PATCH 07/22] oracle's CMakeLists.txt: major overhaul * Remove cockatrice_HEADERS (obsoleted by automoc) * Remove compilation flags definition and Qt4 finding calls * Make use of CMAKE_INSTALL_PREFIX * use INSTALL(TARGETS) in place of INSTALL(PROGRAM) * Osx: create a proper application bundle * Added comments --- oracle/CMakeLists.txt | 73 ++++++++++++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 19 deletions(-) diff --git a/oracle/CMakeLists.txt b/oracle/CMakeLists.txt index 6f4e18c9..66587765 100644 --- a/oracle/CMakeLists.txt +++ b/oracle/CMakeLists.txt @@ -1,38 +1,73 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +# CMakeLists for oracle directory +# +# provides the oracle binary + PROJECT(oracle) # paths set(DESKTOPDIR share/applications CACHE STRING "path to .desktop files") -SET(oracle_SOURCES src/main.cpp src/oracleimporter.cpp src/window_main.cpp ../cockatrice/src/carddatabase.cpp ../cockatrice/src/settingscache.cpp) -SET(oracle_HEADERS src/oracleimporter.h src/window_main.h ../cockatrice/src/carddatabase.h ../cockatrice/src/settingscache.h) +SET(oracle_SOURCES + src/main.cpp + src/oracleimporter.cpp + src/window_main.cpp + ../cockatrice/src/carddatabase.cpp + ../cockatrice/src/settingscache.cpp + ) SET(QT_USE_QTNETWORK TRUE) SET(QT_USE_QTXML TRUE) SET(QT_USE_QTSVG TRUE) FIND_PACKAGE(Qt4 REQUIRED) -set(CMAKE_BUILD_TYPE Release) -IF (CMAKE_COMPILER_IS_GNUCC) - set(CMAKE_CXX_FLAGS_RELEASE "-s -O2") - set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -O0") -ELSE (CMAKE_COMPILER_IS_GNUCC) - set(CMAKE_CXX_FLAGS_RELEASE "-O2") - set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") -ENDIF (CMAKE_COMPILER_IS_GNUCC) - -QT4_WRAP_CPP(oracle_HEADERS_MOC ${oracle_HEADERS}) +# Include directories INCLUDE(${QT_USE_FILE}) INCLUDE_DIRECTORIES(../cockatrice/src) -ADD_EXECUTABLE(oracle WIN32 MACOSX_BUNDLE ${oracle_SOURCES} ${oracle_HEADERS_MOC}) +# Build oracle binary and link it +ADD_EXECUTABLE(oracle WIN32 MACOSX_BUNDLE ${oracle_SOURCES} ${oracle_MOC_SRCS}) TARGET_LINK_LIBRARIES(oracle ${QT_LIBRARIES}) -IF (NOT APPLE) - INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/oracle DESTINATION bin) -ELSE (APPLE) - INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/oracle.app DESTINATION bin) -ENDIF (NOT APPLE) +if(UNIX) + if(APPLE) + INSTALL(TARGETS oracle BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}) + else() + # Assume linux + INSTALL(TARGETS oracle RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) + endif() +elseif(WIN32) + INSTALL(TARGETS oracle RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) +endif() + IF (NOT WIN32 AND NOT APPLE) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/oracle.desktop DESTINATION ${DESKTOPDIR}) ENDIF (NOT WIN32 AND NOT APPLE) + +if(APPLE) + set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Plugins) + set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Resources) + + # note: no codecs in qt5 + # note: phonon_backend => mediaservice + # note: needs platform on osx + + if (CMAKE_BUILD_TYPE STREQUAL "Debug") + install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime + FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*_debug\\.dylib") + else() + install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime + FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/[^_]*\\.dylib") + endif() + + install(CODE " + file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] +Plugins = Plugins\") + " COMPONENT Runtime) + + install(CODE " + file(GLOB_RECURSE QTPLUGINS + \"${plugin_dest_dir}/*.dylib\") + include(BundleUtilities) + fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/oracle.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") + " COMPONENT Runtime) +endif() From 4b49458eebc875e942eb02afa5c94b76a3a67c9d Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Tue, 10 Jun 2014 23:34:01 +0200 Subject: [PATCH 08/22] servatrice's CMakeLists.txt: major overhaul * Remove cockatrice_HEADERS (obsoleted by automoc) * Remove compilation flags definition and Qt4 finding calls * Make use of CMAKE_INSTALL_PREFIX * use INSTALL(TARGETS) in place of INSTALL(PROGRAM) * Osx: create a proper application bundle * Added comments --- servatrice/CMakeLists.txt | 79 ++++++++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 27 deletions(-) diff --git a/servatrice/CMakeLists.txt b/servatrice/CMakeLists.txt index 8af8fc4a..41c42952 100644 --- a/servatrice/CMakeLists.txt +++ b/servatrice/CMakeLists.txt @@ -1,44 +1,30 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) +# CMakeLists for servatrice directory +# +# provides the servatrice binary + PROJECT(servatrice) -# cmake modules -include(GNUInstallDirs) +# cmake module for libgcrypt is included in current directory +SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) +FIND_PACKAGE(Libgcrypt REQUIRED) SET(servatrice_SOURCES src/main.cpp src/passwordhasher.cpp - src/servatrice.cpp + src/servatrice.cpp src/servatrice_connection_pool.cpp src/servatrice_database_interface.cpp - src/server_logger.cpp - src/serversocketinterface.cpp + src/server_logger.cpp + src/serversocketinterface.cpp src/isl_interface.cpp ${CMAKE_CURRENT_BINARY_DIR}/version_string.cpp ) -SET(servatrice_HEADERS - src/servatrice.h - src/servatrice_connection_pool.h - src/servatrice_database_interface.h - src/server_logger.h - src/serversocketinterface.h - src/isl_interface.h -) SET(QT_DONTUSE_QTGUI) SET(QT_USE_QTNETWORK TRUE) SET(QT_USE_QTSQL TRUE) -FIND_PACKAGE(Qt4 REQUIRED) -FIND_PACKAGE(Protobuf REQUIRED) -FIND_PACKAGE(Libgcrypt REQUIRED) -FIND_PACKAGE(Threads) - -#set(CMAKE_BUILD_TYPE Release) -set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -O2") -set(CMAKE_CXX_FLAGS_RELEASE "-O2") - -QT4_WRAP_CPP(servatrice_HEADERS_MOC ${servatrice_HEADERS}) +# Include directories INCLUDE(${QT_USE_FILE}) INCLUDE_DIRECTORIES(../common) INCLUDE_DIRECTORIES(${LIBGCRYPT_INCLUDE_DIR}) @@ -46,7 +32,8 @@ INCLUDE_DIRECTORIES(${PROTOBUF_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../common) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) -ADD_EXECUTABLE(servatrice ${servatrice_SOURCES} ${servatrice_HEADERS_MOC}) +# Build servatrice binary and link it +ADD_EXECUTABLE(servatrice MACOSX_BUNDLE ${servatrice_SOURCES} ${servatrice_MOC_SRCS}) TARGET_LINK_LIBRARIES(servatrice cockatrice_common ${QT_LIBRARIES} ${LIBGCRYPT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) #add_custom_target(versionheader ALL DEPENDS version_header) @@ -56,4 +43,42 @@ add_custom_command( ) # install rules -INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/servatrice DESTINATION ${CMAKE_INSTALL_BINDIR}) +if(UNIX) + if(APPLE) + INSTALL(TARGETS servatrice BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}) + else() + # Assume linux + INSTALL(TARGETS servatrice RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) + endif() +elseif(WIN32) + INSTALL(TARGETS servatrice RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) +endif() + +if(APPLE) + set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/servatrice.app/Contents/Plugins) + set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/servatrice.app/Contents/Resources) + + # note: no codecs in qt5 + # note: phonon_backend => mediaservice + # note: needs platform on osx + + if (CMAKE_BUILD_TYPE STREQUAL "Debug") + install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime + FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*_debug\\.dylib") + else() + install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime + FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/[^_]*\\.dylib") + endif() + + install(CODE " + file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] +Plugins = Plugins\") + " COMPONENT Runtime) + + install(CODE " + file(GLOB_RECURSE QTPLUGINS + \"${plugin_dest_dir}/*.dylib\") + include(BundleUtilities) + fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/servatrice.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") + " COMPONENT Runtime) +endif() From b2ead4ffd2828d50ca84fabe375943640ec78ec4 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Wed, 11 Jun 2014 01:14:43 +0200 Subject: [PATCH 09/22] Ignore multiple build directories (used when cross compiling) --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 78301957..1753f78c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ tags -build +build* *.qm .directory From 5cd363e5907d05b81f1786835d53c81fc428b96d Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Wed, 11 Jun 2014 01:15:14 +0200 Subject: [PATCH 10/22] Removed duplicate FindQt4 --- oracle/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/oracle/CMakeLists.txt b/oracle/CMakeLists.txt index 66587765..336e6e3c 100644 --- a/oracle/CMakeLists.txt +++ b/oracle/CMakeLists.txt @@ -18,7 +18,6 @@ SET(oracle_SOURCES SET(QT_USE_QTNETWORK TRUE) SET(QT_USE_QTXML TRUE) SET(QT_USE_QTSVG TRUE) -FIND_PACKAGE(Qt4 REQUIRED) # Include directories INCLUDE(${QT_USE_FILE}) From 62f756e698fc85cebc4e64c592d5bbc4506c2a4d Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Wed, 11 Jun 2014 01:20:19 +0200 Subject: [PATCH 11/22] Remove pthread detection and linking: it's unused --- CMakeLists.txt | 1 - cockatrice/CMakeLists.txt | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5004ae66..76c672d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,6 @@ set(CMAKE_AUTOMOC TRUE) # Find other needed libraries FIND_PACKAGE(Protobuf REQUIRED) -FIND_PACKAGE(Threads) # Compile servatrice (default off) add_subdirectory(common) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index da75ebd3..16592c43 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -154,7 +154,7 @@ INCLUDE_DIRECTORIES(${QT_MOBILITY_MULTIMEDIAKIT_INCLUDE_DIR}) # Build cockatrice binary and link it ADD_EXECUTABLE(cockatrice WIN32 MACOSX_BUNDLE ${cockatrice_SOURCES} ${cockatrice_QM} ${cockatrice_RESOURCES_RCC} ${cockatrice_MOC_SRCS}) -TARGET_LINK_LIBRARIES(cockatrice cockatrice_common ${QT_LIBRARIES} ${QT_MOBILITY_MULTIMEDIAKIT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) +TARGET_LINK_LIBRARIES(cockatrice cockatrice_common ${QT_LIBRARIES} ${QT_MOBILITY_MULTIMEDIAKIT_LIBRARY}) if(UNIX) From 4fd8c94df01468df328d428b7a1197cc4917fb1c Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Wed, 11 Jun 2014 01:24:34 +0200 Subject: [PATCH 12/22] Overhaul common's CMakeLists.txt * Use automoc instead of a manual list of headers * Remove Qt4 detection * Created missing .cpp for .h files (for automoc detection) * Remove pthread linking * Forcing -lprotobuf is not needed for mingw; msvc only? --- common/CMakeLists.txt | 28 ++++------------------------ common/pb/CMakeLists.txt | 5 ++--- common/server_arrowtarget.cpp | 2 ++ common/server_database_interface.cpp | 2 ++ 4 files changed, 10 insertions(+), 27 deletions(-) create mode 100644 common/server_arrowtarget.cpp create mode 100644 common/server_database_interface.cpp diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 17d3fa46..e43c240a 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -9,10 +9,12 @@ SET(common_SOURCES server.cpp server_abstractuserinterface.cpp server_arrow.cpp + server_arrowtarget.h server_card.cpp server_cardzone.cpp server_counter.cpp server_game.cpp + server_database_interface.cpp server_player.cpp server_protocolhandler.cpp server_remoteuserinterface.cpp @@ -21,34 +23,12 @@ SET(common_SOURCES serverinfo_user_container.cpp sfmt/SFMT.c ) -SET(common_HEADERS - decklist.h - rng_abstract.h - rng_sfmt.h - server.h - server_arrowtarget.h - server_card.h - server_database_interface.h - server_game.h - server_player.h - server_protocolhandler.h - server_room.h -) -FIND_PACKAGE(Qt4 REQUIRED) -FIND_PACKAGE(Protobuf REQUIRED) - -QT4_WRAP_CPP(common_HEADERS_MOC ${common_HEADERS}) INCLUDE(${QT_USE_FILE}) INCLUDE_DIRECTORIES(pb) INCLUDE_DIRECTORIES(sfmt) INCLUDE_DIRECTORIES(${PROTOBUF_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) -add_library(cockatrice_common ${common_SOURCES} ${common_HEADERS_MOC}) -# Without this check, Linux will put -pthread out of order in link.txt and build will fail -if (UNIX) - target_link_libraries(cockatrice_common cockatrice_protocol pthread) -else (UNIX) - target_link_libraries(cockatrice_common cockatrice_protocol) -endif (UNIX) +add_library(cockatrice_common ${common_SOURCES} ${common_MOC_SRCS}) +target_link_libraries(cockatrice_common cockatrice_protocol) diff --git a/common/pb/CMakeLists.txt b/common/pb/CMakeLists.txt index e109a58b..b654443e 100644 --- a/common/pb/CMakeLists.txt +++ b/common/pb/CMakeLists.txt @@ -144,14 +144,13 @@ SET(PROTO_FILES session_event.proto ) -find_package(Protobuf REQUIRED) include_directories(${PROTOBUF_INCLUDE_DIRS}) include_directories(${CMAKE_CURRENT_BINARY_DIR}) PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${PROTO_FILES}) add_library(cockatrice_protocol ${PROTO_SRCS} ${PROTO_HDRS}) set(cockatrice_protocol_LIBS ${PROTOBUF_LIBRARIES}) -if (WIN32) +if (MSVC) set(cockatrice_protocol_LIBS ${cockatrice_protocol_LIBS} -lprotobuf) -endif (WIN32) +endif (MSVC) target_link_libraries(cockatrice_protocol ${cockatrice_protocol_LIBS}) diff --git a/common/server_arrowtarget.cpp b/common/server_arrowtarget.cpp new file mode 100644 index 00000000..aa7789dd --- /dev/null +++ b/common/server_arrowtarget.cpp @@ -0,0 +1,2 @@ + +#include "server_arrowtarget.h" \ No newline at end of file diff --git a/common/server_database_interface.cpp b/common/server_database_interface.cpp new file mode 100644 index 00000000..a375f603 --- /dev/null +++ b/common/server_database_interface.cpp @@ -0,0 +1,2 @@ + +#include "server_database_interface.h" From ed0311d59e770f151ba06f4b29fcdd4fa8c52d2b Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Wed, 11 Jun 2014 01:26:54 +0200 Subject: [PATCH 13/22] Added comments for comment's CMakeLists.txt --- common/CMakeLists.txt | 4 ++++ common/pb/CMakeLists.txt | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index e43c240a..d7373115 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -1,3 +1,7 @@ +# CMakeLists for common directory +# +# provides the common library + CMAKE_MINIMUM_REQUIRED(VERSION 2.6) add_subdirectory(pb) diff --git a/common/pb/CMakeLists.txt b/common/pb/CMakeLists.txt index b654443e..455f161f 100644 --- a/common/pb/CMakeLists.txt +++ b/common/pb/CMakeLists.txt @@ -1,3 +1,7 @@ +# CMakeLists for common directory +# +# provides the protobuf interfaces + CMAKE_MINIMUM_REQUIRED(VERSION 2.6) SET(PROTO_FILES From 721cf6fe4ffd2eb5d70f717c99a241da5244577f Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Wed, 11 Jun 2014 18:08:30 +0200 Subject: [PATCH 14/22] Re-indent CMakeLists.txt using spaces --- CMakeLists.txt | 60 ++++---- cockatrice/CMakeLists.txt | 280 ++++++++++++++++++------------------- common/CMakeLists.txt | 40 +++--- common/pb/CMakeLists.txt | 284 +++++++++++++++++++------------------- oracle/CMakeLists.txt | 74 +++++----- servatrice/CMakeLists.txt | 105 +++++++++----- 6 files changed, 436 insertions(+), 407 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76c672d8..c746074a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,24 +12,24 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) # Define a proper install path if(UNIX) - if(APPLE) - # MacOS X - # Due to the special bundle structure ignore - # the prefix eventually set by the user. - set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/release) - else() - # Linux / BSD - if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - #fix package build - if(PREFIX) - set(CMAKE_INSTALL_PREFIX ${PREFIX}) - else() - set(CMAKE_INSTALL_PREFIX /usr/local) - endif() - endif() - endif() + if(APPLE) + # MacOS X + # Due to the special bundle structure ignore + # the prefix eventually set by the user. + set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/release) + else() + # Linux / BSD + if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + #fix package build + if(PREFIX) + set(CMAKE_INSTALL_PREFIX ${PREFIX}) + else() + set(CMAKE_INSTALL_PREFIX /usr/local) + endif() + endif() + endif() elseif(WIN32) - set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/release) + set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/release) endif() # Force "Release" build type by default @@ -37,18 +37,18 @@ set(CMAKE_BUILD_TYPE Release) # Define proper compilation flags IF (CMAKE_COMPILER_IS_GNUCC) - # linux/gcc, bsd/gcc, windows/mingw - set(CMAKE_CXX_FLAGS_RELEASE "-s -O2") - set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -O0") + # linux/gcc, bsd/gcc, windows/mingw + set(CMAKE_CXX_FLAGS_RELEASE "-s -O2") + set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -O0") else() - # other: osx/llvm, bsd/llvm - set(CMAKE_CXX_FLAGS_RELEASE "-O2") - set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") + # other: osx/llvm, bsd/llvm + set(CMAKE_CXX_FLAGS_RELEASE "-O2") + set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") ENDIF (CMAKE_COMPILER_IS_GNUCC) # GNU systems need to define the Mersenne exponent for the RNG to compile w/o warning IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") - ADD_DEFINITIONS("-DSFMT_MEXP=19937") + ADD_DEFINITIONS("-DSFMT_MEXP=19937") ENDIF() #Find Qt4 and enable the needed features @@ -62,18 +62,18 @@ FIND_PACKAGE(Protobuf REQUIRED) # Compile servatrice (default off) add_subdirectory(common) if(WITH_SERVER) - add_subdirectory(servatrice) + add_subdirectory(servatrice) endif(WITH_SERVER) # Compile cockatrice+oracle (default on) if (NOT WITHOUT_CLIENT) - add_subdirectory(cockatrice) - add_subdirectory(oracle) - add_subdirectory(sounds) - add_subdirectory(zonebg) + add_subdirectory(cockatrice) + add_subdirectory(oracle) + add_subdirectory(sounds) + add_subdirectory(zonebg) endif(NOT WITHOUT_CLIENT) # Compile testclient (default off) if (WITH_TESTCLIENT) - add_subdirectory(testclient) + add_subdirectory(testclient) endif(WITH_TESTCLIENT) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index 16592c43..38497e53 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -5,128 +5,128 @@ PROJECT(cockatrice) SET(cockatrice_SOURCES - src/abstractcounter.cpp - src/counter_general.cpp - src/dlg_creategame.cpp - src/dlg_filter_games.cpp - src/dlg_connect.cpp - src/dlg_create_token.cpp - src/dlg_edit_tokens.cpp - src/abstractclient.cpp - src/remoteclient.cpp - src/main.cpp - src/window_main.cpp - src/gamesmodel.cpp - src/player.cpp - src/playertarget.cpp - src/cardzone.cpp - src/selectzone.cpp - src/cardlist.cpp - src/abstractcarditem.cpp - src/carditem.cpp - src/tablezone.cpp - src/handzone.cpp - src/handcounter.cpp - src/carddatabase.cpp - src/keysignals.cpp - src/gameview.cpp - src/gameselector.cpp - src/decklistmodel.cpp - src/deck_loader.cpp - src/dlg_load_deck_from_clipboard.cpp - src/dlg_load_remote_deck.cpp - src/cardinfowidget.cpp - src/cardframe.cpp - src/cardinfopicture.cpp - src/cardinfotext.cpp - src/filterbuilder.cpp - src/cardfilter.cpp - src/filtertreemodel.cpp - src/filtertree.cpp - src/messagelogwidget.cpp - src/zoneviewzone.cpp - src/zoneviewwidget.cpp - src/pilezone.cpp - src/stackzone.cpp - src/carddragitem.cpp - src/carddatabasemodel.cpp - src/setsmodel.cpp - src/window_sets.cpp - src/abstractgraphicsitem.cpp - src/abstractcarddragitem.cpp - src/dlg_settings.cpp - src/dlg_cardsearch.cpp - src/phasestoolbar.cpp - src/gamescene.cpp - src/arrowitem.cpp - src/arrowtarget.cpp - src/tab.cpp - src/tab_server.cpp - src/tab_room.cpp - src/tab_message.cpp - src/tab_game.cpp - src/tab_deck_storage.cpp - src/tab_replays.cpp - src/tab_supervisor.cpp - src/tab_admin.cpp - src/tab_userlists.cpp - src/tab_deck_editor.cpp - src/replay_timeline_widget.cpp - src/deckstats_interface.cpp - src/chatview.cpp - src/userlist.cpp - src/userinfobox.cpp - src/user_context_menu.cpp - src/remotedecklist_treewidget.cpp - src/remotereplaylist_treewidget.cpp - src/deckview.cpp - src/playerlistwidget.cpp - src/pixmapgenerator.cpp - src/settingscache.cpp - src/localserver.cpp - src/localserverinterface.cpp - src/localclient.cpp - src/priceupdater.cpp - src/qt-json/json.cpp - src/soundengine.cpp - src/pending_command.cpp - ${CMAKE_CURRENT_BINARY_DIR}/version_string.cpp + src/abstractcounter.cpp + src/counter_general.cpp + src/dlg_creategame.cpp + src/dlg_filter_games.cpp + src/dlg_connect.cpp + src/dlg_create_token.cpp + src/dlg_edit_tokens.cpp + src/abstractclient.cpp + src/remoteclient.cpp + src/main.cpp + src/window_main.cpp + src/gamesmodel.cpp + src/player.cpp + src/playertarget.cpp + src/cardzone.cpp + src/selectzone.cpp + src/cardlist.cpp + src/abstractcarditem.cpp + src/carditem.cpp + src/tablezone.cpp + src/handzone.cpp + src/handcounter.cpp + src/carddatabase.cpp + src/keysignals.cpp + src/gameview.cpp + src/gameselector.cpp + src/decklistmodel.cpp + src/deck_loader.cpp + src/dlg_load_deck_from_clipboard.cpp + src/dlg_load_remote_deck.cpp + src/cardinfowidget.cpp + src/cardframe.cpp + src/cardinfopicture.cpp + src/cardinfotext.cpp + src/filterbuilder.cpp + src/cardfilter.cpp + src/filtertreemodel.cpp + src/filtertree.cpp + src/messagelogwidget.cpp + src/zoneviewzone.cpp + src/zoneviewwidget.cpp + src/pilezone.cpp + src/stackzone.cpp + src/carddragitem.cpp + src/carddatabasemodel.cpp + src/setsmodel.cpp + src/window_sets.cpp + src/abstractgraphicsitem.cpp + src/abstractcarddragitem.cpp + src/dlg_settings.cpp + src/dlg_cardsearch.cpp + src/phasestoolbar.cpp + src/gamescene.cpp + src/arrowitem.cpp + src/arrowtarget.cpp + src/tab.cpp + src/tab_server.cpp + src/tab_room.cpp + src/tab_message.cpp + src/tab_game.cpp + src/tab_deck_storage.cpp + src/tab_replays.cpp + src/tab_supervisor.cpp + src/tab_admin.cpp + src/tab_userlists.cpp + src/tab_deck_editor.cpp + src/replay_timeline_widget.cpp + src/deckstats_interface.cpp + src/chatview.cpp + src/userlist.cpp + src/userinfobox.cpp + src/user_context_menu.cpp + src/remotedecklist_treewidget.cpp + src/remotereplaylist_treewidget.cpp + src/deckview.cpp + src/playerlistwidget.cpp + src/pixmapgenerator.cpp + src/settingscache.cpp + src/localserver.cpp + src/localserverinterface.cpp + src/localclient.cpp + src/priceupdater.cpp + src/qt-json/json.cpp + src/soundengine.cpp + src/pending_command.cpp + ${CMAKE_CURRENT_BINARY_DIR}/version_string.cpp ) if (UNIX AND NOT APPLE) - set_source_files_properties(src/main.cpp PROPERTIES COMPILE_FLAGS -DTRANSLATION_PATH=\\"${CMAKE_INSTALL_PREFIX}/share/cockatrice/translations\\") + set_source_files_properties(src/main.cpp PROPERTIES COMPILE_FLAGS -DTRANSLATION_PATH=\\"${CMAKE_INSTALL_PREFIX}/share/cockatrice/translations\\") endif (UNIX AND NOT APPLE) set(cockatrice_RESOURCES cockatrice.qrc) set(cockatrice_TS -# translations/cockatrice_cs.ts - translations/cockatrice_de.ts - translations/cockatrice_en.ts - translations/cockatrice_es.ts -# translations/cockatrice_fr.ts - translations/cockatrice_it.ts - translations/cockatrice_ja.ts -# translations/cockatrice_pl.ts -# translations/cockatrice_pt-br.ts - translations/cockatrice_pt.ts -# translations/cockatrice_ru.ts -# translations/cockatrice_sk.ts - translations/cockatrice_sv.ts -# translations/cockatrice_zh_CN.ts +# translations/cockatrice_cs.ts + translations/cockatrice_de.ts + translations/cockatrice_en.ts + translations/cockatrice_es.ts +# translations/cockatrice_fr.ts + translations/cockatrice_it.ts + translations/cockatrice_ja.ts +# translations/cockatrice_pl.ts +# translations/cockatrice_pt-br.ts + translations/cockatrice_pt.ts +# translations/cockatrice_ru.ts +# translations/cockatrice_sk.ts + translations/cockatrice_sv.ts +# translations/cockatrice_zh_CN.ts ) if(WIN32) - set(cockatrice_SOURCES ${cockatrice_SOURCES} cockatrice.rc) + set(cockatrice_SOURCES ${cockatrice_SOURCES} cockatrice.rc) endif(WIN32) 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(cockatrice_SOURCES ${cockatrice_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/resources/appicon.icns) + set(MACOSX_BUNDLE_ICON_FILE appicon.icns) + set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/resources/appicon.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) + set(cockatrice_SOURCES ${cockatrice_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/resources/appicon.icns) ENDIF(APPLE) if (NOT QT_QTMULTIMEDIA_FOUND) - FIND_PACKAGE(QtMobility REQUIRED) + FIND_PACKAGE(QtMobility REQUIRED) endif (NOT QT_QTMULTIMEDIA_FOUND) SET(QT_USE_QTNETWORK TRUE) @@ -158,53 +158,53 @@ TARGET_LINK_LIBRARIES(cockatrice cockatrice_common ${QT_LIBRARIES} ${QT_MOBILITY if(UNIX) - if(APPLE) - INSTALL(TARGETS cockatrice BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}) - else() - # Assume linux - INSTALL(TARGETS cockatrice RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) - endif() + if(APPLE) + INSTALL(TARGETS cockatrice BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}) + else() + # Assume linux + INSTALL(TARGETS cockatrice RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) + endif() elseif(WIN32) - INSTALL(TARGETS cockatrice RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) + INSTALL(TARGETS cockatrice RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) endif() if (NOT WIN32 AND NOT APPLE) - 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}/cockatrice.desktop DESTINATION ${DESKTOPDIR}) - INSTALL(FILES ${cockatrice_QM} DESTINATION share/cockatrice/translations) + 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}/cockatrice.desktop DESTINATION ${DESKTOPDIR}) + INSTALL(FILES ${cockatrice_QM} DESTINATION share/cockatrice/translations) ENDIF(NOT WIN32 AND NOT APPLE) add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version_string.cpp ${CMAKE_CURRENT_BINARY_DIR}/version_string.h - COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/../common/getversion.cmake + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version_string.cpp ${CMAKE_CURRENT_BINARY_DIR}/version_string.h + COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/../common/getversion.cmake ) if(APPLE) - set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/cockatrice.app/Contents/Plugins) - set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/cockatrice.app/Contents/Resources) + set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/cockatrice.app/Contents/Plugins) + set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/cockatrice.app/Contents/Resources) - # note: no codecs in qt5 - # note: phonon_backend => mediaservice - # note: needs platform on osx + # note: no codecs in qt5 + # note: phonon_backend => mediaservice + # note: needs platform on osx - if (CMAKE_BUILD_TYPE STREQUAL "Debug") - install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime - FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*_debug\\.dylib") - else() - install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime - FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/[^_]*\\.dylib") - endif() + if (CMAKE_BUILD_TYPE STREQUAL "Debug") + install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime + FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*_debug\\.dylib") + else() + install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime + FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/[^_]*\\.dylib") + endif() - install(CODE " - file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] + install(CODE " + file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] Plugins = Plugins\") - " COMPONENT Runtime) + " COMPONENT Runtime) - install(CODE " - file(GLOB_RECURSE QTPLUGINS - \"${plugin_dest_dir}/*.dylib\") - include(BundleUtilities) - fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/cockatrice.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") - " COMPONENT Runtime) + install(CODE " + file(GLOB_RECURSE QTPLUGINS + \"${plugin_dest_dir}/*.dylib\") + include(BundleUtilities) + fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/cockatrice.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") + " COMPONENT Runtime) endif() diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index d7373115..3f0d8c6c 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -6,26 +6,26 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) add_subdirectory(pb) SET(common_SOURCES - decklist.cpp - get_pb_extension.cpp - rng_abstract.cpp - rng_sfmt.cpp - server.cpp - server_abstractuserinterface.cpp - server_arrow.cpp - server_arrowtarget.h - server_card.cpp - server_cardzone.cpp - server_counter.cpp - server_game.cpp - server_database_interface.cpp - server_player.cpp - server_protocolhandler.cpp - server_remoteuserinterface.cpp - server_response_containers.cpp - server_room.cpp - serverinfo_user_container.cpp - sfmt/SFMT.c + decklist.cpp + get_pb_extension.cpp + rng_abstract.cpp + rng_sfmt.cpp + server.cpp + server_abstractuserinterface.cpp + server_arrow.cpp + server_arrowtarget.h + server_card.cpp + server_cardzone.cpp + server_counter.cpp + server_game.cpp + server_database_interface.cpp + server_player.cpp + server_protocolhandler.cpp + server_remoteuserinterface.cpp + server_response_containers.cpp + server_room.cpp + serverinfo_user_container.cpp + sfmt/SFMT.c ) INCLUDE(${QT_USE_FILE}) diff --git a/common/pb/CMakeLists.txt b/common/pb/CMakeLists.txt index 455f161f..2930326d 100644 --- a/common/pb/CMakeLists.txt +++ b/common/pb/CMakeLists.txt @@ -5,147 +5,147 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) SET(PROTO_FILES - admin_commands.proto - card_attributes.proto - color.proto - command_attach_card.proto - command_change_zone_properties.proto - command_concede.proto - command_create_arrow.proto - command_create_counter.proto - command_create_token.proto - command_deck_del_dir.proto - command_deck_del.proto - command_deck_download.proto - command_deck_list.proto - command_deck_new_dir.proto - command_deck_select.proto - command_deck_upload.proto - command_del_counter.proto - command_delete_arrow.proto - command_draw_cards.proto - command_dump_zone.proto - command_flip_card.proto - command_game_say.proto - command_inc_card_counter.proto - command_inc_counter.proto - command_kick_from_game.proto - command_leave_game.proto - command_move_card.proto - command_mulligan.proto - command_next_turn.proto - command_ready_start.proto - command_replay_delete_match.proto - command_replay_list.proto - command_replay_download.proto - command_replay_modify_match.proto - command_reveal_cards.proto - command_roll_die.proto - command_set_active_phase.proto - command_set_card_attr.proto - command_set_card_counter.proto - command_set_counter.proto - command_set_sideboard_plan.proto - command_set_sideboard_lock.proto - command_shuffle.proto - commands.proto - command_stop_dump_zone.proto - command_undo_draw.proto - context_concede.proto - context_connection_state_changed.proto - context_deck_select.proto - context_move_card.proto - context_mulligan.proto - context_ping_changed.proto - context_ready_start.proto - context_set_sideboard_lock.proto - context_undo_draw.proto - event_add_to_list.proto - event_attach_card.proto - event_change_zone_properties.proto - event_connection_closed.proto - event_create_arrow.proto - event_create_counter.proto - event_create_token.proto - event_del_counter.proto - event_delete_arrow.proto - event_destroy_card.proto - event_draw_cards.proto - event_dump_zone.proto - event_flip_card.proto - event_game_closed.proto - event_game_host_changed.proto - event_game_joined.proto - event_game_say.proto - event_game_state_changed.proto - event_join.proto - event_join_room.proto - event_kicked.proto - event_leave.proto - event_leave_room.proto - event_list_games.proto - event_list_rooms.proto - event_move_card.proto - event_player_properties_changed.proto - event_remove_from_list.proto - event_replay_added.proto - event_reveal_cards.proto - event_roll_die.proto - event_room_say.proto - event_server_complete_list.proto - event_server_identification.proto - event_server_message.proto - event_server_shutdown.proto - event_set_active_phase.proto - event_set_active_player.proto - event_set_card_attr.proto - event_set_card_counter.proto - event_set_counter.proto - event_shuffle.proto - event_stop_dump_zone.proto - event_user_joined.proto - event_user_left.proto - event_user_message.proto - game_commands.proto - game_event_container.proto - game_event_context.proto - game_event.proto - game_replay.proto - isl_message.proto - moderator_commands.proto - move_card_to_zone.proto - response_deck_download.proto - response_deck_list.proto - response_deck_upload.proto - response_dump_zone.proto - response_get_games_of_user.proto - response_get_user_info.proto - response_join_room.proto - response_list_users.proto - response_login.proto - response_replay_download.proto - response_replay_list.proto - response.proto - room_commands.proto - room_event.proto - serverinfo_arrow.proto - serverinfo_cardcounter.proto - serverinfo_card.proto - serverinfo_counter.proto - serverinfo_deckstorage.proto - serverinfo_game.proto - serverinfo_gametype.proto - serverinfo_playerping.proto - serverinfo_playerproperties.proto - serverinfo_player.proto - serverinfo_replay.proto - serverinfo_replay_match.proto - serverinfo_room.proto - serverinfo_user.proto - serverinfo_zone.proto - server_message.proto - session_commands.proto - session_event.proto + admin_commands.proto + card_attributes.proto + color.proto + command_attach_card.proto + command_change_zone_properties.proto + command_concede.proto + command_create_arrow.proto + command_create_counter.proto + command_create_token.proto + command_deck_del_dir.proto + command_deck_del.proto + command_deck_download.proto + command_deck_list.proto + command_deck_new_dir.proto + command_deck_select.proto + command_deck_upload.proto + command_del_counter.proto + command_delete_arrow.proto + command_draw_cards.proto + command_dump_zone.proto + command_flip_card.proto + command_game_say.proto + command_inc_card_counter.proto + command_inc_counter.proto + command_kick_from_game.proto + command_leave_game.proto + command_move_card.proto + command_mulligan.proto + command_next_turn.proto + command_ready_start.proto + command_replay_delete_match.proto + command_replay_list.proto + command_replay_download.proto + command_replay_modify_match.proto + command_reveal_cards.proto + command_roll_die.proto + command_set_active_phase.proto + command_set_card_attr.proto + command_set_card_counter.proto + command_set_counter.proto + command_set_sideboard_plan.proto + command_set_sideboard_lock.proto + command_shuffle.proto + commands.proto + command_stop_dump_zone.proto + command_undo_draw.proto + context_concede.proto + context_connection_state_changed.proto + context_deck_select.proto + context_move_card.proto + context_mulligan.proto + context_ping_changed.proto + context_ready_start.proto + context_set_sideboard_lock.proto + context_undo_draw.proto + event_add_to_list.proto + event_attach_card.proto + event_change_zone_properties.proto + event_connection_closed.proto + event_create_arrow.proto + event_create_counter.proto + event_create_token.proto + event_del_counter.proto + event_delete_arrow.proto + event_destroy_card.proto + event_draw_cards.proto + event_dump_zone.proto + event_flip_card.proto + event_game_closed.proto + event_game_host_changed.proto + event_game_joined.proto + event_game_say.proto + event_game_state_changed.proto + event_join.proto + event_join_room.proto + event_kicked.proto + event_leave.proto + event_leave_room.proto + event_list_games.proto + event_list_rooms.proto + event_move_card.proto + event_player_properties_changed.proto + event_remove_from_list.proto + event_replay_added.proto + event_reveal_cards.proto + event_roll_die.proto + event_room_say.proto + event_server_complete_list.proto + event_server_identification.proto + event_server_message.proto + event_server_shutdown.proto + event_set_active_phase.proto + event_set_active_player.proto + event_set_card_attr.proto + event_set_card_counter.proto + event_set_counter.proto + event_shuffle.proto + event_stop_dump_zone.proto + event_user_joined.proto + event_user_left.proto + event_user_message.proto + game_commands.proto + game_event_container.proto + game_event_context.proto + game_event.proto + game_replay.proto + isl_message.proto + moderator_commands.proto + move_card_to_zone.proto + response_deck_download.proto + response_deck_list.proto + response_deck_upload.proto + response_dump_zone.proto + response_get_games_of_user.proto + response_get_user_info.proto + response_join_room.proto + response_list_users.proto + response_login.proto + response_replay_download.proto + response_replay_list.proto + response.proto + room_commands.proto + room_event.proto + serverinfo_arrow.proto + serverinfo_cardcounter.proto + serverinfo_card.proto + serverinfo_counter.proto + serverinfo_deckstorage.proto + serverinfo_game.proto + serverinfo_gametype.proto + serverinfo_playerping.proto + serverinfo_playerproperties.proto + serverinfo_player.proto + serverinfo_replay.proto + serverinfo_replay_match.proto + serverinfo_room.proto + serverinfo_user.proto + serverinfo_zone.proto + server_message.proto + session_commands.proto + session_event.proto ) include_directories(${PROTOBUF_INCLUDE_DIRS}) @@ -155,6 +155,6 @@ PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${PROTO_FILES}) add_library(cockatrice_protocol ${PROTO_SRCS} ${PROTO_HDRS}) set(cockatrice_protocol_LIBS ${PROTOBUF_LIBRARIES}) if (MSVC) - set(cockatrice_protocol_LIBS ${cockatrice_protocol_LIBS} -lprotobuf) + set(cockatrice_protocol_LIBS ${cockatrice_protocol_LIBS} -lprotobuf) endif (MSVC) target_link_libraries(cockatrice_protocol ${cockatrice_protocol_LIBS}) diff --git a/oracle/CMakeLists.txt b/oracle/CMakeLists.txt index 336e6e3c..ad9c16ee 100644 --- a/oracle/CMakeLists.txt +++ b/oracle/CMakeLists.txt @@ -8,11 +8,11 @@ PROJECT(oracle) set(DESKTOPDIR share/applications CACHE STRING "path to .desktop files") SET(oracle_SOURCES - src/main.cpp - src/oracleimporter.cpp - src/window_main.cpp - ../cockatrice/src/carddatabase.cpp - ../cockatrice/src/settingscache.cpp + src/main.cpp + src/oracleimporter.cpp + src/window_main.cpp + ../cockatrice/src/carddatabase.cpp + ../cockatrice/src/settingscache.cpp ) SET(QT_USE_QTNETWORK TRUE) @@ -28,45 +28,45 @@ ADD_EXECUTABLE(oracle WIN32 MACOSX_BUNDLE ${oracle_SOURCES} ${oracle_MOC_SRCS}) TARGET_LINK_LIBRARIES(oracle ${QT_LIBRARIES}) if(UNIX) - if(APPLE) - INSTALL(TARGETS oracle BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}) - else() - # Assume linux - INSTALL(TARGETS oracle RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) - endif() + if(APPLE) + INSTALL(TARGETS oracle BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}) + else() + # Assume linux + INSTALL(TARGETS oracle RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) + endif() elseif(WIN32) - INSTALL(TARGETS oracle RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) + INSTALL(TARGETS oracle RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) endif() 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) -if(APPLE) - set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Plugins) - set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Resources) +#if(APPLE) +# set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Plugins) +# set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Resources) - # note: no codecs in qt5 - # note: phonon_backend => mediaservice - # note: needs platform on osx + # note: no codecs in qt5 + # note: phonon_backend => mediaservice + # note: needs platform on osx - if (CMAKE_BUILD_TYPE STREQUAL "Debug") - install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime - FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*_debug\\.dylib") - else() - install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime - FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/[^_]*\\.dylib") - endif() +# if (CMAKE_BUILD_TYPE STREQUAL "Debug") +# install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime +# FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*_debug\\.dylib") +# else() +# install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime +# FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/[^_]*\\.dylib") +# endif() - install(CODE " - file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] -Plugins = Plugins\") - " COMPONENT Runtime) +# install(CODE " +# file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] +#Plugins = Plugins\") +# " COMPONENT Runtime) - install(CODE " - file(GLOB_RECURSE QTPLUGINS - \"${plugin_dest_dir}/*.dylib\") - include(BundleUtilities) - fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/oracle.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") - " COMPONENT Runtime) -endif() +# install(CODE " +# file(GLOB_RECURSE QTPLUGINS +# \"${plugin_dest_dir}/*.dylib\") +# include(BundleUtilities) +# fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/oracle.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") +# " COMPONENT Runtime) +#endif() diff --git a/servatrice/CMakeLists.txt b/servatrice/CMakeLists.txt index 41c42952..95f24e33 100644 --- a/servatrice/CMakeLists.txt +++ b/servatrice/CMakeLists.txt @@ -9,15 +9,15 @@ SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) FIND_PACKAGE(Libgcrypt REQUIRED) SET(servatrice_SOURCES - src/main.cpp - src/passwordhasher.cpp - src/servatrice.cpp - src/servatrice_connection_pool.cpp - src/servatrice_database_interface.cpp - src/server_logger.cpp - src/serversocketinterface.cpp - src/isl_interface.cpp - ${CMAKE_CURRENT_BINARY_DIR}/version_string.cpp + src/main.cpp + src/passwordhasher.cpp + src/servatrice.cpp + src/servatrice_connection_pool.cpp + src/servatrice_database_interface.cpp + src/server_logger.cpp + src/serversocketinterface.cpp + src/isl_interface.cpp + ${CMAKE_CURRENT_BINARY_DIR}/version_string.cpp ) SET(QT_DONTUSE_QTGUI) @@ -38,47 +38,76 @@ TARGET_LINK_LIBRARIES(servatrice cockatrice_common ${QT_LIBRARIES} ${LIBGCRYPT_L #add_custom_target(versionheader ALL DEPENDS version_header) add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version_string.h ${CMAKE_CURRENT_BINARY_DIR}/version_string.cpp - COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/../common/getversion.cmake + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version_string.h ${CMAKE_CURRENT_BINARY_DIR}/version_string.cpp + COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/../common/getversion.cmake ) # install rules if(UNIX) - if(APPLE) - INSTALL(TARGETS servatrice BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}) - else() - # Assume linux - INSTALL(TARGETS servatrice RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) - endif() + if(APPLE) + INSTALL(TARGETS servatrice BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}) + else() + # Assume linux + INSTALL(TARGETS servatrice RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) + endif() elseif(WIN32) - INSTALL(TARGETS servatrice RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) + INSTALL(TARGETS servatrice RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) endif() if(APPLE) - set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/servatrice.app/Contents/Plugins) - set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/servatrice.app/Contents/Resources) + set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/servatrice.app/Contents/Plugins) + set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/servatrice.app/Contents/Resources) - # note: no codecs in qt5 - # note: phonon_backend => mediaservice - # note: needs platform on osx + # note: no codecs in qt5 + # note: phonon_backend => mediaservice + # note: needs platform on osx - if (CMAKE_BUILD_TYPE STREQUAL "Debug") - install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime - FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*_debug\\.dylib") - else() - install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime - FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/[^_]*\\.dylib") - endif() + if (CMAKE_BUILD_TYPE STREQUAL "Debug") + install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime + FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*_debug\\.dylib") + else() + install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime + FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/[^_]*\\.dylib") + endif() - install(CODE " - file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] + install(CODE " + file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] Plugins = Plugins\") - " COMPONENT Runtime) + " COMPONENT Runtime) - install(CODE " - file(GLOB_RECURSE QTPLUGINS + install(CODE " + file(GLOB_RECURSE QTPLUGINS \"${plugin_dest_dir}/*.dylib\") - include(BundleUtilities) - fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/servatrice.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") - " COMPONENT Runtime) + include(BundleUtilities) + fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/servatrice.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") + " COMPONENT Runtime) endif() + +if(APPLE) + set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Plugins) + set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Resources) + + # note: no codecs in qt5 + # note: phonon_backend => mediaservice + # note: needs platform on osx + + if (CMAKE_BUILD_TYPE STREQUAL "Debug") + install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime + FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*_debug\\.dylib") + else() + install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime + FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/[^_]*\\.dylib") + endif() + + install(CODE " + file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] +Plugins = Plugins\") + " COMPONENT Runtime) + + install(CODE " + file(GLOB_RECURSE QTPLUGINS + \"${plugin_dest_dir}/*.dylib\") + include(BundleUtilities) + fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/oracle.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") + " COMPONENT Runtime) +endif() \ No newline at end of file From 84fe5f464c45343c7cf5224f53f18e1a7edfd01a Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Wed, 11 Jun 2014 18:20:34 +0200 Subject: [PATCH 15/22] Removed unnecessary comments in previous commit --- oracle/CMakeLists.txt | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/oracle/CMakeLists.txt b/oracle/CMakeLists.txt index ad9c16ee..6ed1f327 100644 --- a/oracle/CMakeLists.txt +++ b/oracle/CMakeLists.txt @@ -42,31 +42,31 @@ IF (NOT WIN32 AND NOT APPLE) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/oracle.desktop DESTINATION ${DESKTOPDIR}) ENDIF (NOT WIN32 AND NOT APPLE) -#if(APPLE) -# set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Plugins) -# set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Resources) +if(APPLE) + set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Plugins) + set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Resources) # note: no codecs in qt5 # note: phonon_backend => mediaservice # note: needs platform on osx -# if (CMAKE_BUILD_TYPE STREQUAL "Debug") -# install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime -# FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*_debug\\.dylib") -# else() -# install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime -# FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/[^_]*\\.dylib") -# endif() + if (CMAKE_BUILD_TYPE STREQUAL "Debug") + install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime + FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*_debug\\.dylib") + else() + install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime + FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/[^_]*\\.dylib") + endif() -# install(CODE " -# file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] -#Plugins = Plugins\") -# " COMPONENT Runtime) + install(CODE " + file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] +Plugins = Plugins\") + " COMPONENT Runtime) -# install(CODE " -# file(GLOB_RECURSE QTPLUGINS -# \"${plugin_dest_dir}/*.dylib\") -# include(BundleUtilities) -# fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/oracle.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") -# " COMPONENT Runtime) -#endif() + install(CODE " + file(GLOB_RECURSE QTPLUGINS + \"${plugin_dest_dir}/*.dylib\") + include(BundleUtilities) + fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/oracle.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") + " COMPONENT Runtime) +endif() From dfdfe602024d11735de821eb6d78becfdabc644b Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Wed, 11 Jun 2014 18:20:48 +0200 Subject: [PATCH 16/22] Properly install sounds and zonebg files --- sounds/CMakeLists.txt | 14 ++++++++++++-- zonebg/CMakeLists.txt | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/sounds/CMakeLists.txt b/sounds/CMakeLists.txt index 6dd10f87..14b83b60 100644 --- a/sounds/CMakeLists.txt +++ b/sounds/CMakeLists.txt @@ -2,5 +2,15 @@ # # Installs default sound files -FILE(GLOB sounds "${CMAKE_CURRENT_SOURCE_DIR}/sounds/*.raw") -INSTALL(FILES ${sounds} DESTINATION share/cockatrice/sounds) +FILE(GLOB sounds "${CMAKE_CURRENT_SOURCE_DIR}/*.raw") + +if(UNIX) + if(APPLE) + INSTALL(FILES ${sounds} DESTINATION ${CMAKE_INSTALL_PREFIX}/sounds) + else() + # Assume linux + INSTALL(FILES ${sounds} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cockatrice/sounds) + endif() +elseif(WIN32) + INSTALL(FILES ${sounds} DESTINATION ${CMAKE_INSTALL_PREFIX}/sounds) +endif() \ No newline at end of file diff --git a/zonebg/CMakeLists.txt b/zonebg/CMakeLists.txt index 76c7c356..4478238f 100644 --- a/zonebg/CMakeLists.txt +++ b/zonebg/CMakeLists.txt @@ -2,5 +2,15 @@ # # Installs default "zone background" files -FILE(GLOB zonebg "${CMAKE_CURRENT_SOURCE_DIR}/zonebg/*.*") -INSTALL(FILES ${zonebg} DESTINATION share/cockatrice/zonebg) +FILE(GLOB zonebg "${CMAKE_CURRENT_SOURCE_DIR}/*.*") + +if(UNIX) + if(APPLE) + INSTALL(FILES ${zonebg} DESTINATION ${CMAKE_INSTALL_PREFIX}/zonebg) + else() + # Assume linux + INSTALL(FILES ${zonebg} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cockatrice/zonebg) + endif() +elseif(WIN32) + INSTALL(FILES ${zonebg} DESTINATION ${CMAKE_INSTALL_PREFIX}/zonebg) +endif() \ No newline at end of file From eca318c34d0f166f28f69eaa227f779675c51810 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 12 Jun 2014 23:29:42 +0200 Subject: [PATCH 17/22] Make install paths relative to prepare for CPack --- cockatrice/CMakeLists.txt | 12 ++++++------ oracle/CMakeLists.txt | 12 ++++++------ servatrice/CMakeLists.txt | 41 ++++++--------------------------------- sounds/CMakeLists.txt | 6 +++--- zonebg/CMakeLists.txt | 6 +++--- 5 files changed, 24 insertions(+), 53 deletions(-) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index 38497e53..38df523e 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -159,13 +159,13 @@ TARGET_LINK_LIBRARIES(cockatrice cockatrice_common ${QT_LIBRARIES} ${QT_MOBILITY if(UNIX) if(APPLE) - INSTALL(TARGETS cockatrice BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}) + INSTALL(TARGETS cockatrice BUNDLE DESTINATION ./) else() # Assume linux - INSTALL(TARGETS cockatrice RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) + INSTALL(TARGETS cockatrice RUNTIME DESTINATION bin/) endif() elseif(WIN32) - INSTALL(TARGETS cockatrice RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) + INSTALL(TARGETS cockatrice RUNTIME DESTINATION ./) endif() if (NOT WIN32 AND NOT APPLE) @@ -181,8 +181,8 @@ add_custom_command( ) if(APPLE) - set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/cockatrice.app/Contents/Plugins) - set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/cockatrice.app/Contents/Resources) + set(plugin_dest_dir ./cockatrice.app/Contents/Plugins) + set(qtconf_dest_dir ./cockatrice.app/Contents/Resources) # note: no codecs in qt5 # note: phonon_backend => mediaservice @@ -205,6 +205,6 @@ Plugins = Plugins\") file(GLOB_RECURSE QTPLUGINS \"${plugin_dest_dir}/*.dylib\") include(BundleUtilities) - fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/cockatrice.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") + fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/cockatrice.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") " COMPONENT Runtime) endif() diff --git a/oracle/CMakeLists.txt b/oracle/CMakeLists.txt index 6ed1f327..340ce16a 100644 --- a/oracle/CMakeLists.txt +++ b/oracle/CMakeLists.txt @@ -29,13 +29,13 @@ TARGET_LINK_LIBRARIES(oracle ${QT_LIBRARIES}) if(UNIX) if(APPLE) - INSTALL(TARGETS oracle BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}) + INSTALL(TARGETS oracle BUNDLE DESTINATION ./) else() # Assume linux - INSTALL(TARGETS oracle RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) + INSTALL(TARGETS oracle RUNTIME DESTINATION bin/) endif() elseif(WIN32) - INSTALL(TARGETS oracle RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) + INSTALL(TARGETS oracle RUNTIME DESTINATION ./) endif() IF (NOT WIN32 AND NOT APPLE) @@ -43,8 +43,8 @@ IF (NOT WIN32 AND NOT APPLE) ENDIF (NOT WIN32 AND NOT APPLE) if(APPLE) - set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Plugins) - set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Resources) + set(plugin_dest_dir ./oracle.app/Contents/Plugins) + set(qtconf_dest_dir ./oracle.app/Contents/Resources) # note: no codecs in qt5 # note: phonon_backend => mediaservice @@ -67,6 +67,6 @@ Plugins = Plugins\") file(GLOB_RECURSE QTPLUGINS \"${plugin_dest_dir}/*.dylib\") include(BundleUtilities) - fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/oracle.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") + fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/oracle.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") " COMPONENT Runtime) endif() diff --git a/servatrice/CMakeLists.txt b/servatrice/CMakeLists.txt index 95f24e33..799cecbd 100644 --- a/servatrice/CMakeLists.txt +++ b/servatrice/CMakeLists.txt @@ -45,18 +45,18 @@ add_custom_command( # install rules if(UNIX) if(APPLE) - INSTALL(TARGETS servatrice BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}) + INSTALL(TARGETS servatrice BUNDLE DESTINATION ./) else() # Assume linux - INSTALL(TARGETS servatrice RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) + INSTALL(TARGETS servatrice RUNTIME DESTINATION bin/) endif() elseif(WIN32) - INSTALL(TARGETS servatrice RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) + INSTALL(TARGETS servatrice RUNTIME DESTINATION ./) endif() if(APPLE) - set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/servatrice.app/Contents/Plugins) - set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/servatrice.app/Contents/Resources) + set(plugin_dest_dir ./servatrice.app/Contents/Plugins) + set(qtconf_dest_dir ./servatrice.app/Contents/Resources) # note: no codecs in qt5 # note: phonon_backend => mediaservice @@ -79,35 +79,6 @@ Plugins = Plugins\") file(GLOB_RECURSE QTPLUGINS \"${plugin_dest_dir}/*.dylib\") include(BundleUtilities) - fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/servatrice.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") + fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/servatrice.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") " COMPONENT Runtime) endif() - -if(APPLE) - set(plugin_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Plugins) - set(qtconf_dest_dir ${CMAKE_INSTALL_PREFIX}/oracle.app/Contents/Resources) - - # note: no codecs in qt5 - # note: phonon_backend => mediaservice - # note: needs platform on osx - - if (CMAKE_BUILD_TYPE STREQUAL "Debug") - install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime - FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/.*_debug\\.dylib") - else() - install(DIRECTORY "${QT_PLUGINS_DIR}/" DESTINATION ${plugin_dest_dir} COMPONENT Runtime - FILES_MATCHING REGEX "(codecs|iconengines|imageformats|mediaservice|phonon_backend|platforms)/[^_]*\\.dylib") - endif() - - install(CODE " - file(WRITE \"${qtconf_dest_dir}/qt.conf\" \"[Paths] -Plugins = Plugins\") - " COMPONENT Runtime) - - install(CODE " - file(GLOB_RECURSE QTPLUGINS - \"${plugin_dest_dir}/*.dylib\") - include(BundleUtilities) - fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/oracle.app\" \"\${QTPLUGINS}\" \"${QT_LIBRARY_DIR}\") - " COMPONENT Runtime) -endif() \ No newline at end of file diff --git a/sounds/CMakeLists.txt b/sounds/CMakeLists.txt index 14b83b60..e38c9090 100644 --- a/sounds/CMakeLists.txt +++ b/sounds/CMakeLists.txt @@ -6,11 +6,11 @@ FILE(GLOB sounds "${CMAKE_CURRENT_SOURCE_DIR}/*.raw") if(UNIX) if(APPLE) - INSTALL(FILES ${sounds} DESTINATION ${CMAKE_INSTALL_PREFIX}/sounds) + INSTALL(FILES ${sounds} DESTINATION sounds/) else() # Assume linux - INSTALL(FILES ${sounds} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cockatrice/sounds) + INSTALL(FILES ${sounds} DESTINATION share/cockatrice/sounds/) endif() elseif(WIN32) - INSTALL(FILES ${sounds} DESTINATION ${CMAKE_INSTALL_PREFIX}/sounds) + INSTALL(FILES ${sounds} DESTINATION sounds/) endif() \ No newline at end of file diff --git a/zonebg/CMakeLists.txt b/zonebg/CMakeLists.txt index 4478238f..961c4e12 100644 --- a/zonebg/CMakeLists.txt +++ b/zonebg/CMakeLists.txt @@ -6,11 +6,11 @@ FILE(GLOB zonebg "${CMAKE_CURRENT_SOURCE_DIR}/*.*") if(UNIX) if(APPLE) - INSTALL(FILES ${zonebg} DESTINATION ${CMAKE_INSTALL_PREFIX}/zonebg) + INSTALL(FILES ${zonebg} DESTINATION zonebg/) else() # Assume linux - INSTALL(FILES ${zonebg} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cockatrice/zonebg) + INSTALL(FILES ${zonebg} DESTINATION share/cockatrice/zonebg/) endif() elseif(WIN32) - INSTALL(FILES ${zonebg} DESTINATION ${CMAKE_INSTALL_PREFIX}/zonebg) + INSTALL(FILES ${zonebg} DESTINATION zonebg/) endif() \ No newline at end of file From ddec7e65612524154ae511caca11182f01e02b3b Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 12 Jun 2014 23:31:30 +0200 Subject: [PATCH 18/22] Create CMake options for components --- CMakeLists.txt | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c746074a..1cfff669 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,20 +60,28 @@ set(CMAKE_AUTOMOC TRUE) FIND_PACKAGE(Protobuf REQUIRED) # Compile servatrice (default off) +option(WITH_SERVER "build servatrice" OFF) add_subdirectory(common) if(WITH_SERVER) add_subdirectory(servatrice) -endif(WITH_SERVER) +endif() -# Compile cockatrice+oracle (default on) -if (NOT WITHOUT_CLIENT) +# Compile cockatrice (default on) +option(WITH_CLIENT "build cockatrice" ON) +if(WITH_CLIENT) add_subdirectory(cockatrice) - add_subdirectory(oracle) add_subdirectory(sounds) add_subdirectory(zonebg) -endif(NOT WITHOUT_CLIENT) +endif() + +# Compile oracle (default on) +option(WITH_ORACLE "build oracle" ON) +if(WITH_ORACLE) + add_subdirectory(oracle) +endif() # Compile testclient (default off) +option(WITH_TESTCLIENT "build testclient" OFF) if (WITH_TESTCLIENT) add_subdirectory(testclient) -endif(WITH_TESTCLIENT) +endif() \ No newline at end of file From 660ff349abf031617e1028362d1e7e913d1848ef Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 12 Jun 2014 23:32:12 +0200 Subject: [PATCH 19/22] Add a proper, top-level project name --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1cfff669..8c3219cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,15 @@ cmake_minimum_required(VERSION 2.6) +set(PROJECT_NAME "Cockatrice") +set(PROJECT_VERSION_MAJOR 0) +set(PROJECT_VERSION_MINOR 0) +set(PROJECT_VERSION_PATCH 1) +set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} ) + +# A project name is needed for CPack +PROJECT("${PROJECT_NAME}") + # Set conventional loops set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) From dd768ba7bdee5162bc7fce0c3da1f892e97a1ef2 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Thu, 12 Jun 2014 23:42:20 +0200 Subject: [PATCH 20/22] OSX: Move translations inside app bundle Additional: remove duplicate if(linux) and merge rules together --- cockatrice/CMakeLists.txt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index 38df523e..1d915bdb 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -160,21 +160,20 @@ TARGET_LINK_LIBRARIES(cockatrice cockatrice_common ${QT_LIBRARIES} ${QT_MOBILITY if(UNIX) if(APPLE) INSTALL(TARGETS cockatrice BUNDLE DESTINATION ./) + INSTALL(FILES ${cockatrice_QM} DESTINATION ./cockatrice.app/Contents/Resources/translations) else() # Assume linux 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.svg DESTINATION ${ICONDIR}/hicolor/scalable/apps) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cockatrice.desktop DESTINATION ${DESKTOPDIR}) + INSTALL(FILES ${cockatrice_QM} DESTINATION share/cockatrice/translations) endif() elseif(WIN32) INSTALL(TARGETS cockatrice RUNTIME DESTINATION ./) + INSTALL(FILES ${cockatrice_QM} DESTINATION ./translations) endif() -if (NOT WIN32 AND NOT APPLE) - 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}/cockatrice.desktop DESTINATION ${DESKTOPDIR}) - INSTALL(FILES ${cockatrice_QM} DESTINATION share/cockatrice/translations) -ENDIF(NOT WIN32 AND NOT APPLE) - add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version_string.cpp ${CMAKE_CURRENT_BINARY_DIR}/version_string.h COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/../common/getversion.cmake From a4fbf8b67737b46b10c2fe0e30d12bbb0c3bb8fc Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Fri, 13 Jun 2014 19:09:33 +0200 Subject: [PATCH 21/22] Force linking with pthread under unix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Protobuf depends on pthread under unix, but cmake’s FindProtobuf doesn’t add -lpthread to link flags --- common/pb/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/pb/CMakeLists.txt b/common/pb/CMakeLists.txt index 2930326d..7b005157 100644 --- a/common/pb/CMakeLists.txt +++ b/common/pb/CMakeLists.txt @@ -157,4 +157,7 @@ set(cockatrice_protocol_LIBS ${PROTOBUF_LIBRARIES}) if (MSVC) set(cockatrice_protocol_LIBS ${cockatrice_protocol_LIBS} -lprotobuf) endif (MSVC) +if (UNIX) + set(cockatrice_protocol_LIBS ${cockatrice_protocol_LIBS} -lpthread) +endif (UNIX) target_link_libraries(cockatrice_protocol ${cockatrice_protocol_LIBS}) From a35b62509abb12573bc977ff02884711cbdcdc82 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sat, 14 Jun 2014 10:35:18 +0200 Subject: [PATCH 22/22] Handle correctly user-defined CMAKE_BUILD_TYPE --- CMakeLists.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c3219cc..6c1063ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,14 @@ set(PROJECT_VERSION_MINOR 0) set(PROJECT_VERSION_PATCH 1) set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} ) +# Defualt to "Release" build type +# User-provided value for CMAKE_BUILD_TYPE must be checked before the PROJECT() call +IF(DEFINED CMAKE_BUILD_TYPE) + SET(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Type of build") +ELSE() + SET(CMAKE_BUILD_TYPE Release CACHE STRING "Type of build") +ENDIF() + # A project name is needed for CPack PROJECT("${PROJECT_NAME}") @@ -41,9 +49,6 @@ elseif(WIN32) set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/release) endif() -# Force "Release" build type by default -set(CMAKE_BUILD_TYPE Release) - # Define proper compilation flags IF (CMAKE_COMPILER_IS_GNUCC) # linux/gcc, bsd/gcc, windows/mingw