Changeset 4563


Ignore:
Timestamp:
Jul 15, 2013 5:34:14 AM (8 years ago)
Author:
bennylp
Message:
  • Attempt to autodetect JDK dir. If JAVA_HOME env is set, then it will be used. Otherwise it will try to locate JDK dir by finding the location of "javac".
  • Produce libpjsua.so on non-Windows (not sure if this works on Mac)
  • Hardcoded path for Linux in swig_gen.py
Location:
pjproject/branches/projects/jni/pjsip-apps/src/jni
Files:
2 edited

Legend:

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

    r4557 r4563  
    55include $(PJDIR)/build/common.mak 
    66 
     7# Get JDK location 
     8ifeq ("$(JAVA_HOME)","") 
     9  # Get javac location to determine JDK location 
     10  JAVAC_PATH = $(shell which javac) 
     11  ifeq ("$(JAVAC_PATH)","") 
     12    $(error Cannot determine JDK location using 'which' command. Please define JAVA_HOME envvar) 
     13  endif 
     14 
     15  JAVAC_PATH := $(realpath $(JAVAC_PATH)) 
     16  JAVA_BIN := $(dir $(JAVAC_PATH)) 
     17  JAVA_HOME := $(patsubst %/bin/,%,$(JAVA_BIN)) 
     18endif 
     19 
     20# OS specific 
     21ifeq ($(OS),Windows_NT) 
     22MY_JNI_LDFLAGS   = -L$(MY_JDK)/lib -Wl,--kill-at 
     23MY_JNI_LIB       = $(MY_PACKAGE_BIN)/pjsua.dll 
     24else 
     25MY_JNI_LDFLAGS   = -L$(MY_JDK)/lib -Wl,-soname,pjsua.so 
     26MY_JNI_LIB       = $(MY_PACKAGE_BIN)/libpjsua.so 
     27MY_JNI_CFLAGS    := -fPIC 
     28endif 
     29 
    730# Env settings, e.g: path to SWIG, JDK, java(.exe), javac(.exe) 
    831MY_SWIG          = swig 
    9 MY_JDK           = /c/Program\ Files\ \(x86\)/Java/jdk1.7.0_21 
    10 MY_JAVA          = $(MY_JDK)/bin/java.exe 
    11 MY_JAVAC         = $(MY_JDK)/bin/javac.exe 
    12 MY_JNI_CFLAGS    = -I$(MY_JDK)/include -I$(MY_JDK)/include/win32 -I. 
    13 MY_JNI_LDFLAGS   = -L$(MY_JDK)/lib -Wl,--kill-at 
     32MY_JDK           = $(JAVA_HOME) 
     33MY_JAVA          = $(MY_JDK)/bin/java 
     34MY_JAVAC         = $(MY_JDK)/bin/javac 
     35MY_JNI_CFLAGS    := $(MY_JNI_CFLAGS) -I$(MY_JDK)/include -I$(MY_JDK)/include/win32 \ 
     36                   -I$(MY_JDK)/include/linux -I. 
    1437 
    1538# Build settings 
     
    2548MY_PACKAGE_SRC   = $(MY_OUT_DIR)/src/$(subst .,/,$(MY_PACKAGE)) 
    2649MY_PACKAGE_BIN   = $(MY_OUT_DIR)/bin 
    27 MY_JNI_LIB       = $(MY_PACKAGE_BIN)/pjsua.dll 
    2850 
    2951all: $(MY_JNI_LIB) java 
  • pjproject/branches/projects/jni/pjsip-apps/src/jni/swig_gen.py

    r4557 r4563  
    1414#SOURCE_PATH  = PJ_ROOT_PATH + "pjlib/include/pj/types.h" 
    1515 
    16 # CPP (C preprocessor) settings, CPP is needed by pycparser. 
    17 CPP_PATH         = 'C:/devs/bin/cpp.exe' if sys.platform == 'win32' else 'cpp' 
     16# CPP is needed by pycparser. 
     17if sys.platform == 'win32': 
     18        PYCPARSER_DIR="C:/devs/tools/pycparser" 
     19        CPP_PATH='C:/devs/bin/cpp.exe' 
     20else: 
     21        PYCPARSER_DIR="/home/bennylp/Desktop/opt/src/pycparser-master" 
     22        CPP_PATH='cpp' 
     23 
     24# CPP (C preprocessor) settings 
    1825CPP_CFLAGS   = [ 
    19         r'-DPJ_AUTOCONF', 
    20         r'-DCC_DUMMY', 
    21         r'-Djmp_buf=int', 
    22         r'-IC:/devs/tools/pycparser/utils/fake_libc_include', 
     26        '-DPJ_AUTOCONF', 
     27        '-DCC_DUMMY', 
     28        '-U__GNUC__', 
     29        '-Djmp_buf=int', 
     30        '-I' + PYCPARSER_DIR + '/utils/fake_libc_include', 
    2331        "-I" + PJ_ROOT_PATH + "pjlib/include", 
    2432        "-I" + PJ_ROOT_PATH + "pjlib-util/include", 
Note: See TracChangeset for help on using the changeset viewer.