Hi all
I made a wxWidgets C++ appplication for Linux using a Makefile made from scratch, instead of using the build system/makefiles
supplied by wxWidgets
to get the compiler and link flags I used
wx-config --cxxflags
wx-config --libs
I did the same for Mac, but it builds an executable that opens a terminal (and then the GUI app), but not directly the GUI, and also
it does not have an icon.
How can I add to the Makefile the creation of the Mac icon image and GUI app?
thanks
Mac makefile made from scratch
Re: Mac makefile made from scratch
You need to create an App bundle under OS X. This might help: viewtopic.php?p=30345#p30345
Use the source, Luke!
- xaviou
- Super wx Problem Solver
- Posts: 437
- Joined: Mon Aug 21, 2006 3:18 pm
- Location: Annecy - France
- Contact:
Re: Mac makefile made from scratch
Hi.
As doublemax said, you need to creare an application bundle.
But if you want to make some tests without creating a bundle, you just need to make a call to "SetFile" :
Note that you will also have to make this call if you create a bundle.
Regards
Xav'
Edit: this is for the "non-terminal" part of your message. For the application icon, you'll have to make a bundle.
As doublemax said, you need to creare an application bundle.
But if you want to make some tests without creating a bundle, you just need to make a call to "SetFile" :
Code: Select all
SetFile -t APPL YourExecutableFile
Regards
Xav'
Edit: this is for the "non-terminal" part of your message. For the application icon, you'll have to make a bundle.
My wxWidgets stuff web page : X@v's wxStuff
Re: Mac makefile made from scratch
thanks
With the minimal app link I modified my Makefile to have this simpler modified version.
Here "Explorer" is the executable name and it has to match the strings for keys
in Info_cocoa.plist
the $(OBJs) part is missing , these are object files generated by g++ from C++ source files
With the minimal app link I modified my Makefile to have this simpler modified version.
Here "Explorer" is the executable name and it has to match the strings for keys
Code: Select all
<key>CFBundleExecutable</key>
<key>CFBundleName</key>
the $(OBJs) part is missing , these are object files generated by g++ from C++ source files
Code: Select all
CXX = g++
CXX_FLAG = -DHAVE_PLPLOT -stdlib=libc++ -std=c++11 -Wall -D_FILE_OFFSET_BITS=64 -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__
LINK_FLAG = -stdlib=libc++
# Bundle
SETFILE = SetFile
PROGRAM = Explorer
ICONFILE = wxmac.icns
BUNDLESIGNATURE=????
BUNDLE=$(PROGRAM).app
MACPACKAGEINFO=$(BUNDLE)/Contents/PkgInfo
all: $(BUNDLE)
# This builds the executable and makes the bundle
$(BUNDLE): $(OBJs)
@echo "Building: $(BUNDLE)"
mkdir -p $(BUNDLE)/Contents/MacOS
$(CXX) $(LINK_FLAG) -o $(BUNDLE)/Contents/MacOS/$(PROGRAM) $(OBJs) $(LIB)
mkdir -p $(BUNDLE)/Contents
mkdir -p $(BUNDLE)/Contents/Resources
$(SETFILE) -t APPL $(BUNDLE)/Contents/MacOS/$(PROGRAM)
cp Info_cocoa.plist $(BUNDLE)/Contents/Info.plist
echo -n "APPL$(BUNDLESIGNATURE)" > $(MACPACKAGEINFO)
cp -f $(ICONFILE) $(BUNDLE)/Contents/Resources/$(ICONFILE)