Setting up C++ Cinder Project from scratch with Make

550 views Asked by At

I recently downloaded the pre-built version of Cinder for OSX, and was surprised to see how tightly it's tied in with Xcode. I've been trying to get the first part of "Hello Cinder" built and linked using a simple Makefile, but haven't been able to figure out all the directories that need to be included and libraries linked. Has anyone attempted this before, and do you have an example of a Makefile that properly sets up the include and library dependencies to get a simple Cinder app running?

cinder.cpp:

#include "cinder/app/AppNative.h"                                                
#include "cinder/gl/gl.h"                                                        

using namespace ci;                                                              
using namespace ci::app;                                                         
using namespace std;                                                             

class CinderProjectApp : public AppNative {                                      
  public:                                                                        
   void setup();                                                                 
   void mouseDown( MouseEvent event );                                           
   void update();                                                                
   void draw();                                                                  
};                                                                               

void CinderProjectApp::setup()                                                   
{                                                                                
}                                                                                

void CinderProjectApp::mouseDown( MouseEvent event )                             
{                                                                                
}                                                                                

void CinderProjectApp::update()                                                  
{                                                                                
}                                                                                

void CinderProjectApp::draw()                                                    
{                                                                                
   // clear out the window with black                                            
   gl::clear( Color( 0, 0, 0 ) );                                                
}                                                                                

CINDER_APP_NATIVE( CinderProjectApp, RendererGl )

My current makefile:

CXX=clang                                                                        
CINDER_INSTALL = /usr/local/src/cinder_0.8.6_mac                                 
CXX_FLAGS=-std=c++11 -stdlib=libc++ -m64                                         
CXX_PATH =-I$(CINDER_INSTALL)/include/ -I$(CINDER_INSTALL)/boost/ -L$(CINDER_INSTALL)/lib/ -L$(CINDER_INSTALL)/lib/macosx/ -L/System/Library/Frameworks/OpenGL.framework/Libraries/
LLIBS =-lboost_date_time -lboost_filesystem -lboost_system -lz -lcinder -lGL     

cinder.o:                                                                        
   $(CXX) $(CXX_FLAGS) $(CXX_PATH) $(LLIBS) -c  src/cinder.cpp                   

cinder: cinder.o                                                                 
   $(CXX) $(CXX_FLAGS) $(CXX_PATH) $(LLIBS) -o  cinder cinder.o   

Current output:

smithj1@signal: make cinder
clang -std=c++11 -stdlib=libc++ -m64 -I/usr/local/src/cinder_0.8.6_mac/include/ -I/usr/local/src/cinder_0.8.6_mac/boost/ -L/usr/local/src/cinder_0.8.6_mac/lib/ -L/usr/local/src/cinder_0.8.6_mac/lib/macosx/ -L/System/Library/Frameworks/OpenGL.framework/Libraries/  -lboost_date_time -lboost_filesystem -lboost_system -lz -lcinder -lGL   -c  src/cinder.cpp
clang: warning: -lboost_date_time: 'linker' input unused
clang: warning: -lboost_filesystem: 'linker' input unused
clang: warning: -lboost_system: 'linker' input unused
clang: warning: -lz: 'linker' input unused
clang: warning: -lcinder: 'linker' input unused
clang: warning: -lGL: 'linker' input unused
clang: warning: argument unused during compilation: '-L/usr/local/src/cinder_0.8.6_mac/lib/'
clang: warning: argument unused during compilation: '-L/usr/local/src/cinder_0.8.6_mac/lib/macosx/'
clang: warning: argument unused during compilation: '-L/System/Library/Frameworks/OpenGL.framework/Libraries/'
clang -std=c++11 -stdlib=libc++ -m64 -I/usr/local/src/cinder_0.8.6_mac/include/ -I/usr/local/src/cinder_0.8.6_mac/boost/ -L/usr/local/src/cinder_0.8.6_mac/lib/ -L/usr/local/src/cinder_0.8.6_mac/lib/macosx/ -L/System/Library/Frameworks/OpenGL.framework/Libraries/  -lboost_date_time -lboost_filesystem -lboost_system -lz -lcinder -lGL   -o  cinder cinder.o 
Undefined symbols for architecture x86_64:
  "_AudioComponentFindNext", referenced from:
      cinder::audio::cocoa::findAudioComponent(AudioComponentDescription const&) in libcinder.a(libcinder.a-x86_64-master.o)
      cinder::audio::cocoa::findAndCreateAudioComponent(AudioComponentDescription const&, ComponentInstanceRecord**) in libcinder.a(libcinder.a-x86_64-master.o)
  "_AudioComponentInstanceDispose", referenced from:

(ETC...)
0

There are 0 answers