Wes's Guide to building MMEX on Mac OS X
Posted: Wed Sep 09, 2009 4:00 am
This will be edited numerous times, I am sure, but I wanted to go ahead and get this put down so that I have reference to go back to, and others may have use of it as well.
So, here are the steps I used to build MMEX on the Mac.
1. First, we need to build wxMac. We could have used the standard OS X installation of wxWidgets, but that is often many revisions behind the current stable release. Rather than have each Mac user build their own copy of wxWidgets as a shared library, I decided to use a static library and include the necessary code in the application bundle.
Download the latest stable release of wxMac from here:http://www.wxwidgets.org/downloads/
Follow the instruction here: http://wiki.wxwidgets.org/Compiling_wxW ... erminal%29 to build wxWidgets on the Mac. Don't forget the flags when configuring! I have built the copy that I am using with. This builds an Ansi static version of wxWidgets that supports building universal binaries. You can create multiple versions of wxMac with different build settings for building different versions of MMEX (intel only, ppc only, universal binary, unicode). Do this with such flags as: .
2. Now that we have wxMac built it's time to set up Xcode and create a template for building apps with it. Instructions for that can be found here: http://wiki.wxwidgets.org/Creating_Xcod ... plications. Take note of a couple things on this page.
I always build in place so that I can have multiple builds of wx available to me. This means that when I set up my XCode Project, I need to open a terminal and navigate to the directory of the wx build I wish to use for that app build and get the appropriate flags with the scripts above.
Also, if you enabled universal binary when you configured that build of wx, you should drop the -arch flags from the output of the wx-config --cpp flaps and --libs flags when you copy and paste them into the target settings of your XCode project.
Test your sample code, and save the project as a template with an appropriate name for the type of build that you configured with wx.
3. Checkout MMEX from SVN.
4. Build MMEX right? Well, not quite. If you just added the source files to the XCode project and attempted to build, you would have numerous errors related to basic variables such as time and date. This is due to the code in the sql folder of the MMEX source tree conflicting with the installed Mac system libraries. My work around for this was to build all the code in the sql folder of the source tree as a bsd static library.
The following mailing list has a good write-up on how to do this. *Note* This is for a much earlier version of XCode and should be followed as a guide only: http://www.mail-archive.com/sqlite-user ... 15596.html
When setting up XCode for this project, remember to pass the following C flags to the bsd static library target:
5. Now we build MMEX right? Not quite. I don't recall why I did it this way, but I decided to create wxSQLite as a framework. This is fairly straight forward if you've created a framework before. I did this and the previous step in one project with two targets. One static bsd library built as above which was then a dependency of the wxsqlite framework (which requride all of one or two source files).
6. Now that we have our framework, we can include it in our MMEX.app Project. This is it time to build MMEX. The good news is that what we have done so far, will rarely need to be done again. The code in the sql folder of the source tree doesn't change very often, so most of the time all you will be doing is updating this project with the rest of the source files from the source tree and building. The tricky part for new XCode users is setting all the project settings. Make sure to enter your search paths for the headers (the include folder of the source tree), set the architecture for the build you want, copy the files from the source tree (excluding the sql folder), and copy the wxsqlite.framework into the xcode project.
You also need to include the framework in the final app bundle. Do this by going to Project->Add new build phase->New copy files build phase. Then drag the framework from the project files and groups tree to the copy files build phase.
Copy all the files from the runtime source tree folder to the Resources folder of the project files and groups tree.
Build and go.
That should be it. Hopefully this will help anyone who wishes to build on Mac. It took me about a month and a half to figure this out the first time and I didn't write this down, so when I went to do it again I had to recreate all this. If you find anything lacking in this guide, please, shoot me a pm and I will adjust it as needed.
Cheers,
Wesley
So, here are the steps I used to build MMEX on the Mac.
1. First, we need to build wxMac. We could have used the standard OS X installation of wxWidgets, but that is often many revisions behind the current stable release. Rather than have each Mac user build their own copy of wxWidgets as a shared library, I decided to use a static library and include the necessary code in the application bundle.
Download the latest stable release of wxMac from here:http://www.wxwidgets.org/downloads/
Follow the instruction here: http://wiki.wxwidgets.org/Compiling_wxW ... erminal%29 to build wxWidgets on the Mac. Don't forget the flags when configuring! I have built the copy that I am using with
Code: Select all
../configure --disable-shared --enable-universal_binary
Code: Select all
../configure --disable-shared --enable-monolithic --with-opengl --enable-universal_binary --enable-unicode
2. Now that we have wxMac built it's time to set up Xcode and create a template for building apps with it. Instructions for that can be found here: http://wiki.wxwidgets.org/Creating_Xcod ... plications. Take note of a couple things on this page.
Code: Select all
# if you left wxWidgets in-place
cd /path/to/wxWidgets/build-release
./wx-config --cppflags
./wx-config --libs
Also, if you enabled universal binary when you configured that build of wx, you should drop the -arch flags from the output of the wx-config --cpp flaps and --libs flags when you copy and paste them into the target settings of your XCode project.
Test your sample code, and save the project as a template with an appropriate name for the type of build that you configured with wx.
3. Checkout MMEX from SVN.
4. Build MMEX right? Well, not quite. If you just added the source files to the XCode project and attempted to build, you would have numerous errors related to basic variables such as time and date. This is due to the code in the sql folder of the MMEX source tree conflicting with the installed Mac system libraries. My work around for this was to build all the code in the sql folder of the source tree as a bsd static library.
The following mailing list has a good write-up on how to do this. *Note* This is for a much earlier version of XCode and should be followed as a guide only: http://www.mail-archive.com/sqlite-user ... 15596.html
When setting up XCode for this project, remember to pass the following C flags to the bsd static library target:
Code: Select all
-DSQLITE_CORE -DSQLITE_HAS_CODEC -DSQLITE_ENABLE_COLUMN_METADATA
6. Now that we have our framework, we can include it in our MMEX.app Project. This is it time to build MMEX. The good news is that what we have done so far, will rarely need to be done again. The code in the sql folder of the source tree doesn't change very often, so most of the time all you will be doing is updating this project with the rest of the source files from the source tree and building. The tricky part for new XCode users is setting all the project settings. Make sure to enter your search paths for the headers (the include folder of the source tree), set the architecture for the build you want, copy the files from the source tree (excluding the sql folder), and copy the wxsqlite.framework into the xcode project.
You also need to include the framework in the final app bundle. Do this by going to Project->Add new build phase->New copy files build phase. Then drag the framework from the project files and groups tree to the copy files build phase.
Copy all the files from the runtime source tree folder to the Resources folder of the project files and groups tree.
Build and go.
That should be it. Hopefully this will help anyone who wishes to build on Mac. It took me about a month and a half to figure this out the first time and I didn't write this down, so when I went to do it again I had to recreate all this. If you find anything lacking in this guide, please, shoot me a pm and I will adjust it as needed.
Cheers,
Wesley