C++ Logging and building Boost for iPhone/iPad 3.2 and MacOSX
来源:互联网 发布:淘宝怎么设置首单包邮 编辑:程序博客网 时间:2024/06/05 20:33
- Get Boost 1.42
- Extract Boost:
- Create a user-config.jam file in your user directory (~/user-config.jam) such as /Users/paulsolt/user-config.jam with the following. (Note: this config file needs to be rename or moved during the MacOSX bjam build)
~/user-config.jam - Make sure the file boost_1_42_0/tools/build/v2/tools/darwin.jam has the following information:
- Change directories to the Boost directory that you downloaded:
- Run the following commands to compile the iPhone and iPhone Simulator Boost libraries. I only need filesystem, system, and thread to be use Boost logging for the iPhone, so I don’t build everything. Run ./bootstrap.sh –help or ./bjam –help for more options. I built the binaries to a location in my development folder to include in my project dependencies.
- Update: Create a universal Boost Library using the lipo tool. In this example I’m assuming the binaries that were created have the following names. The names from the bjam generation will be different, based on your own configuration.End Update
- I’m working on a cross-platform project and my directory structure looks like the following structure. I copied the include and lib files for iPhone and iPhone Simulator into the appropriate directories. The dependency structure allows me to checkout the project on another machine and have relative references to Boost and other dependencies.
- Download the Boost Logging Library v2 and unzip it.
- Copy and paste the logging folder into each include/boost folder for iPhone and iPhone Simulator dependency folders like in my directory structure. After you unzip the header files are located in the folder logging/boost/logging.
Step 2: Creating the Xcode Project
With the iPhone and iPhone Simulator Boost libraries in hand we’re ready to make an Xcode project. Due to the difference in the iPhone and iPhone Simulator libraries we’ll need to make two targets. One will build linking against the iPhone Boost libraries (arm) and the other against the iPhone Boost Simulator libraries (x86).
Update: You don’t need to create two targets, as we can use the lipo tool to make a universal iPhone/iPhone Simulator library file. The universal library file can be shared between iPhone and iPhone Simulator build configurations. See the instructions for using lipo to create the universal library files in the previous section. However, I will keep the two target instructions up as an alternate approach for Xcode project development, if you choose not to use the lipo tool.
End Update
1. Create a new iPhone project (view based)
2. There will be two targets: “BoostLoggingTest Device” and “BoostLogging Test Simulator” each will reference different headers and libraries. Duplicate the starting target and rename each target respectively.
3. Add the libraries that we compiled into two groups: device and simulator under Resources. Right-click on the group “Simulator” or “Device” and select “Add Existing Files”. Search for the library .a files that you copied into the iphone and iphone-simulator directories. These resources should be added relative to the project folder.
4. Drag the appropriate libraries to each Target. We need two targets since the architecture is different on the iPhone device (arm) versus the iPhone Simulator (Intel x86).
5. Add the “Header Search Path” for each target. For me the relative path will be two directories up from the Xcode project folders: ../../dependencies/iphone/release/includeand ../../dependencies/iphone-simulator/release/include. Right-click on each Target in the left pane and click on “Get Info” -> Build -> Type “Header” in the search field -> Edit the list of paths.
6. Change the base SDK of each target. For the Device you need to use iPhone Device 3.2and the Simulator Target needs iPhone Simulator 3.2 or later.
7. Now you have two different targets. One is for the iPhone Device and the other is for the iPhone Simulator. We did this because we built separate binaries for Boost on the iPhone (arm) and simulator (x86) platforms.
8. Set the project’s Active SDK to use the Base SDK (top left of Xcode). Now it will automatically choose the iPhone Device or iPhone Simulator based on the Base SDK of each Target you select.
9. Logging on the iPhone requires that we use the full path to the file within the application sandbox. Use the following Objective-C code to get it:
10. I modified one of the Boost Logging samples to use the full file path on the iPhone. Rename the main.m as main.mm to use Objective-C/C++ and copy paste the following: main.mm code
11. If everything compiled and ran on the Device you can get the application data from the Xcode Organizer (Option+Command+O) Navigate to Devices and then look in Applications for the test application. Just drag the “Application Data” to your desktop to download it from the device. Your logs should appear in the Documents folder.
Part 3: Build Boost for Mac OS X 10.6 – 4 way fat (32/64 PPC and 32/64 Intel)
1. Build boost for Mac OS X. Note: If you setup the user-config.jam file for iPhone Boost build, rename or move the file to a different folder than your home directory, otherwise ignore this command.
2. Copy the output into your dependency structure and add the Boost Logging Library headers into the include/boost folder. (Same procedure as with iPhone)
3. Setup a Xcode project or target with the appropriate header search path, Boost Mac OSX libraries in the same way we setup the iPhone Xcode project.
Note: If you get warnings about hidden symbols and default settings open the Xcode project for and make sure that the “Inline Methods Hidden” and “Symbols Hidden by Default” are unchecked. Clicking on/off might fix any Xcode warnings.
- C++ Logging and building Boost for iPhone/iPad 3.2 and MacOSX
- 网络电话pjsip Getting Started: Building for Apple iPhone, iPad and iPod Touch
- Developing iOS7 Apps For iPhone and iPad
- Icons and launch images for iPhone and iPad apps
- Automatic orientation support for iPhone and iPad apps
- App Icons on iPad and iPhone for iOS7
- Developing IOS 7 Apps for iPhone and iPad (Lecture 10)
- Build or Compile Linphone from Source for iPhone and iPad
- [学习小结]developing iOS7 for iPhone and iPad 1~5
- Building OpenSSL for iOS (iPhone/iPad)
- Xcode resource groups and folder references when building for iPhone
- HeadFirst iPhone and iPad Development
- Best Practices for Creating and Deploying HTTP Live Streaming Media for the iPhone and iPad
- App Icons on iPad and iPhone
- App Icons on iPad and iPhone
- App Icons on iPad and iPhone
- App Icons on iPad and iPhone
- Playing Video on the iPhone and iPad
- js 同名数组对象的选择
- 从B树、B+树、B*树谈到R 树
- SQL ERROR 17002
- jQuery slideToggle轻松实现效果不错的垂直下拉菜单
- C++中new和malloc的区别
- C++ Logging and building Boost for iPhone/iPad 3.2 and MacOSX
- vs2008\drivers\opengl_1.h.c_搭建环境
- 乐观锁和悲观锁
- 线程池使用样例
- 如何打jar包(静态jar包和可执行jar包)
- sql server 数据库备份存储过程
- 二分查找算法的时间复杂度
- 解决django开发中CSRF verification failed. Request aborted.的问题
- 使用JSONObject对JSON字符串转对象时重复value的结果