Dieses Video zeigt, wie ihr einfach App-Bundles inklusive Icons für eure wxWidgets-Programme auf macOS erstellen könnt. Ebenfalls gehe ich auf den dylibbundler ein, um ein einfache Deployment durchzuführen.
Hier noch die Dateien:
Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key> <string>English</string>
<key>CFBundleExecutable</key> <string>wx</string>
<key>CFBundleInfoDictionaryVersion</key> <string>6.0</string>
<key>CFBundlePackageType</key> <string>APPL</string>
<key>CSResourcesFileMapped</key> <true/>
<key>CFBundleVersion</key> <string>0.0.1</string>
<key>CFBundleShortVersionString</key> <string>0.0.1</string>
<key>CFBundleName</key> <string>My wxApp</string>
<key>CFBundleIconFile</key> <string>AppIcon</string>
</dict>
</plist>
Script zum Kompilieren
#!/bin/sh
PROGRAM="wx"
BUNDLE="wx.app"
ICON="AppIcon.icns"
test -d "${BUNDLE}" && rm -Rf "${BUNDLE}"
c++ *.cpp -o wx -std=c++11 `/usr/local/Cellar/wxWidgets/3.2.1/bin/wx-config --libs --cppflags`
if [ $? == 0 ]
then
mkdir -p "${BUNDLE}/Contents/MacOS"
echo -n 'APPL????' > "${BUNDLE}/Contents/PkgInfo"
mv "${PROGRAM}" "${BUNDLE}/Contents/MacOS/"
cp "Info.plist" "${BUNDLE}/Contents/"
mkdir -p "${BUNDLE}/Contents/Resources"
cp "${ICON}" "${BUNDLE}/Contents/Resources/"
mkdir "${BUNDLE}/Contents/lib" && ln -s "${BUNDLE}/Contents/lib" "${BUNDLE}/Contents/libs"
/usr/local/Cellar/dylibbundler/1.0.4/bin/dylibbundler -od -b -x "${BUNDLE}/Contents/MacOS/${PROGRAM}" -d "${BUNDLE}/Contents/lib"
fi
Programmcode
#include <wx/wx.h>
class MyApp : public wxApp {
public:
bool OnInit();
};
class MyFrame : public wxFrame {
public:
MyFrame();
};
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit() {
MyFrame *myFrame = new MyFrame;
myFrame->Show();
SetTopWindow(myFrame);
return true;
}
MyFrame::MyFrame() : wxFrame(nullptr, wxID_ANY, "Meine wx-App") {
wxStaticText *staticText = new wxStaticText(this, wxID_ANY, "Hello World");
}