mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-07-19 06:05:17 +02:00
Always cross-compile on Intel Macs
libsigc++ was keeping me from doing this before. Works perfectly now.
This commit is contained in:
parent
baaa162e2c
commit
d65005a0aa
5 changed files with 1742 additions and 13 deletions
|
@ -4,25 +4,32 @@ HOST = `clang -dumpmachine`.strip
|
|||
ARCH = HOST[/x86_64|arm64/]
|
||||
|
||||
def run_build(arch)
|
||||
puts "Building all dependencies. This'll take a while.\n"
|
||||
case arch
|
||||
when "x86_64"
|
||||
return system("make everything -f .Intel")
|
||||
when "arm64"
|
||||
printf("====================================================\n")
|
||||
printf("Building all dependencies. This'll take a while.\n")
|
||||
|
||||
if `xcodebuild -version`.scan(/Xcode (\d+)/)[0][0].to_i >= 12
|
||||
printf("Building libraries for Apple Silicon...\n")
|
||||
printf("====================================================\n")
|
||||
code = system("make everything -f .AppleSilicon")
|
||||
return code if !code
|
||||
code = (system("arch -x86_64 make everything -f .Intel"))
|
||||
return code if !code
|
||||
return system("./make_macuniversal")
|
||||
else
|
||||
raise "Unsupported architecture"
|
||||
end
|
||||
printf("====================================================\n")
|
||||
printf("Building libraries for Intel...\n")
|
||||
printf("====================================================\n")
|
||||
code = (system("make everything -f .Intel"))
|
||||
return code if !code
|
||||
|
||||
printf("====================================================\n")
|
||||
printf("Performing post-setup...\n")
|
||||
printf("====================================================\n")
|
||||
printf("Creating universal libraries ...\n")
|
||||
return system("./make_macuniversal")
|
||||
end
|
||||
|
||||
def fix_steam(libpath)
|
||||
# Don't need to do anything if it's already set to runpath
|
||||
return 0 if (`otool -L #{libpath}`[/@rpath/])
|
||||
puts "Patching Steamworks SDK...\n"
|
||||
printf("Patching Steamworks SDK...\n")
|
||||
# Remove 32-bit code from the binary
|
||||
if `lipo -info #{libpath}`[/i386/]
|
||||
return 1 if !system("lipo -remove i386 #{libpath} -o #{libpath}")
|
||||
|
@ -30,7 +37,6 @@ def fix_steam(libpath)
|
|||
# Set the install name to runpath
|
||||
return 1 if !system("install_name_tool -id @rpath/libsteam_api.dylib #{libpath}")
|
||||
# Resign
|
||||
puts "Done.\n"
|
||||
return (system("codesign -fs - #{libpath}") ? 0 : 1)
|
||||
end
|
||||
|
||||
|
@ -42,4 +48,6 @@ if File.exists?(STEAM_LIB)
|
|||
exitcode = fix_steam(STEAM_LIB)
|
||||
end
|
||||
|
||||
printf("Done.\n\n")
|
||||
|
||||
exit(exitcode)
|
||||
|
|
|
@ -82,7 +82,7 @@ global_include_dirs += include_directories('.',
|
|||
'input',
|
||||
'net',
|
||||
'system',
|
||||
'util'
|
||||
'util', 'util/sigslot', 'util/sigslot/adapter'
|
||||
)
|
||||
|
||||
global_dependencies += [openal, zlib, bz2, sdl2, sdl_sound, pixman, physfs, vorbisfile, vorbis, ogg, sdl2_ttf, freetype, sdl2_image, png, jpeg]
|
||||
|
|
22
src/util/sigslot/adapter/boost.hpp
Normal file
22
src/util/sigslot/adapter/boost.hpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
#pragma once
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/weak_ptr.hpp>
|
||||
|
||||
/**
|
||||
* Bring ADL conversion for boost smart pointers
|
||||
*/
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <typename T>
|
||||
weak_ptr<T> to_weak(shared_ptr<T> p) {
|
||||
return {p};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
weak_ptr<T> to_weak(weak_ptr<T> p) {
|
||||
return p;
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
88
src/util/sigslot/adapter/qt.hpp
Normal file
88
src/util/sigslot/adapter/qt.hpp
Normal file
|
@ -0,0 +1,88 @@
|
|||
#pragma once
|
||||
#include <type_traits>
|
||||
#include <QtGlobal>
|
||||
#include <QSharedPointer>
|
||||
#include <QPointer>
|
||||
#include <QObject>
|
||||
|
||||
/**
|
||||
* Definition of a few adapters that allow object life tracking for QObject,
|
||||
* QWeakPointer and QSharedPointer objects, when connected to signals.
|
||||
*/
|
||||
|
||||
namespace sigslot {
|
||||
namespace detail {
|
||||
|
||||
// a weak pointer adater to allow QObject life tracking
|
||||
template <typename T>
|
||||
struct qpointer_adater {
|
||||
qpointer_adater(T *o) noexcept
|
||||
: m_ptr{o}
|
||||
{}
|
||||
|
||||
void reset() noexcept {
|
||||
m_ptr.clear();
|
||||
}
|
||||
|
||||
bool expired() const noexcept {
|
||||
return m_ptr.isNull();
|
||||
}
|
||||
|
||||
// Warning: very unsafe because QPointer does not provide weak pointer semantics
|
||||
// In a multithreaded context, m_ptr may very well be destroyed in the lapse of
|
||||
// time between expired() and data() (and also while data() is being used).
|
||||
T* lock() const noexcept {
|
||||
return expired() ? nullptr : m_ptr.data();
|
||||
}
|
||||
|
||||
private:
|
||||
QPointer<T> m_ptr;
|
||||
};
|
||||
|
||||
// a wrapper that exposes the right concepts for QWeakPointer
|
||||
template <typename T>
|
||||
struct qweakpointer_adater {
|
||||
qweakpointer_adater(QWeakPointer<T> o) noexcept
|
||||
: m_ptr{std::move(o)}
|
||||
{}
|
||||
|
||||
void reset() noexcept {
|
||||
m_ptr.clear();
|
||||
}
|
||||
|
||||
bool expired() const noexcept {
|
||||
return m_ptr.isNull();
|
||||
}
|
||||
|
||||
QSharedPointer<T> lock() const noexcept {
|
||||
return m_ptr.lock();
|
||||
}
|
||||
|
||||
private:
|
||||
QWeakPointer<T> m_ptr;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace sigslot
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
template <typename T>
|
||||
std::enable_if_t<std::is_base_of<QObject, T>::value, sigslot::detail::qpointer_adater<T>>
|
||||
to_weak(T *p) {
|
||||
return {p};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
sigslot::detail::qweakpointer_adater<T> to_weak(QWeakPointer<T> p) {
|
||||
return {p};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
sigslot::detail::qweakpointer_adater<T> to_weak(QSharedPointer<T> p) {
|
||||
return {p};
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
1611
src/util/sigslot/signal.hpp
Normal file
1611
src/util/sigslot/signal.hpp
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue