Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
65f59747
Commit
65f59747
authored
Jun 24, 2014
by
Gavin Bisesi
Browse files
Merge pull request #116 from ctrlaltca/feature-cpack
Use cpack to create osx's dmg
parents
e5d9692d
36e4b84b
Changes
10
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
65f59747
...
...
@@ -79,11 +79,51 @@ set(CMAKE_AUTOMOC TRUE)
# Find other needed libraries
FIND_PACKAGE
(
Protobuf REQUIRED
)
# Package builder
set
(
CPACK_PACKAGE_CONTACT
"Daenyth+github@gmail.com"
)
set
(
CPACK_PACKAGE_DESCRIPTION_SUMMARY
${
PROJECT_NAME
}
)
set
(
CPACK_PACKAGE_VENDOR
"Cockatrice Development Team"
)
set
(
CPACK_PACKAGE_DESCRIPTION_FILE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/README.md"
)
set
(
CPACK_RESOURCE_FILE_LICENSE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/COPYING"
)
set
(
CPACK_PACKAGE_VERSION_MAJOR
"
${
PROJECT_VERSION_MAJOR
}
"
)
set
(
CPACK_PACKAGE_VERSION_MINOR
"
${
PROJECT_VERSION_MINOR
}
"
)
set
(
CPACK_PACKAGE_VERSION_PATCH
"
${
PROJECT_VERSION_PATCH
}
"
)
if
(
UNIX
)
if
(
APPLE
)
set
(
CPACK_GENERATOR DragNDrop
${
CPACK_GENERATOR
}
)
set
(
CPACK_GENERATOR
"DragNDrop"
)
set
(
CPACK_DMG_FORMAT
"UDBZ"
)
set
(
CPACK_DMG_VOLUME_NAME
"
${
PROJECT_NAME
}
"
)
set
(
CPACK_SYSTEM_NAME
"OSX"
)
set
(
CPACK_PACKAGE_FILE_NAME
"
${
PROJECT_NAME
}
-
${
PROJECT_VERSION
}
"
)
set
(
CPACK_PACKAGE_ICON
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cockatrice/resources/appicon.icns"
)
else
()
# linux
set
(
CPACK_GENERATOR DEB
${
CPACK_GENERATOR
}
)
set
(
CPACK_PACKAGE_INSTALL_DIRECTORY
"
${
PROJECT_NAME
}
/
${
PROJECT_VERSION
}
"
)
set
(
CPACK_STRIP_FILES
"bin/
${
PROJECT_NAME
}
"
)
set
(
CPACK_SOURCE_STRIP_FILES
""
)
endif
()
elseif
(
WIN32
)
set
(
CPACK_GENERATOR NSIS
${
CPACK_GENERATOR
}
)
set
(
CPACK_PACKAGE_INSTALL_DIRECTORY
"
${
PROJECT_NAME
}
\\\\
${
PROJECT_VERSION
}
"
)
set
(
CPACK_NSIS_INSTALLED_ICON_NAME
"bin
\\\\
${
PROJECT_NAME
}
.exe"
)
set
(
CPACK_NSIS_DISPLAY_NAME
"
${
CPACK_PACKAGE_INSTALL_DIRECTORY
}
${
PROJECT_NAME
}
"
)
set
(
CPACK_NSIS_HELP_LINK
"https://github.com/Daenyth/Cockatrice"
)
set
(
CPACK_NSIS_URL_INFO_ABOUT
"https://github.com/Daenyth/Cockatrice"
)
set
(
CPACK_NSIS_CONTACT
"Daenyth+github@gmail.com"
)
set
(
CPACK_NSIS_MODIFY_PATH ON
)
endif
()
include
(
CPack
)
# Compile servatrice (default off)
option
(
WITH_SERVER
"build servatrice"
OFF
)
add_subdirectory
(
common
)
if
(
WITH_SERVER
)
add_subdirectory
(
servatrice
)
SET
(
CPACK_INSTALL_CMAKE_PROJECTS
"servatrice;servatrice;ALL;/"
${
CPACK_INSTALL_CMAKE_PROJECTS
}
)
endif
()
# Compile cockatrice (default on)
...
...
@@ -92,10 +132,12 @@ if(WITH_CLIENT)
add_subdirectory
(
cockatrice
)
add_subdirectory
(
sounds
)
add_subdirectory
(
zonebg
)
SET
(
CPACK_INSTALL_CMAKE_PROJECTS
"cockatrice;cockatrice;ALL;/"
${
CPACK_INSTALL_CMAKE_PROJECTS
}
)
endif
()
# Compile oracle (default on)
option
(
WITH_ORACLE
"build oracle"
ON
)
if
(
WITH_ORACLE
)
add_subdirectory
(
oracle
)
SET
(
CPACK_INSTALL_CMAKE_PROJECTS
"release/oracle.app;oracle;ALL;/"
${
CPACK_INSTALL_CMAKE_PROJECTS
}
)
endif
()
cockatrice/CMakeLists.txt
View file @
65f59747
...
...
@@ -183,8 +183,9 @@ add_custom_command(
)
if
(
APPLE
)
set
(
plugin_dest_dir ./cockatrice.app/Contents/Plugins
)
set
(
qtconf_dest_dir ./cockatrice.app/Contents/Resources
)
# these needs to be relative to CMAKE_INSTALL_PREFIX
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
...
...
@@ -199,13 +200,16 @@ if(APPLE)
endif
()
install
(
CODE
"
file(WRITE
\"
${
qtconf_dest_dir
}
/qt.conf
\"
\"
[Paths]
Plugins = Plugins
\"
)
"
COMPONENT Runtime
)
file(WRITE
\"\$
{CMAKE_INSTALL_PREFIX}/
${
qtconf_dest_dir
}
/qt.conf
\"
\"
[Paths]
Plugins = Plugins
Translations = Resources/translations
Data = Resources
\"
)
"
COMPONENT Runtime
)
install
(
CODE
"
file(GLOB_RECURSE QTPLUGINS
\"
${
plugin_dest_dir
}
/*.dylib
\"
)
\"\$
{CMAKE_INSTALL_PREFIX}/
${
plugin_dest_dir
}
/*.dylib
\"
)
set(BU_CHMOD_BUNDLE_ITEMS ON)
include(BundleUtilities)
fixup_bundle(
\"\$
{CMAKE_INSTALL_PREFIX}/cockatrice.app
\"
\"\$
{QTPLUGINS}
\"
\"
${
QT_LIBRARY_DIR
}
\"
)
"
COMPONENT Runtime
)
...
...
cockatrice/src/main.cpp
View file @
65f59747
...
...
@@ -88,15 +88,6 @@ int main(int argc, char *argv[])
if
(
app
.
arguments
().
contains
(
"--debug-output"
))
qInstallMsgHandler
(
myMessageOutput
);
#ifdef Q_OS_MAC
QDir
baseDir
(
app
.
applicationDirPath
());
baseDir
.
cdUp
();
baseDir
.
cdUp
();
baseDir
.
cdUp
();
QDir
pluginsDir
=
baseDir
;
pluginsDir
.
cd
(
"PlugIns"
);
app
.
addLibraryPath
(
pluginsDir
.
absolutePath
());
#endif
#ifdef Q_OS_WIN
app
.
addLibraryPath
(
app
.
applicationDirPath
()
+
"/plugins"
);
#endif
...
...
@@ -108,11 +99,8 @@ int main(int argc, char *argv[])
if
(
translationPath
.
isEmpty
())
{
#ifdef Q_OS_MAC
QDir
translationsDir
=
baseDir
;
translationsDir
.
cd
(
"translations"
);
translationPath
=
translationsDir
.
absolutePath
();
#endif
#ifdef Q_OS_WIN
translationPath
=
QLibraryInfo
::
location
(
QLibraryInfo
::
TranslationsPath
);
#elif Q_OS_WIN
translationPath
=
app
.
applicationDirPath
()
+
"/translations"
;
#endif
}
...
...
@@ -145,6 +133,43 @@ int main(int argc, char *argv[])
QDir
().
mkpath
(
dataDir
+
"/pics"
);
settingsCache
->
setPicsPath
(
dataDir
+
"/pics"
);
}
#ifdef Q_OS_MAC
if
(
settingsCache
->
getHandBgPath
().
isEmpty
()
&&
settingsCache
->
getStackBgPath
().
isEmpty
()
&&
settingsCache
->
getTableBgPath
().
isEmpty
()
&&
settingsCache
->
getPlayerBgPath
().
isEmpty
())
{
QString
srcDir
=
QLibraryInfo
::
location
(
QLibraryInfo
::
DataPath
);
QString
destDir
=
dataDir
+
"/zonebg"
;
QDir
tmpDir
(
destDir
);
if
(
!
tmpDir
.
exists
())
{
// try to install the default images for the current user and set the settigs value
settingsCache
->
copyPath
(
srcDir
+
"/zonebg"
,
destDir
);
settingsCache
->
setHandBgPath
(
destDir
+
"/fabric_green.png"
);
settingsCache
->
setStackBgPath
(
destDir
+
"/fabric_red.png"
);
settingsCache
->
setTableBgPath
(
destDir
+
"/fabric_blue.png"
);
settingsCache
->
setPlayerBgPath
(
destDir
+
"/fabric_gray.png"
);
}
}
if
(
settingsCache
->
getSoundPath
().
isEmpty
())
{
QString
srcDir
=
QLibraryInfo
::
location
(
QLibraryInfo
::
DataPath
);
QString
destDir
=
dataDir
+
"/sounds"
;
QDir
tmpDir
(
destDir
);
if
(
!
tmpDir
.
exists
())
{
// try to install the default sounds for the current user and set the settigs value
settingsCache
->
copyPath
(
srcDir
+
"/sounds"
,
destDir
);
settingsCache
->
setSoundPath
(
destDir
);
}
}
#endif
if
(
!
settingsValid
()
||
db
->
getLoadStatus
()
!=
Ok
)
{
qDebug
(
"main(): invalid settings or load status"
);
DlgSettings
dlgSettings
;
...
...
cockatrice/src/settingscache.cpp
View file @
65f59747
#include
"settingscache.h"
#include
<QSettings>
#include
<QDir>
SettingsCache
::
SettingsCache
()
{
...
...
@@ -257,3 +258,31 @@ void SettingsCache::setMainWindowGeometry(const QByteArray &_mainWindowGeometry)
mainWindowGeometry
=
_mainWindowGeometry
;
settings
->
setValue
(
"interface/main_window_geometry"
,
mainWindowGeometry
);
}
void
SettingsCache
::
copyPath
(
const
QString
&
src
,
const
QString
&
dst
)
{
// test source && return if inexistent
QDir
dir
(
src
);
if
(
!
dir
.
exists
())
return
;
// test destination && create if inexistent
QDir
tmpDir
(
dst
);
if
(
!
tmpDir
.
exists
())
{
tmpDir
.
setPath
(
QDir
::
rootPath
());
if
(
!
tmpDir
.
mkdir
(
dst
)
&&
!
tmpDir
.
exists
())
{
// TODO: this is probably not good.
qDebug
()
<<
"copyPath(): Failed to create dir: "
<<
dst
;
}
}
foreach
(
QString
d
,
dir
.
entryList
(
QDir
::
Dirs
|
QDir
::
NoDotAndDotDot
))
{
QString
dst_path
=
dst
+
QDir
::
separator
()
+
d
;
dir
.
mkpath
(
dst_path
);
copyPath
(
src
+
QDir
::
separator
()
+
d
,
dst_path
);
}
foreach
(
QString
f
,
dir
.
entryList
(
QDir
::
Files
))
{
QFile
::
copy
(
src
+
QDir
::
separator
()
+
f
,
dst
+
QDir
::
separator
()
+
f
);
}
}
cockatrice/src/settingscache.h
View file @
65f59747
...
...
@@ -90,6 +90,7 @@ public:
bool
getIgnoreUnregisteredUsers
()
const
{
return
ignoreUnregisteredUsers
;
}
QString
getPicUrl
()
const
{
return
picUrl
;
}
QString
getPicUrlHq
()
const
{
return
picUrlHq
;
}
void
copyPath
(
const
QString
&
src
,
const
QString
&
dst
);
public
slots
:
void
setMainWindowGeometry
(
const
QByteArray
&
_mainWindowGeometry
);
void
setLang
(
const
QString
&
_lang
);
...
...
oracle/CMakeLists.txt
View file @
65f59747
...
...
@@ -48,8 +48,9 @@ IF (NOT WIN32 AND NOT APPLE)
ENDIF
(
NOT WIN32 AND NOT APPLE
)
if
(
APPLE
)
set
(
plugin_dest_dir ./oracle.app/Contents/Plugins
)
set
(
qtconf_dest_dir ./oracle.app/Contents/Resources
)
# these needs to be relative to CMAKE_INSTALL_PREFIX
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
...
...
@@ -64,13 +65,15 @@ if(APPLE)
endif
()
install
(
CODE
"
file(WRITE
\"
${
qtconf_dest_dir
}
/qt.conf
\"
\"
[Paths]
Plugins = Plugins
\"
)
"
COMPONENT Runtime
)
file(WRITE
\"\$
{CMAKE_INSTALL_PREFIX}/
${
qtconf_dest_dir
}
/qt.conf
\"
\"
[Paths]
Plugins = Plugins
Translations = Resources/translations
\"
)
"
COMPONENT Runtime
)
install
(
CODE
"
file(GLOB_RECURSE QTPLUGINS
\"
${
plugin_dest_dir
}
/*.dylib
\"
)
\"\$
{CMAKE_INSTALL_PREFIX}/
${
plugin_dest_dir
}
/*.dylib
\"
)
set(BU_CHMOD_BUNDLE_ITEMS ON)
include(BundleUtilities)
fixup_bundle(
\"\$
{CMAKE_INSTALL_PREFIX}/oracle.app
\"
\"\$
{QTPLUGINS}
\"
\"
${
QT_LIBRARY_DIR
}
\"
)
"
COMPONENT Runtime
)
...
...
prepareMacRelease.sh
deleted
100644 → 0
View file @
e5d9692d
#!/bin/sh
FRAMEWORKS
=
"Core Gui Multimedia Network Svg Xml"
DATE
=
`
date
'+%Y%m%d'
`
#QTDIR="/Users/brukie/QtSDK/Desktop/Qt/474/gcc"
QTLIB
=
"/Users/brukie/qt_leopard/lib"
QTPLUGINS
=
"/Users/brukie/qt_leopard/plugins"
PROTOBUF
=
"/Users/brukie/protobuf_leopard"
DIR
=
cockatrice_mac_
$DATE
if
[
-d
$DIR
]
;
then
echo
"delete old dir first"
;
exit
1
;
fi
mkdir
$DIR
cp
-R
build/cockatrice/cockatrice.app
$DIR
cp
-R
build/oracle/oracle.app
$DIR
mkdir
$DIR
/Frameworks
cp
-R
sounds zonebg
$DIR
mkdir
$DIR
/translations
cp
build/cockatrice/
*
.qm
$DIR
/translations
cp
-R
$QTPLUGINS
$DIR
/PlugIns
for
f
in
$FRAMEWORKS
;
do
cp
-R
$QTLIB
/Qt
"
$f
"
.framework
$DIR
/Frameworks
done
find
$DIR
/Frameworks
-name
'*debug*'
|xargs
-n
1
rm
-f
find
$DIR
/Frameworks
-name
'Headers'
|xargs
-n
1
rm
-rf
find
$DIR
/PlugIns
-name
'*debug*'
|xargs
-n
1
rm
-f
cp
$PROTOBUF
/lib/libprotobuf.7.dylib
$DIR
/Frameworks
cd
$DIR
for
f
in
$FRAMEWORKS
;
do
echo
"Framework
$f
"
echo
"step 1"
install_name_tool
-id
@executable_path/../../../Frameworks/Qt
"
$f
"
.framework/Versions/4/Qt
"
$f
"
Frameworks/Qt
"
$f
"
.framework/Versions/4/Qt
"
$f
"
for
g
in
$FRAMEWORKS
;
do
install_name_tool
-change
$QTLIB
/Qt
"
$f
"
.framework/Versions/4/Qt
"
$f
"
@executable_path/../../../Frameworks/Qt
"
$f
"
.framework/Versions/4/Qt
"
$f
"
Frameworks/Qt
"
$g
"
.framework/Versions/4/Qt
"
$g
"
done
echo
"step 2"
for
g
in
cockatrice oracle
;
do
install_name_tool
-change
$QTLIB
/Qt
"
$f
"
.framework/Versions/4/Qt
"
$f
"
@executable_path/../../../Frameworks/Qt
"
$f
"
.framework/Versions/4/Qt
"
$f
"
"
$g
"
.app/Contents/MacOS/
$g
done
echo
"step 3"
for
g
in
`
find
.
-name
'*.dylib'
`
;
do
install_name_tool
-change
$QTLIB
/Qt
"
$f
"
.framework/Versions/4/Qt
"
$f
"
@executable_path/../../../Frameworks/Qt
"
$f
"
.framework/Versions/4/Qt
"
$f
"
"
$g
"
done
done
install_name_tool
-id
@executable_path/../../../libprotobuf.7.dylib Frameworks/libprotobuf.7.dylib
install_name_tool
-change
$PROTOBUF
/lib/libprotobuf.7.dylib @executable_path/../../../Frameworks/libprotobuf.7.dylib cockatrice.app/Contents/MacOS/cockatrice
cd
..
VOL
=
cockatrice_mac_
${
DATE
}
DMG
=
"tmp-
$VOL
.dmg"
SIZE
=
`
du
-sk
$DIR
|
cut
-f1
`
SIZE
=
$((${
SIZE
}
/
1000
+
10
))
hdiutil create
"
$DMG
"
-megabytes
${
SIZE
}
-ov
-type
UDIF
-fs
HFS+
-volname
"
$VOL
"
hdid
"
$DMG
"
cp
-R
"
${
DIR
}
"
"/Volumes/
$VOL
"
hdiutil detach
"/Volumes/
$VOL
"
#osascript -e "tell application "Finder" to eject disk "$VOL"" &&
# convert to compressed image, delete temp image
rm
-f
"
${
VOL
}
.dmg"
hdiutil convert
"
$DMG
"
-format
UDZO
-o
"
${
VOL
}
.dmg"
rm
-f
"
$DMG
"
servatrice/CMakeLists.txt
View file @
65f59747
...
...
@@ -55,8 +55,9 @@ elseif(WIN32)
endif
()
if
(
APPLE
)
set
(
plugin_dest_dir ./servatrice.app/Contents/Plugins
)
set
(
qtconf_dest_dir ./servatrice.app/Contents/Resources
)
# 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
)
# note: no codecs in qt5
# note: phonon_backend => mediaservice
...
...
@@ -71,13 +72,15 @@ if(APPLE)
endif
()
install
(
CODE
"
file(WRITE
\"
${
qtconf_dest_dir
}
/qt.conf
\"
\"
[Paths]
Plugins = Plugins
\"
)
file(WRITE
\"\$
{CMAKE_INSTALL_PREFIX}/
${
qtconf_dest_dir
}
/qt.conf
\"
\"
[Paths]
Plugins = Plugins
Translations = Resources/translations
\"
)
"
COMPONENT Runtime
)
install
(
CODE
"
file(GLOB_RECURSE QTPLUGINS
\"
${
plugin_dest_dir
}
/*.dylib
\"
)
\"\$
{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
}
\"
)
"
COMPONENT Runtime
)
...
...
sounds/CMakeLists.txt
View file @
65f59747
...
...
@@ -6,7 +6,7 @@ FILE(GLOB sounds "${CMAKE_CURRENT_SOURCE_DIR}/*.raw")
if
(
UNIX
)
if
(
APPLE
)
INSTALL
(
FILES
${
sounds
}
DESTINATION sounds/
)
INSTALL
(
FILES
${
sounds
}
DESTINATION
cockatrice.app/Contents/Resources/
sounds/
)
else
()
# Assume linux
INSTALL
(
FILES
${
sounds
}
DESTINATION share/cockatrice/sounds/
)
...
...
zonebg/CMakeLists.txt
View file @
65f59747
...
...
@@ -2,11 +2,11 @@
#
# Installs default "zone background" files
FILE
(
GLOB zonebg
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/*.
*
"
)
FILE
(
GLOB zonebg
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/*.
png"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/*.jpg
"
)
if
(
UNIX
)
if
(
APPLE
)
INSTALL
(
FILES
${
zonebg
}
DESTINATION zonebg/
)
INSTALL
(
FILES
${
zonebg
}
DESTINATION
cockatrice.app/Contents/Resources/
zonebg/
)
else
()
# Assume linux
INSTALL
(
FILES
${
zonebg
}
DESTINATION share/cockatrice/zonebg/
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment