you ‧ notes ‧ unread ‧ starred ‧ add url

Geo-preneur - Debugging Makefile-based projects using XCode...

http://blog.burhum.com/post/35555678746/debugging-makefile-based-projects-using-xcode

january 2017 ‧ autoconf gnu linux mac make xcode ‧ open in karakeep

by rburhum ‧ Geo-preneur ‧ published 2012.11.12 ‧ saved copy from 2026.03.02

Karakeep has no AI summary for this page yet. summarize now

page description:

I love using XCode to write C++. Nevertheless, many of the projects I use a lot (like GDAL) don’t maintain XCode projects. Compiling these type of projects usually is usually done with autoconf and GNUMakefiles. The usual workflow takes this form from the command line: ./configure ./make ./make install But what if I want to use XCode? Here is a quick way I use to get up and running with XCode 4.5.2 Let’s use GDAL as an example. Create a new XCode project 1.- File->New Project 2.- Choose Application -> Command Line Tool. Call it something meaningful like gdal-trunk (uncheck use automatic reference counting). 3.- Delete the Target Checkout the version you want from GDAL and compile it with debug First, we need to make sure that our project is compiled with the -g flag so debugging information is included. For GDAL, this is accomplished with the –enable-debug flag. Personally, I also like to keep my debug build separate from the rest of my system. So I also specify a build directory using the –prefix flag. These are the commands I use in the command line: svn checkout https://svn.osgeo.org/gdal/trunk/gdal gdal cd gdal ./configure --enable-debug --prefix=/Users/rburhum/src/gdal-xcode/gdal-trunk/build make make install Setup XCode to show GDAL source and call the makefile every time we build 1.- While highlighting the project: File->New Taget. Under OSX -> Other, choose “External Build System”. Pick a target name like “gdal_target”. Finish. 2.- Click on the new target, select info. Make sure the directory there has the root directory that has your makefile. In my case /Users/rburhum/src/gdal-xcode/gdal 3.- Product->Edit Scheme. Under Build->Build hit the “+” and add the new target you just created. This will make sure that make gets called. But with GDAL, you will need to have the code installed again after every compilation (a different topic for another day). So we will need to trigger that behavior: 4.- Under Post Actions, add the following script: cd /Users/rburhum/src/gdal-xcode/gdal /usr/bin/make install Setup XCode to call the executable you want to debug Almost there! The last step missing is to add the executable you want to debug. Let’s say that it is ogrinfo. While still on the Edit Scheme window. Choose Run. Under Info, browse and pick ogrinfo from your build directory. Under Arguments, choose whatever you may want to pass to ogrinfo (in my case: -al /Users/rburhum/Applications/geoserver-2.1.3/data_dir/data/nyc/poi.shp Add the GDAL source tree to XCode Right click on your Project and Choose “Add files to gdal-trunk”. Make sure you choose “Create Folder References” and that “Copy items into destination folder” is unchecked. Browse to the root of the GDAL directory and pick it. You are done! Put your breakpoints, change your code and whenever you hit run/debug, XCode will compile the new code and run it inside XCode.
screenshot of the page

« back to bookmarks

top tags     all tags ‧ 2 ‧ 5 ‧ 10 ‧ 20 ‧ manage

*bookmark *download *tobuy *tofollow *toread *wishlist 2d 360 3d 3dprinting 3g abandonware accounting actionscript ai air airplay algorithm android animation api app apple appstore arcade arduino art article askreddit asm assembler audio automation baby backlight backup bambulab bbs berlin bitcoin bivert blipfm blipster blog blu-ray bluetooth book bookmark bootcamp boxee brasil brazil bruno bug bugtracking buildapc business c c# c++ carro casa cell chart chiptune chiptunes citypop claudeai cliq cocoa cocoa-touch code collection component controller cooking core-graphics crt css curso database ddwrt debug demoscene design deutschland dev developer development diy dj dns doc dos dosbox dotnet download dreamcast drink drm ds dvb-c dvd ebook electronics emu emudev emulation emulator engine example expedition33 facebook famicom feedbin firmware fix flash flashcart flex fluorine forum framework freeware gadget game gameboy gameboy-pocket gamecollecting gamedesign gamedev gamegear games gaming gba genesis german germany git google googlemaps GoogleReader gps gsm gui guide hack hacks hamburg hardware home home-automation homeassistant homeautomation homebrew honda howto html htpc http icon IFTTT ikea image imported indie inspiration install insteon interview ios iosprogramming ipad iphone iptv iso itunes jailbreak japan japantravel java javascript job keyboard lastfm lcd lib library linux live lldb localization london mac macos mame management mapkit mastersystem math mce media mediacenter megadrive memory-management miami midi mod movie mp3 mpd msn music mythtv nas nes network nvidia nyc objective-c opengl opengles opensource osx pc pcb perlerbeads php physics piracy plex plugin Pocket portfolio prepaid programming project ps1 ps2 ps3 ps4 psp puremvc push pvr python raspberrypi recalbox recipe reddit reddit-comment reddit-post region remote repro resource restaurante retrogaming retrograming retropc retropie rgb rip rom roms router ruby rubyonrails saopaulo scart science scumm sdk security seedbox serial server shmups shop shopping sim sms snes software sonos sound soundblaster soundtrack source spotify sql sqlite star startup steamdeck store stream subtitles svn swift sync synology synth tax technology terminal three20 tips todayilearned tool tools toread torrent tracker travel trip tutorial tweak twitter twitter-post ubuntu ui uitableview unix unlock uremote usa veralite viagem video vista vita vpn vps vst walkthrough warez web2.0 webdesign webradio webservices wifi wii wiiu windows wishlist wordpress xbmc xbox xcode xml xna youtube z-wave z80 zigbee