66 |
|
</path> |
67 |
|
|
68 |
|
|
69 |
– |
|
69 |
|
<!-- Main targets --> |
70 |
|
|
71 |
|
|
620 |
|
</java> |
621 |
|
</target> |
622 |
|
|
623 |
+ |
|
624 |
+ |
|
625 |
+ |
<!-- C++ and JNI definitions and demos --> |
626 |
+ |
|
627 |
+ |
<target name="configure-cpp"> |
628 |
+ |
|
629 |
+ |
<!-- Define tasks and types --> |
630 |
+ |
|
631 |
+ |
<path id="cpptasks.path"> |
632 |
+ |
<pathelement location="${lib.dir}/cpptasks.jar"/> |
633 |
+ |
</path> |
634 |
+ |
<taskdef resource="cpptasks.tasks" classpathref="cpptasks.path"/> |
635 |
+ |
<typedef resource="cpptasks.types" classpathref="cpptasks.path"/> |
636 |
+ |
|
637 |
+ |
<!-- Set platform property for JNI includes --> |
638 |
+ |
|
639 |
+ |
<condition property="platform" value="linux"> |
640 |
+ |
<os name="Linux"/> |
641 |
+ |
</condition> |
642 |
+ |
<condition property="platform" value="win32"> |
643 |
+ |
<os family="windows"/> |
644 |
+ |
</condition> |
645 |
+ |
<condition property="platform" value="solaris"> |
646 |
+ |
<os name="SunOS"/> |
647 |
+ |
</condition> |
648 |
+ |
|
649 |
+ |
</target> |
650 |
+ |
|
651 |
+ |
|
652 |
+ |
<target name="cppdemo" depends="configure-cpp"> |
653 |
+ |
|
654 |
+ |
<mkdir dir="${build.dir}"/> |
655 |
+ |
|
656 |
+ |
<cc multithreaded="true" |
657 |
+ |
name="g++" |
658 |
+ |
objdir="${build.dir}" |
659 |
+ |
outfile="${build.dir}/CppDemo"> |
660 |
+ |
<fileset dir="${test.src.dir}" includes="CppDemo.cpp"/> |
661 |
+ |
<libset libs="stdc++"/> |
662 |
+ |
</cc> |
663 |
+ |
|
664 |
+ |
<exec executable="${build.dir}/CppDemo"> |
665 |
+ |
<arg line="count in word frequency of word in command line count"/> |
666 |
+ |
</exec> |
667 |
+ |
|
668 |
+ |
</target> |
669 |
+ |
|
670 |
+ |
|
671 |
+ |
<target name="jnidemo" depends="init, configure-compiler, configure-cpp"> |
672 |
+ |
|
673 |
+ |
<mkdir dir="${build.testcases.dir}"/> |
674 |
+ |
|
675 |
+ |
<javac srcdir="${test.src.dir}" |
676 |
+ |
destdir="${build.testcases.dir}" |
677 |
+ |
debug="${build.debug}" |
678 |
+ |
debuglevel="${build.debuglevel}" |
679 |
+ |
deprecation="${build.deprecation}" |
680 |
+ |
source="${build.sourcelevel}" |
681 |
+ |
fork="true"> |
682 |
+ |
<compilerarg value="${bootclasspath.args}"/> |
683 |
+ |
<compilerarg line="${build.args}"/> |
684 |
+ |
<classpath refid="test.classpath"/> |
685 |
+ |
<include name="JniDemo.java"/> |
686 |
+ |
</javac> |
687 |
+ |
|
688 |
+ |
<javah destdir="${build.testcases.dir}" |
689 |
+ |
classpathref="test.classpath"> |
690 |
+ |
<class name="JniDemo"/> |
691 |
+ |
</javah> |
692 |
+ |
|
693 |
+ |
<cc multithreaded="true" |
694 |
+ |
name="g++" |
695 |
+ |
objdir="${build.dir}" |
696 |
+ |
outfile="${build.dir}/JniDemo" |
697 |
+ |
outtype="shared"> |
698 |
+ |
|
699 |
+ |
<compiler> |
700 |
+ |
<defineset> |
701 |
+ |
<define name="__int64" value="long long"/> |
702 |
+ |
</defineset> |
703 |
+ |
<includepath location="${java.home}/../include"/> |
704 |
+ |
<includepath location="${java.home}/../include/${platform}"/> |
705 |
+ |
<compilerarg value="-mno-cygwin"/> |
706 |
+ |
</compiler> |
707 |
+ |
|
708 |
+ |
<linker> |
709 |
+ |
<linkerarg value="--add-stdcall-alias"/> |
710 |
+ |
</linker> |
711 |
+ |
|
712 |
+ |
<includepath location="${build.testcases.dir}"/> |
713 |
+ |
|
714 |
+ |
<fileset dir="${test.src.dir}" includes="JniDemo.cpp"/> |
715 |
+ |
|
716 |
+ |
<libset libs="stdc++"/> |
717 |
+ |
|
718 |
+ |
</cc> |
719 |
+ |
|
720 |
+ |
<!-- Necessary if windows, harmless if not --> |
721 |
+ |
<copy file="${build.dir}/libJniDemo.so" tofile="${build.dir}/JniDemo.dll"/> |
722 |
+ |
|
723 |
+ |
<java classname="JniDemo" fork="true"> |
724 |
+ |
<!-- Watch out: path separator hardwired to semicolon here! --> |
725 |
+ |
<sysproperty key="java.library.path" path="${java.library.path};${build.dir}"/> |
726 |
+ |
<classpath refid="test.classpath"/> |
727 |
+ |
</java> |
728 |
+ |
|
729 |
+ |
</target> |
730 |
+ |
|
731 |
|
|
732 |
|
|
733 |
|
<!-- Backward compatibility, work in progress (some files not checked in) --> |