Skip to content

Commit

Permalink
Merge branch 'master' into DrDub/master
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn committed May 3, 2024
2 parents 8499992 + 288cd98 commit 8c91ba3
Show file tree
Hide file tree
Showing 16 changed files with 123 additions and 76 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
include:
- qt_version: 5.15.2
qt_version_major: 5
- qt_version: 6.6.2
- qt_version: 6.7.0
qt_version_major: 6

env:
Expand Down Expand Up @@ -154,11 +154,12 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set Tiled version
id: version
run: |
sed -i 's/^version: .*/version: '"${TILED_VERSION}"'/g' snap/snapcraft.yaml
if [[ "$TILED_RELEASE" == 'true' ]]; then echo "snap_channel=candidate" >> $GITHUB_OUTPUT ; fi
if [[ "$TILED_RELEASE" != 'true' ]]; then echo "snap_channel=beta" >> $GITHUB_OUTPUT ; fi
Expand Down Expand Up @@ -192,7 +193,7 @@ jobs:
- qt_version: 5.12.12
version_suffix: "10.12-10.15"
architectures: x86_64
- qt_version: 6.6.2
- qt_version: 6.7.0
version_suffix: "11+"
architectures: x86_64,arm64

Expand Down Expand Up @@ -284,7 +285,7 @@ jobs:
mingw_version: 8.1.0
mingw_component: mingw
mingw_path: /c/Qt/Tools/mingw810_32/bin
- qt_version: 6.6.2
- qt_version: 6.7.0
qt_version_major: 6
qt_toolchain: win64_mingw
arch: 64
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Godot 4 plugin: Fixed positioning of tile collision shapes (by Ryan Petrie, #3862)
* GameMaker 2 plugin: Fixed positioning of objects on isometric maps
* Python plugin: Added support for implementing tileset formats (#3857)
* Python plugin: Raised minimum Python version to 3.8
* tmxrasterizer: Added --hide-object and --show-object arguments (by Lars Luz, #3819)
* tmxrasterizer: Added --frames and --frame-duration arguments to export animated maps as multiple images (#3868)
* tmxrasterizer: Fixed --hide/show-layer to work on group layers (#3899)
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ environment:
BUTLER_API_KEY:
secure: j7JM5L6KeqpnQukzJLsm7J6oV92SpmyEZLSoED1pZ3gQ79VIkdxtbQmTkqUNZPsz
matrix:
- QTDIR: C:\Qt\6.4\msvc2019_64
- QTDIR: C:\Qt\6.7\msvc2019_64
PYTHONHOME: C:\Python38-x64
DEFAULT_PROFILE: MSVC2019-x64
PUSH_RELEASE: false
ENABLE_ZSTD: false
- QTDIR: C:\Qt\6.4\mingw_64
- QTDIR: C:\Qt\6.7\mingw_64
PYTHONHOME: C:\Python38-x64
MINGW: C:\Qt\Tools\mingw1120_64
DEFAULT_PROFILE: x86_64-w64-mingw32-gcc-11_2_0
Expand Down
37 changes: 28 additions & 9 deletions dist/install-qt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ usage: install-qt [options] [components]
Examples
./install-qt.sh --version 5.13.1 qtbase
./install-qt.sh --version 5.14.0 --target android --toolchain any qtbase qtscript
./install-qt.sh --version 5.14.0 --target android --toolchain any qtbase
Positional arguments
components
Expand Down Expand Up @@ -89,7 +89,7 @@ Options
android
any, android_armv7, android_arm64_v8a
desktop
clang_64 (default),
clang_64 (default)
ios
ios
Expand Down Expand Up @@ -234,7 +234,6 @@ fi

MIRRORS="\
http://ftp.acc.umu.se/mirror/qt.io/qtproject \
http://qt.mirrors.tds.net/qt \
http://ftp.fau.de/qtproject \
http://download.qt.io \
"
Expand All @@ -250,6 +249,10 @@ done

DOWNLOAD_DIR=`mktemp -d 2>/dev/null || mktemp -d -t 'install-qt'`

function version {
echo "$@" | awk -F. '{ printf("%03d%03d%03d\n", $1,$2,$3); }';
}

#
# The repository structure is a mess. Try different URL variants
#
Expand Down Expand Up @@ -293,6 +296,12 @@ function compute_url(){
return 0
fi
else
if [ "$(version "${VERSION}")" -ge "$(version "6.7.0")" ]; then
if [ "${TOOLCHAIN}" == "gcc_64" ]; then
TOOLCHAIN="linux_gcc_64"
fi
fi

REMOTE_BASES=(
# New repository format (>=6.0.0)
"qt6_${VERSION//./}/qt.qt6.${VERSION//./}.${TOOLCHAIN}"
Expand Down Expand Up @@ -324,10 +333,6 @@ function compute_url(){
exit 1
}

function version {
echo "$@" | awk -F. '{ printf("%03d%03d%03d\n", $1,$2,$3); }';
}

mkdir -p ${INSTALL_DIR}
rm -f "${HASH_FILEPATH}"

Expand Down Expand Up @@ -373,19 +378,33 @@ for COMPONENT in ${COMPONENTS}; do
SUBDIR="${TOOLCHAIN/win32_/}"
elif [[ "${TOOLCHAIN}" =~ "any" ]] && [[ "${TARGET_PLATFORM}" == "android" ]]; then
SUBDIR="android"
elif [ "${HOST_OS}" == "mac_x64" ] && [ ! "${VERSION}" \< "6.1.2" ]; then
elif [[ "${HOST_OS}" == "mac_x64" ]] && [[ ! "${VERSION}" < "6.1.2" ]] && [[ "${TARGET_PLATFORM}" == "desktop" ]]; then
SUBDIR="macos"
else
SUBDIR="${TOOLCHAIN}"
fi

if [ "${TARGET_PLATFORM}" == "android" ] && [ ! "${VERSION}" \< "6.0.0" ]; then
CONF_FILE="${UNPACK_DIR}/${VERSION}/${SUBDIR}/bin/target_qt.conf"
ANDROID_QMAKE_FILE="${UNPACK_DIR}/${VERSION}/${SUBDIR}/bin/qmake"
if [ "${TOOLCHAIN}" == "android_armv7" ] && [ ! "${VERSION}" \< "6.4.2" ]; then
sed -i "s/\r//" "${CONF_FILE}"
sed -i "s|HostLibraryExecutables=.\/bin|HostLibraryExecutables=.\/libexec|g" "${CONF_FILE}"
chmod +x "${ANDROID_QMAKE_FILE}"
sed -i "s|\\\|\/|g" "${ANDROID_QMAKE_FILE}"
fi
sed -i "s|target|../$TOOLCHAIN|g" "${CONF_FILE}"
sed -i "/HostPrefix/ s|$|gcc_64|g" "${CONF_FILE}"
ANDROID_QMAKE_FILE="${UNPACK_DIR}/${VERSION}/${SUBDIR}/bin/qmake"
QMAKE_FILE="${UNPACK_DIR}/${VERSION}/gcc_64/bin/qmake"
sed -i "s|\/home\/qt\/work\/install\/bin\/qmake|$QMAKE_FILE|g" "${ANDROID_QMAKE_FILE}"
sed -i "s|\/Users\/qt\/work\/install\/bin\/qmake|$QMAKE_FILE|g" "${ANDROID_QMAKE_FILE}"
elif [ "${TARGET_PLATFORM}" == "ios" ] && [ ! "${VERSION}" \< "6.0.0" ]; then
CONF_FILE="${UNPACK_DIR}/${VERSION}/${SUBDIR}/bin/target_qt.conf"
sed -i.bak "s|HostData=target|HostData=../$TOOLCHAIN|g" "${CONF_FILE}"
sed -i.bak "s|HostPrefix=..\/..\/|HostPrefix=..\/..\/macos|g" "${CONF_FILE}"
IOS_QMAKE_FILE="${UNPACK_DIR}/${VERSION}/${SUBDIR}/bin/qmake"
QMAKE_FILE="${UNPACK_DIR}/${VERSION}/macos/bin/qmake"
sed -i.bak "s|\/Users\/qt\/work\/install\/bin\/qmake|${QMAKE_FILE}|g" "${IOS_QMAKE_FILE}"
else
CONF_FILE="${UNPACK_DIR}/${VERSION}/${SUBDIR}/bin/qt.conf"
echo "[Paths]" > ${CONF_FILE}
Expand Down
54 changes: 25 additions & 29 deletions dist/linux/AppRun
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,28 @@ my_help() {
echo "Tiled help:"
}

if [ -n "${1}" ]
then
case ${1} in
terraingenerator)
shift
exec "$this_dir"/${bin_dir}/terraingenerator "$@"
;;
tiled)
shift
exec "$this_dir"/${bin_dir}/tiled "$@"
;;
tmxrasterizer)
shift
exec "$this_dir"/${bin_dir}/tmxrasterizer "$@"
;;
tmxviewer)
shift
exec "$this_dir"/${bin_dir}/tmxviewer "$@"
;;
"--help")
my_help
exec "$this_dir"/${bin_dir}/tiled "--help"
;;
*)
exec "$this_dir"/${bin_dir}/tiled "$@"
;;
esac

fi
case ${1} in
terraingenerator)
shift
exec "$this_dir"/${bin_dir}/terraingenerator "$@"
;;
tiled)
shift
exec "$this_dir"/${bin_dir}/tiled "$@"
;;
tmxrasterizer)
shift
exec "$this_dir"/${bin_dir}/tmxrasterizer "$@"
;;
tmxviewer)
shift
exec "$this_dir"/${bin_dir}/tmxviewer "$@"
;;
"--help")
my_help
exec "$this_dir"/${bin_dir}/tiled "--help"
;;
*)
exec "$this_dir"/${bin_dir}/tiled "$@"
;;
esac
5 changes: 4 additions & 1 deletion dist/win/installer.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ WindowsInstallerPackage {
}
}

defs.push("WindowsVistaStyle")
if (Qt.core.versionMajor >= 6 && Qt.core.versionMinor >= 7)
defs.push("WindowsStylePlugin=qmodernwindowsstyle.dll")
else
defs.push("WindowsStylePlugin=qwindowsvistastyle.dll")

var pythonHome = Environment.getEnv("PYTHONHOME");
if (pythonHome && File.exists(pythonHome))
Expand Down
6 changes: 3 additions & 3 deletions dist/win/installer.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@
<File Source="$(var.QtDir)\plugins\imageformats\qwebp.dll"/>
</Component>
</Directory>
<?ifdef WindowsVistaStyle ?>
<?ifdef WindowsStylePlugin ?>
<Directory Id="stylePlugins" Name="styles">
<Component Id="StylePlugins" Guid="{DB5D5DD3-1128-4FE0-A76C-EB7E4069EBFE}">
<File Source="$(var.QtDir)\plugins\styles\qwindowsvistastyle.dll"/>
<File Source="$(var.QtDir)\plugins\styles\$(var.WindowsStylePlugin)"/>
</Component>
</Directory>
<?endif?>
Expand Down Expand Up @@ -448,7 +448,7 @@
<ComponentRef Id='PlatformPlugins' />
<ComponentRef Id='ImageFormatPlugins' />
<ComponentRef Id='IconEnginePlugins' />
<?ifdef WindowsVistaStyle ?>
<?ifdef WindowsStylePlugin ?>
<ComponentRef Id='StylePlugins' />
<?endif?>
<?if $(var.QtVersionMajor) >= 6 and $(var.QtVersionMinor) >= 2 ?>
Expand Down
2 changes: 1 addition & 1 deletion docs/scripting-doc/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ declare namespace Qt {
* case you need a local file path, you can use the following code:
*
* ```js
* var path = url.toString().replace(/^file:\/{2}/, '');
* var path = url.toString().replace(/^file:\/{3}/, (tiled.platform == 'windows') ? '' : '/');;
* ```
*
* Or have a look at whether an alternative property is available that
Expand Down
3 changes: 3 additions & 0 deletions org.mapeditor.Tiled.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<name>Tiled</name>
<summary>General purpose map editor</summary>
<summary xml:lang="de">Leveleditor für allgemeine Zwecke</summary>
<developer id="org.mapeditor">
<name>Thorbjørn Lindeijer</name>
</developer>
<keywords>
<keyword>2D</keyword>
<keyword>mapeditor</keyword>
Expand Down
7 changes: 3 additions & 4 deletions qbs/imports/PythonProbe.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import qbs.Utilities
Probe {
id: pythonDllProbe

condition: qbs.targetOS.contains("windows")

property string pythonDir: pythonInstallDir // Input
property string buildVariant: qbs.buildVariant // Input
property string minVersion: "3.5" // Input
property string fileNamePrefix // Output

configure: {
Expand Down Expand Up @@ -45,9 +44,9 @@ Probe {
+ output + "'");
return;
}
if (Utilities.versionCompare(versionNumberString, "3.5") < 0) {
if (Utilities.versionCompare(versionNumberString, minVersion) < 0) {
printWarning("The Python installation at '" + pythonDir
+ "' has version " + versionNumberString + ", but 3.5 or higher "
+ "' has version " + versionNumberString + ", but " + minVersion + " or higher "
+ "is required.");
return;
}
Expand Down
10 changes: 6 additions & 4 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: tiled
adopt-info: tiled
version: git
license: GPL-2.0
base: core22

Expand Down Expand Up @@ -44,10 +43,13 @@ apps:
parts:
tiled:
plugin: make
override-pull: |
craftctl default
craftctl set version="$(git describe | sed 's/v//')"
override-build: |
qbs setup-toolchains --detect
qbs build --jobs "${CRAFT_PARALLEL_BUILD_COUNT}" --command-echo-mode command-line config:release qbs.installPrefix:"/usr" projects.Tiled.version:$(craftctl get version) projects.Tiled.useRPaths:false
qbs install --install-root "${CRAFT_PART_INSTALL}" config:release
qbs setup-toolchains --detect
qbs build --jobs "${CRAFT_PARALLEL_BUILD_COUNT}" --command-echo-mode command-line config:release qbs.installPrefix:"/usr" projects.Tiled.version:$(craftctl get version) projects.Tiled.useRPaths:false
qbs install --install-root "${CRAFT_PART_INSTALL}" config:release
parse-info:
- usr/share/metainfo/org.mapeditor.Tiled.appdata.xml
source: .
Expand Down
17 changes: 3 additions & 14 deletions src/plugins/python/python.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ TiledPlugin {
if (qbs.targetOS.contains("windows"))
return pythonDllProbe.found;

return pkgConfigPython3Embed.found || pkgConfigPython3.found;
return pkgConfigPython3.found;
}

cpp.cxxFlags: {
Expand All @@ -22,25 +22,14 @@ TiledPlugin {

Probes.PkgConfigProbe {
id: pkgConfigPython3
name: "python3"
}

Probes.PkgConfigProbe {
id: pkgConfigPython3Embed
name: "python3-embed"
minVersion: "3.8"
}

PythonProbe {
id: pythonDllProbe
pythonDir: Environment.getEnv("PYTHONHOME")
}

Properties {
condition: pkgConfigPython3Embed.found
cpp.cxxFlags: outer.concat(pkgConfigPython3Embed.cflags)
cpp.dynamicLibraries: pkgConfigPython3Embed.libraries
cpp.libraryPaths: pkgConfigPython3Embed.libraryPaths
cpp.linkerFlags: pkgConfigPython3Embed.linkerFlags
minVersion: "3.8"
}

Properties {
Expand Down
20 changes: 16 additions & 4 deletions src/plugins/python/pythonplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,26 @@ PythonPlugin::~PythonPlugin()
void PythonPlugin::initialize()
{
if (!Py_IsInitialized()) {
// PEP370
Py_NoSiteFlag = 1;
Py_NoUserSiteDirectory = 1;
// PEP 587
PyConfig config;
PyConfig_InitPythonConfig(&config);

// PEP 370
config.site_import = 0;
config.user_site_directory = 0;

PyImport_AppendInittab("tiled", PyInit_tiled);
PyImport_AppendInittab("tiled.qt", PyInit_tiled);
PyImport_AppendInittab("tiled.Tiled", PyInit_tiled);
Py_Initialize();

PyStatus status = Py_InitializeFromConfig(&config);
PyConfig_Clear(&config);

if (PyStatus_Exception(status)) {
Tiled::ERROR("Python initialization failed");
handleError();
return;
}

PyObject *pmod = PyImport_ImportModule("tiled");

Expand Down
Loading

0 comments on commit 8c91ba3

Please sign in to comment.