2011년 3월 23일 수요일

Creating a WXWidgets template in XCode


Apple appears to be encouraging people to move toward Cocoa and stop using Carbon.  wxCocoa is in pretty good shape so I've stopped using wxCarbon a few months ago.
Here's how I build the library:
# Build the library for Cocoa

rm -rf build-cocoa-debug
mkdir build-cocoa-debug
cd build-cocoa-debug
../configure --enable-unicode --enable-debug --disable-shared
--with-osx_cocoa
make;cd ..

# Build the samples and demos
cd build-cocoa-debug/samples; make;cd ../..
cd build-cocoa-debug/demos;   make;cd ../..

# Use Finder to run some of the samples to prove to yourself they work
# Then copy one of the samples to your own directory and compile it like
this
  Create an empty directory
  Add the source code files *.h, *.cpp, etc.
  You may also need sample.xpm if it is included in your main .cpp file
  Start XCode
  File, New Project...
  Application, Cocoa Application
  Next
  Set Project Name
  Set Project Directory to be the directory with the source code files.
  Finish
  The project window should appear
  Highlight main.m and delete it
  Change the configuration from "Release" to "Debug"
  Project, Add To Project...
  Highlight all of the .cpp files in the directory
  Add, Add
  Open a terminal window
cd wx/build-cocoa-debug
    ./wx-config --cxxflags   
    ./wx-config --libs
    
It is critical that you use ./wx-config not wx-config in those two
lines.
    You will copy the output of those two lines into Xcode in the next
steps.
  Go back to Xcode
  Click the "info" icon (blue circle with white i)
  Choose the "Build" tab
  Set the Configuration to "Debug"
  Set Show to "All Settings"
  In the Linking section,
    Uncheck ZeroLink
    Set Other Linker Flags to the output of --libs from the terminal window
  In the GCC Code Generation Section
    Uncheck Inline Methods Hidden
    Uncheck Symbols Hidden by Default
    Set Other C Flags to the output of --cxxflags from the terminal window
  In the Packaging section
    Set Product Name to a suitable name
  Close the configuration window
  Return to the project window
  Click Build and Go icon (green circle with hammer)
Thanks,

댓글 없음: