Пример #1
0
  public static void main(String[] args) throws Exception {
    // generate C/C++ code
    new NativeCodeGenerator()
        .generate("src", "bin", "jni", new String[] {"**/MyJniClass.java"}, null);

    // generate build scripts, for win32 only
    BuildConfig buildConfig = new BuildConfig("test");
    BuildTarget win32 = BuildTarget.newDefaultTarget(TargetOs.Windows, false);
    win32.compilerPrefix = "";
    win32.cppFlags += " -g";
    new AntScriptGenerator().generate(buildConfig, win32);

    // build natives
    BuildExecutor.executeAnt("jni/build.xml", "clean all -v");

    // load the test-natives.jar and from it the shared library, then execute the test.
    new JniGenSharedLibraryLoader("libs/test-natives.jar").load("test");
    ByteBuffer buffer = ByteBuffer.allocateDirect(1);
    buffer.put(0, (byte) 8);
    MyJniClass.test(
        true,
        (byte) 1,
        (char) 2,
        (short) 3,
        4,
        5,
        6,
        7,
        buffer,
        new boolean[] {false},
        new char[] {9},
        new short[] {10},
        new int[] {11},
        new long[] {12},
        new float[] {13},
        new double[] {14},
        null,
        "Hurray");
  }
Пример #2
0
  public static void main(String[] args) throws Exception {
    String[] headers = {"freetype-2.5.5/include"};
    String[] sources = {
      // BASE
      "freetype-2.5.5/src/base/ftsystem.c",
      "freetype-2.5.5/src/base/ftinit.c",
      "freetype-2.5.5/src/base/ftdebug.c",
      "freetype-2.5.5/src/base/ftbase.c",
      "freetype-2.5.5/src/base/ftbbox.c",
      "freetype-2.5.5/src/base/ftglyph.c",
      "freetype-2.5.5/src/base/ftbdf.c",
      "freetype-2.5.5/src/base/ftbitmap.c",
      "freetype-2.5.5/src/base/ftcid.c",
      "freetype-2.5.5/src/base/ftfstype.c",
      "freetype-2.5.5/src/base/ftgasp.c",
      "freetype-2.5.5/src/base/ftgxval.c",
      "freetype-2.5.5/src/base/ftlcdfil.c",
      "freetype-2.5.5/src/base/ftmm.c",
      "freetype-2.5.5/src/base/ftotval.c",
      "freetype-2.5.5/src/base/ftpatent.c",
      "freetype-2.5.5/src/base/ftpfr.c",
      "freetype-2.5.5/src/base/ftstroke.c",
      "freetype-2.5.5/src/base/ftsynth.c",
      "freetype-2.5.5/src/base/fttype1.c",
      "freetype-2.5.5/src/base/ftwinfnt.c",
      "freetype-2.5.5/src/base/ftxf86.c",
      // "freetype-2.5.5/src/base/ftmac.c",

      // DRIVERS
      "freetype-2.5.5/src/bdf/bdf.c",
      "freetype-2.5.5/src/cff/cff.c",
      "freetype-2.5.5/src/cid/type1cid.c",
      "freetype-2.5.5/src/pcf/pcf.c",
      "freetype-2.5.5/src/pfr/pfr.c",
      "freetype-2.5.5/src/sfnt/sfnt.c",
      "freetype-2.5.5/src/truetype/truetype.c",
      "freetype-2.5.5/src/type1/type1.c",
      "freetype-2.5.5/src/type42/type42.c",
      "freetype-2.5.5/src/winfonts/winfnt.c",

      // RASTERIZERS
      "freetype-2.5.5/src/raster/raster.c",
      "freetype-2.5.5/src/smooth/smooth.c",

      // AUX
      "freetype-2.5.5/src/autofit/autofit.c",
      "freetype-2.5.5/src/cache/ftcache.c",
      "freetype-2.5.5/src/gzip/ftgzip.c",
      "freetype-2.5.5/src/lzw/ftlzw.c",
      "freetype-2.5.5/src/bzip2/ftbzip2.c",
      "freetype-2.5.5/src/gxvalid/gxvalid.c",
      "freetype-2.5.5/src/otvalid/otvalid.c",
      "freetype-2.5.5/src/psaux/psaux.c",
      "freetype-2.5.5/src/pshinter/pshinter.c",
      "freetype-2.5.5/src/psnames/psnames.c",
    };

    BuildTarget win32home = BuildTarget.newDefaultTarget(TargetOs.Windows, false);
    win32home.compilerPrefix = "";
    win32home.buildFileName = "build-windows32home.xml";
    win32home.excludeFromMasterBuildFile = true;
    win32home.headerDirs = headers;
    win32home.cIncludes = sources;
    win32home.cFlags += " -std=c99 -DFT2_BUILD_LIBRARY";
    win32home.cppFlags += " -std=c99 -DFT2_BUILD_LIBRARY";

    BuildTarget win32 = BuildTarget.newDefaultTarget(TargetOs.Windows, false);
    win32.headerDirs = headers;
    win32.cIncludes = sources;
    win32.cFlags += " -std=c99 -DFT2_BUILD_LIBRARY";
    win32.cppFlags += " -std=c99 -DFT2_BUILD_LIBRARY";

    BuildTarget win64 = BuildTarget.newDefaultTarget(TargetOs.Windows, true);
    win64.headerDirs = headers;
    win64.cIncludes = sources;
    win64.cFlags += " -std=c99 -DFT2_BUILD_LIBRARY";
    win64.cppFlags += " -std=c99 -DFT2_BUILD_LIBRARY";

    BuildTarget lin32 = BuildTarget.newDefaultTarget(TargetOs.Linux, false);
    lin32.headerDirs = headers;
    lin32.cIncludes = sources;
    lin32.cFlags += " -std=c99 -DFT2_BUILD_LIBRARY";
    lin32.cppFlags += " -std=c99 -DFT2_BUILD_LIBRARY";

    BuildTarget lin64 = BuildTarget.newDefaultTarget(TargetOs.Linux, true);
    lin64.headerDirs = headers;
    lin64.cIncludes = sources;
    lin64.cFlags += " -std=c99 -DFT2_BUILD_LIBRARY";
    lin64.cppFlags += " -std=c99 -DFT2_BUILD_LIBRARY";

    BuildTarget mac = BuildTarget.newDefaultTarget(TargetOs.MacOsX, false);
    mac.headerDirs = headers;
    mac.cIncludes = sources;
    mac.cFlags += " -DFT2_BUILD_LIBRARY";
    mac.cppFlags += " -DFT2_BUILD_LIBRARY";
    mac.linkerFlags += " -framework CoreServices -framework Carbon";

    BuildTarget mac64 = BuildTarget.newDefaultTarget(TargetOs.MacOsX, true);
    mac64.headerDirs = headers;
    mac64.cIncludes = sources;
    mac64.cFlags += " -DFT2_BUILD_LIBRARY";
    mac64.cppFlags += " -DFT2_BUILD_LIBRARY";
    mac64.linkerFlags += " -framework CoreServices -framework Carbon";

    BuildTarget android = BuildTarget.newDefaultTarget(TargetOs.Android, false);
    android.headerDirs = headers;
    android.cIncludes = sources;
    android.cFlags += " -std=c99 -DFT2_BUILD_LIBRARY";
    android.cppFlags += " -std=c99 -DFT2_BUILD_LIBRARY";

    BuildTarget ios = BuildTarget.newDefaultTarget(TargetOs.IOS, false);
    ios.headerDirs = headers;
    ios.cIncludes = sources;
    ios.cFlags += " -DFT2_BUILD_LIBRARY";
    ios.cppFlags += " -DFT2_BUILD_LIBRARY";

    new NativeCodeGenerator().generate();
    new AntScriptGenerator()
        .generate(
            new BuildConfig("gdx-freetype"),
            win32home,
            win32,
            win64,
            lin32,
            lin64,
            mac,
            mac64,
            android,
            ios);
    // BuildExecutor.executeAnt("jni/build-windows32home.xml", "-v clean");
    // BuildExecutor.executeAnt("jni/build-windows32home.xml", "-v");
    // BuildExecutor.executeAnt("jni/build.xml", "pack-natives -v");
  }
Пример #3
0
  public static void main(String[] args) throws Exception {
    String[] headers = {"nonlua", "luajit"};

    BuildTarget win32 = BuildTarget.newDefaultTarget(TargetOs.Windows, false);
    win32.headerDirs = headers;
    win32.cFlags += " -DLUASOCKET_INET_PTON";
    win32.cppFlags += " -DLUASOCKET_INET_PTON";
    win32.libraries = "-lws2_32 -lwinmm -L./../../../libs/windows32 -lluajit ";
    win32.linkerFlags = win32.linkerFlags.replace(" -static ", " ");

    BuildTarget win64 = BuildTarget.newDefaultTarget(TargetOs.Windows, true);
    win64.headerDirs = headers;
    win64.cFlags += " -DLUASOCKET_INET_PTON";
    win64.cppFlags += " -DLUASOCKET_INET_PTON";
    win64.libraries = "-lws2_32 -lwinmm -L./../../../libs/windows64 -lluajit64";
    win64.linkerFlags = win64.linkerFlags.replace(" -static ", " ");

    BuildTarget lin32 = BuildTarget.newDefaultTarget(TargetOs.Linux, false);
    lin32.headerDirs = headers;
    lin32.cFlags += " -DLUASOCKET_INET_PTON";
    lin32.cppFlags += " -DLUASOCKET_INET_PTON";
    lin32.libraries = "-L./../../../libs/linux32 -lluajit ";

    BuildTarget lin64 = BuildTarget.newDefaultTarget(TargetOs.Linux, true);
    lin64.headerDirs = headers;
    lin64.cFlags += " -DLUASOCKET_INET_PTON";
    lin64.cppFlags += " -DLUASOCKET_INET_PTON";
    lin64.libraries = "-L./../../../libs/linux64 -lluajit64";

    BuildTarget mac32 = BuildTarget.newDefaultTarget(TargetOs.MacOsX, false);
    mac32.headerDirs = headers;
    mac32.libraries = "-L./../../../libs/macosx32 -lluajit ";

    BuildTarget mac64 = BuildTarget.newDefaultTarget(TargetOs.MacOsX, true);
    mac64.headerDirs = headers;
    mac64.libraries = "-L./../../../libs/macosx64 -lluajit64 ";

    BuildTarget android = BuildTarget.newDefaultTarget(TargetOs.Android, false);
    android.headerDirs = headers;

    BuildTarget ios = BuildTarget.newDefaultTarget(TargetOs.IOS, false);
    ios.headerDirs = headers;
    ios.libraries = "-L./../../../libs/ios32 -lluajit";

    new NativeCodeGenerator().generate("src", "target/classes", "jni");
    new AntScriptGenerator()
        .generate(
            new BuildConfig("nonlua"), win32, win64, lin32, lin64, mac32, mac64, android, ios);
  }