Changes between Version 10 and Version 11 of Getting-Started/Windows


Ignore:
Timestamp:
Apr 28, 2009 5:25:49 PM (10 years ago)
Author:
ismangil
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Getting-Started/Windows

    v10 v11  
    7171== Using pjproject libraries for your own application == 
    7272 
     73Regardless 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: 
    7374 
     75   1. Put these include directories in the include search path: 
     76          * pjlib/include 
     77          * pjlib-util/include 
     78          * pjnath/include 
     79          * pjmedia/include 
     80          * pjsip/include 
     81   2. Put these library directories in the library search path: 
     82          * pjlib/lib 
     83          * pjlib-util/lib 
     84          * pjnath/lib 
     85          * pjmedia/lib 
     86          * pjsip/lib 
     87   3. 
     88 
     89      Include the relevant PJ header files in the application source file. For example, using these would include ALL APIs exported by PJ: 
     90         #include <pjlib.h> 
     91         #include <pjlib-util.h> 
     92         #include <pjnath.h> 
     93         #include <pjsip.h> 
     94         #include <pjsip_ua.h> 
     95         #include <pjsip_simple.h> 
     96         #include <pjsua-lib/pjsua.h> 
     97         #include <pjmedia.h> 
     98         #include <pjmedia-codec.h> 
     99 
     100      (Note: the documentation of the relevant libraries should say which header files should be included to get the declaration of the APIs). 
     101   4. 
     102 
     103      Declare the OS macros. 
     104          * 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). 
     105          * For Windows Mobile applications build with Visual C++, we need to declare PJ_WIN32_WINCE=1 macro in the project settings. 
     106          * For GNU build system/autoconf based build system, we need to declare PJ_AUTOCONF=1 macro when compiling the applications. 
     107 
     108      (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). 
     109   5. 
     110 
     111      Link with the appropriate PJ libraries. The following libraries will need to be included in the library link specifications: 
     112 
     113      pjlib 
     114          Base library used by all libraries.  
     115      pjlib-util 
     116          Auxiliary library containing scanner, XML, STUN, MD5, getopt, etc, used by the SIP and media stack.  
     117      pjnath 
     118          NAT helper library (STUN, TURN, ICE).  
     119      pjsip 
     120          SIP core stack library.  
     121      pjsip-ua 
     122          SIP user agent library containing INVITE session, call transfer, client registration, etc.  
     123      pjsip-simple 
     124          SIP SIMPLE library for base event framework, presence, instant messaging, etc.  
     125      pjsua 
     126          High level SIP UA library, combining SIP and media stack into high-level easy to use API.  
     127      pjmedia 
     128          The media framework.  
     129      pjmedia-codec 
     130          Container library for various codecs such as GSM, Speex, and iLBC.  
     131 
     132        
     133 
     134      Note: the actual library names will be appended with the target name and the build configuration. For example: 
     135 
     136      For Visual Studio builds 
     137 
     138          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. 
     139 
     140          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. 
     141      For Windows Mobile builds 
     142 
     143          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. 
     144 
     145          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. 
     146      For GNU builds 
     147 
     148          Use the template Makefile below (as described in Building Application using PJSIP with GNU Tools): 
     149          # Modify this to point to the PJSIP location. 
     150          PJBASE=/home/myself/pjproject-0.5.10.2 
     151 
     152          include $(PJBASE)/build.mak 
     153 
     154          CC      = $(APP_CC) 
     155          LDFLAGS = $(APP_LDFLAGS) 
     156          LDLIBS  = $(APP_LDLIBS) 
     157          CFLAGS  = $(APP_CFLAGS) 
     158          CPPFLAGS= ${CFLAGS} 
     159 
     160          # If your application is in a file named myapp.cpp or myapp.c 
     161          # this is the line you will need to build the binary. 
     162          all: myapp 
     163 
     164          myapp: myapp.cpp 
     165                   $(CC) -o $@ $< $(CPPFLAGS) $(LDFLAGS) $(LDLIBS) 
     166 
     167          clean: 
     168                  rm -f myapp.o myapp 
     169 
     170        
     171   6. 
     172 
     173      Link with system spesific libraries: 
     174 
     175      Windows 
     176 
     177          Add (among other things): wsock32.lib, ws2_32.lib, ole32.lib, dsound.lib 
     178      Linux, *nix, *BSD 
     179 
     180          Add (among other things): '-lpthread -lm' (at least). If you use the template Makefile above, these would have been added by PJ. 
     181      MacOS X 
     182 
     183          Add (among other things): '-framework CoreAudio -lpthread -lm'. If you use the template Makefile above, these would have been added by PJ. 
     184 
     185