Changes between Version 2 and Version 3 of Getting-Started/Autoconf


Ignore:
Timestamp:
Apr 28, 2009 5:26:51 PM (15 years ago)
Author:
ismangil
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Getting-Started/Autoconf

    v2 v3  
    143143export LDFLAGS += 
    144144 
     145== Using in your applications == 
     146 
     147[wiki:Getting_Started_Using] 
     148 
     149Regardless of the build system being used, the following tasks are normally needed to be done in order to build application to use PJSIP and PJMEDIA: 
     150 
     151   1. Put these include directories in the include search path: 
     152          * pjlib/include 
     153          * pjlib-util/include 
     154          * pjnath/include 
     155          * pjmedia/include 
     156          * pjsip/include 
     157   2. Put these library directories in the library search path: 
     158          * pjlib/lib 
     159          * pjlib-util/lib 
     160          * pjnath/lib 
     161          * pjmedia/lib 
     162          * pjsip/lib 
     163   3. 
     164 
     165      Include the relevant PJ header files in the application source file. For example, using these would include ALL APIs exported by PJ: 
     166         #include <pjlib.h> 
     167         #include <pjlib-util.h> 
     168         #include <pjnath.h> 
     169         #include <pjsip.h> 
     170         #include <pjsip_ua.h> 
     171         #include <pjsip_simple.h> 
     172         #include <pjsua-lib/pjsua.h> 
     173         #include <pjmedia.h> 
     174         #include <pjmedia-codec.h> 
     175 
     176      (Note: the documentation of the relevant libraries should say which header files should be included to get the declaration of the APIs). 
     177   4. 
     178 
     179      Declare the OS macros. 
     180          * For Windows applications built with Visual Studio, we need to declare PJ_WIN32=1 macro in the project settings (declaring the macro in the source file may not be sufficient). 
     181          * For Windows Mobile applications build with Visual C++, we need to declare PJ_WIN32_WINCE=1 macro in the project settings. 
     182          * For GNU build system/autoconf based build system, we need to declare PJ_AUTOCONF=1 macro when compiling the applications. 
     183 
     184      (Note: the old PJ build system requires declaring the target processor with PJ_M_XXX=1 macro, but this has been made obsolete. The target processor will be detected from compiler's predefined macro by pjlib/config.h file). 
     185   5. 
     186 
     187      Link with the appropriate PJ libraries. The following libraries will need to be included in the library link specifications: 
     188 
     189      pjlib 
     190          Base library used by all libraries.  
     191      pjlib-util 
     192          Auxiliary library containing scanner, XML, STUN, MD5, getopt, etc, used by the SIP and media stack.  
     193      pjnath 
     194          NAT helper library (STUN, TURN, ICE).  
     195      pjsip 
     196          SIP core stack library.  
     197      pjsip-ua 
     198          SIP user agent library containing INVITE session, call transfer, client registration, etc.  
     199      pjsip-simple 
     200          SIP SIMPLE library for base event framework, presence, instant messaging, etc.  
     201      pjsua 
     202          High level SIP UA library, combining SIP and media stack into high-level easy to use API.  
     203      pjmedia 
     204          The media framework.  
     205      pjmedia-codec 
     206          Container library for various codecs such as GSM, Speex, and iLBC.  
     207 
     208        
     209 
     210      Note: the actual library names will be appended with the target name and the build configuration. For example: 
     211 
     212      For Visual Studio builds 
     213 
     214          The actual library names will look like pjlib-i386-win32-vc6-debug.lib, pjlib-i386-win32-vc6-release.lib, etc., depending on whether we are building the Debug or Release version of the library. 
     215 
     216          An easier way to link with the libraries is to include PJ project files in the workspace, and to configure project dependencies so that the application depends on the PJ libraries. This way, we don't need to manually add each PJ libraries to the input library file specification, since VS will automatically link the dependency libraries with the application. 
     217      For Windows Mobile builds 
     218 
     219          Unfortunately the PJ libraries built for Windows Mobile will not be placed in the usual lib directory, but rather under the output directory under build/wince-evc4 project directory. 
     220 
     221          An easier way to link with the libraries is to include PJ project files in the workspace, and to configure project dependencies so that the application depends on the PJ libraries. This way, we don't need to manually add each PJ libraries to the input library file specification, since VS will automatically link the dependency libraries with the application. 
     222      For GNU builds 
     223 
     224          Use the template Makefile below (as described in Building Application using PJSIP with GNU Tools): 
     225          # Modify this to point to the PJSIP location. 
     226          PJBASE=/home/myself/pjproject-0.5.10.2 
     227 
     228          include $(PJBASE)/build.mak 
     229 
     230          CC      = $(APP_CC) 
     231          LDFLAGS = $(APP_LDFLAGS) 
     232          LDLIBS  = $(APP_LDLIBS) 
     233          CFLAGS  = $(APP_CFLAGS) 
     234          CPPFLAGS= ${CFLAGS} 
     235 
     236          # If your application is in a file named myapp.cpp or myapp.c 
     237          # this is the line you will need to build the binary. 
     238          all: myapp 
     239 
     240          myapp: myapp.cpp 
     241                   $(CC) -o $@ $< $(CPPFLAGS) $(LDFLAGS) $(LDLIBS) 
     242 
     243          clean: 
     244                  rm -f myapp.o myapp 
     245 
     246        
     247   6. 
     248 
     249      Link with system spesific libraries: 
     250 
     251      Windows 
     252 
     253          Add (among other things): wsock32.lib, ws2_32.lib, ole32.lib, dsound.lib 
     254      Linux, *nix, *BSD 
     255 
     256          Add (among other things): '-lpthread -lm' (at least). If you use the template Makefile above, these would have been added by PJ. 
     257      MacOS X 
     258 
     259          Add (among other things): '-framework CoreAudio -lpthread -lm'. If you use the template Makefile above, these would have been added by PJ. 
     260 
     261