Mac build fixes

This commit is contained in:
Jack Andersen 2019-05-27 00:59:37 -10:00
parent b03bd8dabc
commit 5a8b62b1cd
10 changed files with 28 additions and 15 deletions

View File

@ -34,14 +34,14 @@
"url": "https://github.com/jackoalan/CodeGen", "url": "https://github.com/jackoalan/CodeGen",
"type": "git", "type": "git",
"head": "cmake", "head": "cmake",
"ref": "306a856ff541b9de6f3131eed8f958e91f4bf23d" "ref": "e5df94de136afc93c4edcce48030ffdd22250308"
}, },
{ {
"name": "LibCommon", "name": "LibCommon",
"url": "https://github.com/jackoalan/LibCommon", "url": "https://github.com/jackoalan/LibCommon",
"type": "git", "type": "git",
"head": "dew", "head": "dew",
"ref": "86229ae2f1dc8313109e0fe65823b4d6844b4b11" "ref": "8c4a1e7818b625bb26c1efa55d5d9a7c946f5402"
}, },
{ {
"name": "lzo", "name": "lzo",

View File

@ -114,8 +114,8 @@ bool ValidateCooker(EResourceType ResourceType, bool DumpInvalidFileContents)
// Start our comparison by making sure the sizes match up // Start our comparison by making sure the sizes match up
const uint kAlignment = (It->Game() >= EGame::Corruption ? 64 : 32); const uint kAlignment = (It->Game() >= EGame::Corruption ? 64 : 32);
const uint kAlignedOriginalSize = ALIGN( (uint) OriginalData.size(), kAlignment ); const uint kAlignedOriginalSize = VAL_ALIGN( (uint) OriginalData.size(), kAlignment );
const uint kAlignedNewSize = ALIGN( (uint) NewData.size(), kAlignment ); const uint kAlignedNewSize = VAL_ALIGN( (uint) NewData.size(), kAlignment );
const char* pkInvalidReason = ""; const char* pkInvalidReason = "";
bool IsValid = false; bool IsValid = false;

View File

@ -195,7 +195,7 @@ public:
uint32 ItemSize() const uint32 ItemSize() const
{ {
uint32 ItemAlign = mpItemArchetype->DataAlignment(); uint32 ItemAlign = mpItemArchetype->DataAlignment();
uint32 ItemSize = ALIGN(mpItemArchetype->DataSize(), ItemAlign); uint32 ItemSize = VAL_ALIGN(mpItemArchetype->DataSize(), ItemAlign);
return ItemSize; return ItemSize;
} }

View File

@ -213,7 +213,7 @@ void IProperty::Initialize(IProperty* pInParent, CScriptTemplate* pInTemplate, u
{ {
ChildOffset += mChildren[ChildIdx-1]->DataSize(); ChildOffset += mChildren[ChildIdx-1]->DataSize();
} }
ChildOffset = ALIGN(ChildOffset, pChild->DataAlignment()); ChildOffset = VAL_ALIGN(ChildOffset, pChild->DataAlignment());
// Don't call Initialize on intrinsic children as they have already been initialized. // Don't call Initialize on intrinsic children as they have already been initialized.
if (!pChild->IsIntrinsic()) if (!pChild->IsIntrinsic())

View File

@ -144,7 +144,7 @@ void CSceneNode::BuildLightList(CGameArea *pArea)
SLightEntry(CLight *_pLight, float _Distance) SLightEntry(CLight *_pLight, float _Distance)
: pLight(_pLight), Distance(_Distance) {} : pLight(_pLight), Distance(_Distance) {}
bool operator<(const SLightEntry& rkOther) { bool operator<(const SLightEntry& rkOther) const {
return (Distance < rkOther.Distance); return (Distance < rkOther.Distance);
} }
}; };

View File

@ -89,6 +89,8 @@ elseif (APPLE)
set_source_files_properties(${src} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/${reldir}) set_source_files_properties(${src} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/${reldir})
endforeach() endforeach()
set(PLAT_SRCS icons/mac/mainicon.icns ${RES_SOURCES} MacOSExtras.mm) set(PLAT_SRCS icons/mac/mainicon.icns ${RES_SOURCES} MacOSExtras.mm)
find_library(APPKIT_LIBRARY AppKit)
set(PLAT_LIBS ${APPKIT_LIBRARY})
else() else()
configure_file(icons/freedesktop/metainfo/io.github.arukibree.PrimeWorldEditor.appdata.xml.in configure_file(icons/freedesktop/metainfo/io.github.arukibree.PrimeWorldEditor.appdata.xml.in
"${CMAKE_CURRENT_BINARY_DIR}/io.github.arukibree.PrimeWorldEditor.appdata.xml" @ONLY) "${CMAKE_CURRENT_BINARY_DIR}/io.github.arukibree.PrimeWorldEditor.appdata.xml" @ONLY)
@ -109,6 +111,7 @@ target_link_libraries(
pwe_core pwe_core
Qt5::Widgets Qt5::Widgets
${QT_PLATFORM_COMPONENTS_LIBS} ${QT_PLATFORM_COMPONENTS_LIBS}
${PLAT_LIBS}
) )
target_compile_definitions( target_compile_definitions(
@ -122,7 +125,7 @@ target_compile_definitions(
) )
if (WIN32) if (WIN32)
find_program(WINDEPLOYQT_PROGRAM windeployqt PATHS $ENV{QTDIR}/bin/) find_program(WINDEPLOYQT_PROGRAM windeployqt PATHS ${Qt5_DIR}/../../../bin/)
if(WINDEPLOYQT_PROGRAM) if(WINDEPLOYQT_PROGRAM)
message(STATUS "Found ${WINDEPLOYQT_PROGRAM}") message(STATUS "Found ${WINDEPLOYQT_PROGRAM}")
else() else()
@ -137,7 +140,7 @@ if (WIN32)
add_custom_command(TARGET pwe_editor POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_directory add_custom_command(TARGET pwe_editor POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_directory
"${DEW_CMAKE_PREFIX_PATH}/bin" $<TARGET_FILE_DIR:pwe_editor>) "${DEW_CMAKE_PREFIX_PATH}/bin" $<TARGET_FILE_DIR:pwe_editor>)
elseif (APPLE) elseif (APPLE)
find_program(MACDEPLOYQT_PROGRAM macdeployqt PATHS $ENV{QTDIR}/bin/) find_program(MACDEPLOYQT_PROGRAM macdeployqt PATHS ${Qt5_DIR}/../../../bin/)
if(MACDEPLOYQT_PROGRAM) if(MACDEPLOYQT_PROGRAM)
message(STATUS "Found ${MACDEPLOYQT_PROGRAM}") message(STATUS "Found ${MACDEPLOYQT_PROGRAM}")
else() else()
@ -145,7 +148,8 @@ elseif (APPLE)
endif() endif()
# run macdeployqt to gather necessary qt libraries and plugins # run macdeployqt to gather necessary qt libraries and plugins
add_custom_command(TARGET pwe_editor POST_BUILD COMMAND ${MACDEPLOYQT_PROGRAM} ARGS $<TARGET_FILE:pwe_editor>) add_custom_command(TARGET pwe_editor POST_BUILD COMMAND ${MACDEPLOYQT_PROGRAM} ARGS
$<TARGET_FILE_DIR:pwe_editor>/../..)
else() else()
target_compile_definitions( target_compile_definitions(
pwe_editor pwe_editor

View File

@ -150,8 +150,8 @@ EQuickplayLaunchResult LaunchQuickplay(QWidget* pParentWidget,
} }
// Append the patch data to the end of the dol // Append the patch data to the end of the dol
uint32 AlignedDolSize = ALIGN(DolData.size(), 32); uint32 AlignedDolSize = VAL_ALIGN(DolData.size(), 32);
uint32 AlignedPatchSize = ALIGN(PatchData.size(), 32); uint32 AlignedPatchSize = VAL_ALIGN(PatchData.size(), 32);
uint32 PatchOffset = AlignedDolSize; uint32 PatchOffset = AlignedDolSize;
uint32 PatchSize = AlignedPatchSize; uint32 PatchSize = AlignedPatchSize;
DolData.resize(PatchOffset + PatchSize); DolData.resize(PatchOffset + PatchSize);

View File

@ -5,9 +5,9 @@
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>PrimeWorldEditor</string> <string>PrimeWorldEditor</string>
<key>CFBundleGetInfoString</key> <key>CFBundleGetInfoString</key>
<string>@METADATA_VERSION_STRING@</string> <string>@PWE_WC_DESCRIBE@</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>@METADATA_VERSION_STRING@</string> <string>@PWE_WC_DESCRIBE@</string>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>
<string>@CURRENT_YEAR@ Aruki</string> <string>@CURRENT_YEAR@ Aruki</string>
<key>CFBundleIconFile</key> <key>CFBundleIconFile</key>
@ -19,7 +19,7 @@
<key>CFBundleName</key> <key>CFBundleName</key>
<string>@PWE_APP_NAME@</string> <string>@PWE_APP_NAME@</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>@METADATA_VERSION_STRING@</string> <string>@PWE_WC_DESCRIBE@</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>

Binary file not shown.

View File

@ -47,6 +47,15 @@ static TString LocateDataDirectory()
if (FileUtil::IsDirectory(dir + "resources")) if (FileUtil::IsDirectory(dir + "resources"))
return dir; return dir;
} }
#endif
#if defined(__APPLE__)
{
/* This is for locating mac bundle root */
TString dir = FileUtil::MakeAbsolute(TString(QCoreApplication::applicationDirPath().toUtf8().data()) + "/../Resources");
debugf("Checking '%s' for resources", *dir);
if (FileUtil::IsDirectory(dir + "resources"))
return dir;
}
#endif #endif
{ {
/* This is for locating build directory root */ /* This is for locating build directory root */