Ignore:
Timestamp:
Jun 29, 2013 1:14:27 AM (10 years ago)
Author:
nanang
Message:

Work on JNI project:

  • Only use single SWIG C++ wrapper.
  • Initial work on pjsua_callback: added parser and auto proxy generation.
  • Updated SWIG typemaps: SWIG director, input output, array of pointer, etc.
Location:
pjproject/branches/projects/jni/pjsip-apps/src/jni
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/jni/pjsip-apps/src/jni

    • Property svn:ignore set to
      output
      yacctab.py
      lextab.py
      *.log
  • pjproject/branches/projects/jni/pjsip-apps/src/jni/Makefile

    r4541 r4549  
    1313MY_JNI_LDFLAGS   = -L$(MY_JDK)/lib -Wl,--kill-at 
    1414 
    15 # Choose C or C++ SWIG wrapper target, just for dev purpose. 
    16 # Note that C target doesn't support callback, and C++ target doesn't support nested class/struct. 
    17 SWIG_CPP_TARGET = 0 
    18  
    1915# Build settings 
    2016MY_CFLAGS        = $(PJ_CFLAGS) $(MY_JNI_CFLAGS) 
    21 MY_LDFLAGS       = $(PJ_LDFLAGS) $(PJ_LDLIBS) $(MY_JNI_LDFLAGS) 
     17MY_LDFLAGS       = $(PJ_LDFLAGS) $(PJ_LDLIBS) $(MY_JNI_LDFLAGS) -static-libstdc++ 
    2218 
    2319# Output/intermediate path settings 
     
    2521MY_OUT_DIR       = output 
    2622MY_SWIG_IF       = $(MY_OUT_DIR)/pjsua.i 
    27 MY_SWIG_FLAG     = -Wall 
     23MY_SWIG_FLAG     = -c++ -I$(MY_OUT_DIR) # -Wall 
    2824MY_SWIG_WRAPPER  = $(MY_OUT_DIR)/pjsua_wrap 
    29 MY_CALLBACKS     = callbacks 
    3025MY_PACKAGE_SRC   = $(MY_OUT_DIR)/src/$(subst .,/,$(MY_PACKAGE)) 
    3126MY_PACKAGE_BIN   = $(MY_OUT_DIR)/bin 
    3227MY_JNI_LIB       = $(MY_PACKAGE_BIN)/pjsua.dll 
    33  
    34 # Adjust setting for C/C++ 
    35 ifeq ($(SWIG_CPP_TARGET),1) 
    36 MY_CC            = $(PJ_CXX) 
    37 MY_LDFLAGS      += -static-libstdc++ 
    38 MY_SWIG_FLAG    += -c++ -debug-tmsearch -debug-tmused 
    39 else 
    40 MY_CC            = $(PJ_CC) 
    41 MY_SWIG_FLAG    += -debug-tmsearch -debug-tmused 
    42 endif 
    4328 
    4429all: $(MY_JNI_LIB) java 
     
    4732        rm -rf $(MY_OUT_DIR) 
    4833 
     34$(MY_SWIG_IF).tmp: swig_gen.py 
     35        @mkdir -p $(MY_OUT_DIR) 
     36        python swig_gen.py > $(MY_SWIG_IF).tmp 
     37 
    4938$(MY_SWIG_IF): header.i $(MY_SWIG_IF).tmp 
    5039        cat header.i > $(MY_SWIG_IF) 
    5140        cat $(MY_SWIG_IF).tmp >> $(MY_SWIG_IF) 
    5241 
    53 $(MY_SWIG_IF).tmp: swig_gen.py 
    54         @mkdir -p $(MY_OUT_DIR) 
    55         python swig_gen.py > $(MY_SWIG_IF).tmp 
    56  
    57 $(MY_SWIG_WRAPPER).c: $(MY_SWIG_IF) $(MY_CALLBACKS).h $(MY_CALLBACKS).cpp $(MY_CALLBACKS).i 
    58         # Cleanup java outdir first, to remove any old/deprecated java files 
     42$(MY_SWIG_WRAPPER).c: $(MY_SWIG_IF) callbacks.i my_typemaps.i 
     43        @# Cleanup java outdir first, to remove any old/deprecated java files 
    5944        rm -rf $(MY_PACKAGE_SRC) 
    6045        @mkdir -p $(MY_PACKAGE_SRC) 
    6146        $(MY_SWIG) $(MY_SWIG_FLAG) -o $(MY_SWIG_WRAPPER).c -package $(MY_PACKAGE) \ 
    62                 -outdir $(MY_PACKAGE_SRC) -java $(MY_SWIG_IF) > $(MY_SWIG_WRAPPER)-tm.txt 
    63         $(MY_SWIG) -c++ $(MY_SWIG_FLAG) -o $(MY_SWIG_WRAPPER)2.c -package $(MY_PACKAGE) \ 
    64                 -outdir $(MY_PACKAGE_SRC) -java $(MY_CALLBACKS).i > $(MY_SWIG_WRAPPER)2-tm.txt 
     47                -outdir $(MY_PACKAGE_SRC) -java $(MY_SWIG_IF) > $(MY_SWIG_WRAPPER)-tm.log 
    6548 
    66 $(MY_SWIG_WRAPPER).o: $(MY_SWIG_WRAPPER).c 
    67         $(MY_CC) -c $(MY_CFLAGS) $(MY_SWIG_WRAPPER).c -o $(MY_SWIG_WRAPPER).o 
    68         $(PJ_CXX) -c $(MY_CFLAGS) $(MY_SWIG_WRAPPER)2.c -o $(MY_SWIG_WRAPPER)2.o 
    69          
    70 $(MY_OUT_DIR)/$(MY_CALLBACKS).o: $(MY_CALLBACKS).cpp $(MY_CALLBACKS).h 
    71         $(PJ_CXX) -c $(MY_CFLAGS) $(MY_CALLBACKS).cpp -o $(MY_OUT_DIR)/$(MY_CALLBACKS).o 
    72  
    73 $(MY_JNI_LIB): $(MY_SWIG_WRAPPER).o $(MY_OUT_DIR)/$(MY_CALLBACKS).o 
     49$(MY_JNI_LIB): $(MY_SWIG_WRAPPER).c 
    7450        @mkdir -p $(MY_PACKAGE_BIN) 
    75         $(PJ_CXX) -shared -o $(MY_JNI_LIB) $(MY_SWIG_WRAPPER).o $(MY_OUT_DIR)/$(MY_CALLBACKS).o \ 
    76                 $(MY_SWIG_WRAPPER)2.o $(MY_LDFLAGS) -static-libstdc++ 
     51        $(PJ_CXX) -shared -o $(MY_JNI_LIB) $(MY_SWIG_WRAPPER).c $(MY_OUT_DIR)/callbacks.c \ 
     52                $(MY_CFLAGS) $(MY_LDFLAGS) 
    7753 
    7854java: hello.java 
     
    8258 
    8359test: $(MY_PACKAGE_BIN)/hello.class 
    84         # Need to specify classpath and library path, alternatively, they can be set via 
    85         # CLASSPATH and java.library.path env settings 
     60        @# Need to specify classpath and library path, alternatively, they can be set via 
     61        @# CLASSPATH and java.library.path env settings 
    8662        $(MY_JAVA) -cp $(MY_PACKAGE_BIN) -Djava.library.path="$(MY_PACKAGE_BIN)" hello 
Note: See TracChangeset for help on using the changeset viewer.