Java 类com.badlogic.gdx.jnigen.BuildTarget.TargetOs 实例源码

项目:libgdxcn    文件:AntScriptGenerator.java   
private String getSharedLibFilename (TargetOs os, boolean is64Bit, String sharedLibName) {
    // generate shared lib prefix and suffix, determine jni platform headers directory
    String libPrefix = "";
    String libSuffix = "";
    if (os == TargetOs.Windows) {
        libSuffix = (is64Bit ? "64" : "") + ".dll";
    }
    if (os == TargetOs.Linux || os == TargetOs.Android) {
        libPrefix = "lib";
        libSuffix = (is64Bit ? "64" : "") + ".so";
    }
    if (os == TargetOs.MacOsX) {
        libPrefix = "lib";
        libSuffix = (is64Bit ? "64" : "") + ".dylib";
    }
    if (os == TargetOs.IOS) {
        libPrefix = "lib";
        libSuffix = ".a";
    }
    return libPrefix + sharedLibName + libSuffix;
}
项目:libgdxcn    文件:MyJniClass.java   
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");
}
项目:libgdxcn    文件:Box2DBuild.java   
public static void main(String[] args) throws Exception {
    BuildTarget win32 = BuildTarget.newDefaultTarget(TargetOs.Windows, false);
    BuildTarget win64 = BuildTarget.newDefaultTarget(TargetOs.Windows, true);
    BuildTarget lin32 = BuildTarget.newDefaultTarget(TargetOs.Linux, false);
    BuildTarget lin64 = BuildTarget.newDefaultTarget(TargetOs.Linux, true);
    BuildTarget android = BuildTarget.newDefaultTarget(TargetOs.Android, false);
    BuildTarget mac32 = BuildTarget.newDefaultTarget(TargetOs.MacOsX, false);
    BuildTarget mac64 = BuildTarget.newDefaultTarget(TargetOs.MacOsX, true);
    BuildTarget ios = BuildTarget.newDefaultTarget(TargetOs.IOS, false);
    new NativeCodeGenerator().generate("src", "bin" + File.pathSeparator + "../../../gdx/bin", "jni");
    new AntScriptGenerator().generate(new BuildConfig("gdx-box2d"), win32, win64, lin32, lin64, mac32, mac64, android, ios);        
}
项目:ingress-indonesia-dev    文件:GdxBuild.java   
public static void main(String[] paramArrayOfString)
{
  new NativeCodeGenerator().generate("src", "bin", "jni", new String[] { "**/*" }, null);
  BuildTarget localBuildTarget1 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.Windows, false);
  localBuildTarget1.compilerPrefix = "";
  localBuildTarget1.buildFileName = "build-windows32home.xml";
  localBuildTarget1.excludeFromMasterBuildFile = true;
  BuildTarget localBuildTarget2 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.Windows, false);
  BuildTarget localBuildTarget3 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.Windows, true);
  BuildTarget localBuildTarget4 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.Linux, false);
  BuildTarget localBuildTarget5 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.Linux, true);
  BuildTarget localBuildTarget6 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.Android, false);
  BuildTarget localBuildTarget7 = BuildTarget.newDefaultTarget(BuildTarget.TargetOs.MacOsX, false);
  new AntScriptGenerator().generate(new BuildConfig("gdx", "../target/native", "libs", "jni"), new BuildTarget[] { localBuildTarget7, localBuildTarget1, localBuildTarget2, localBuildTarget3, localBuildTarget4, localBuildTarget5, localBuildTarget6 });
}
项目:libgdxcn    文件:GdxBuild.java   
public static void main (String[] args) throws Exception {
    String JNI_DIR = "jni";
    String LIBS_DIR = "libs";

    // generate C/C++ code
    new NativeCodeGenerator().generate("src", "bin", JNI_DIR, new String[] {"**/*"}, null);

    String[] excludeCpp = {"android/**", "iosgl/**"};

    // generate build scripts, for win32 only
    // custom target for testing purposes
    BuildTarget win32home = BuildTarget.newDefaultTarget(TargetOs.Windows, false);
    win32home.compilerPrefix = "";
    win32home.buildFileName = "build-windows32home.xml";
    win32home.excludeFromMasterBuildFile = true;
    win32home.cppExcludes = excludeCpp;
    BuildTarget win32 = BuildTarget.newDefaultTarget(TargetOs.Windows, false);
    win32.cppExcludes = excludeCpp;
    BuildTarget win64 = BuildTarget.newDefaultTarget(TargetOs.Windows, true);
    win64.cppExcludes = excludeCpp;
    BuildTarget lin32 = BuildTarget.newDefaultTarget(TargetOs.Linux, false);
    lin32.cppExcludes = excludeCpp;
    BuildTarget lin64 = BuildTarget.newDefaultTarget(TargetOs.Linux, true);
    lin64.cppExcludes = excludeCpp;
    BuildTarget android = BuildTarget.newDefaultTarget(TargetOs.Android, false);
    android.linkerFlags += " -lGLESv2 -llog";
    android.cppExcludes = new String[] {"iosgl/**"};
    BuildTarget mac = BuildTarget.newDefaultTarget(TargetOs.MacOsX, false);
    mac.cppExcludes = excludeCpp;
    BuildTarget mac64 = BuildTarget.newDefaultTarget(TargetOs.MacOsX, true);
    mac64.cppExcludes = excludeCpp;
    BuildTarget ios = BuildTarget.newDefaultTarget(TargetOs.IOS, false);
    ios.cppExcludes = new String[] {"android/**"};
    ios.headerDirs = new String[] {"iosgl"};
    new AntScriptGenerator().generate(new BuildConfig("gdx", "../target/native", LIBS_DIR, JNI_DIR), mac, mac64, win32home, win32,
        win64, lin32, lin64, android, ios);

    // build natives
    // BuildExecutor.executeAnt("jni/build-windows32home.xml", "-v");
    // BuildExecutor.executeAnt("jni/build.xml", "pack-natives -v");
}
项目:libgdxcn    文件:BulletBuild.java   
public static void main (String[] args) throws Exception {
        // generate C/C++ code
        new NativeCodeGenerator().generate("src", "bin", "jni");

        // Flags to accomodate SWIG generated code
        String cppFlags = "";

        // SWIG doesn't emit strict aliasing compliant code
        cppFlags += " -fno-strict-aliasing";
        // SWIG directors aren't clearly documented to require RTTI, but SWIG
        // normally generates a small number of dynamic_casts for director code.
        // gdx-bullet's swig build.xml replaces these with static C casts so we
        // can compile without RTTI and save some disk space. It seems to work
        // with these static casts.
        cppFlags += " -fno-rtti";
        // Disable profiling (it's on by default). If you change this, you
        // must regenerate the SWIG wrappers with the changed value.
        cppFlags += " -DBT_NO_PROFILE";

        // generate build scripts
        String[] excludes = {"src/bullet/BulletMultiThreaded/GpuSoftBodySolvers/**"};
        String[] headers = {"src/bullet/", "src/custom/", "src/extras/Serialize/"};

        BuildTarget win32home = BuildTarget.newDefaultTarget(TargetOs.Windows, false);
        win32home.compilerPrefix = "";
        win32home.buildFileName = "build-windows32home.xml";
        win32home.excludeFromMasterBuildFile = true;
        win32home.cExcludes = win32home.cppExcludes = excludes;
        win32home.headerDirs = headers;
        win32home.cppFlags += cppFlags;

        BuildTarget win32 = BuildTarget.newDefaultTarget(TargetOs.Windows, false);
        win32.cExcludes = win32.cppExcludes = excludes;
        win32.headerDirs = headers;
        win32.cppFlags += cppFlags;

        BuildTarget win64 = BuildTarget.newDefaultTarget(TargetOs.Windows, true);
        win64.cExcludes = win64.cppExcludes = excludes;
        win64.headerDirs = headers;
        win64.cppFlags += cppFlags;

        BuildTarget lin32 = BuildTarget.newDefaultTarget(TargetOs.Linux, false);
        lin32.cExcludes = lin32.cppExcludes = excludes;
        lin32.headerDirs = headers;
        lin32.cppFlags += cppFlags;

        BuildTarget lin64 = BuildTarget.newDefaultTarget(TargetOs.Linux, true);
        lin64.cExcludes = lin64.cppExcludes = excludes;
        lin64.headerDirs = headers;
        lin64.cppFlags += cppFlags;

        BuildTarget mac = BuildTarget.newDefaultTarget(TargetOs.MacOsX, false);
        mac.cExcludes = mac.cppExcludes = excludes;
        mac.headerDirs = headers;
        mac.cppFlags += cppFlags;

        BuildTarget mac64 = BuildTarget.newDefaultTarget(TargetOs.MacOsX, true);
        mac64.cExcludes = mac.cppExcludes = excludes;
        mac64.headerDirs = headers;
        mac64.cppFlags += cppFlags;

        BuildTarget android = BuildTarget.newDefaultTarget(TargetOs.Android, false);
        android.cExcludes = android.cppExcludes = excludes;
        android.headerDirs = headers;   
        android.cppFlags += cppFlags + " -fexceptions";

        BuildTarget ios = BuildTarget.newDefaultTarget(TargetOs.IOS, false);
        ios.cExcludes = ios.cppExcludes = excludes;
        ios.headerDirs = headers;
        ios.cppFlags += cppFlags;

        new AntScriptGenerator().generate(new BuildConfig("gdx-bullet"), win32home, win32, win64, lin32, lin64, mac, mac64, android, ios);
        new FileHandle(new File("jni/Application.mk")).writeString("\nAPP_STL := stlport_static\n", true);

        // build natives
        // BuildExecutor.executeAnt("jni/build-windows32home.xml", "-v");
//      BuildExecutor.executeAnt("jni/build-linux64.xml", "");
//      BuildExecutor.executeAnt("jni/build-android32.xml", "");
//      BuildExecutor.executeAnt("jni/build.xml", "pack-natives");
    }
项目:libgdxcn    文件:DesktopControllersBuild.java   
public static void main (String[] args) throws Exception {
        new NativeCodeGenerator().generate("src/", "bin/", "jni/");
        BuildConfig buildConfig = new BuildConfig("gdx-controllers-desktop");

        String[] windowsSrc = {"*.cpp", "ois-v1-4svn/src/*.cpp", "ois-v1-4svn/src/win32/*.cpp"};

        String[] linuxSrc = {"*.cpp", "ois-v1-4svn/src/*.cpp", "ois-v1-4svn/src/linux/*.cpp"};

        String[] mac64Src = {"*.cpp", "ois-v1-4svn/src/*.cpp", "ois-v1-4svn/src/mac/*.mm", "ois-v1-4svn/src/mac/MacHIDManager.cpp",
            "ois-v1-4svn/src/mac/MacJoyStick.cpp",};

        String[] includes = new String[] {"ois-v1-4svn/includes", "dinput/"};

        BuildTarget win32home = BuildTarget.newDefaultTarget(TargetOs.Windows, false);
        win32home.buildFileName = "build-windows32home.xml";
        win32home.excludeFromMasterBuildFile = true;
        win32home.is64Bit = false;
        win32home.compilerPrefix = "";
        win32home.cppIncludes = windowsSrc;
        win32home.headerDirs = includes;
        win32home.cIncludes = new String[0];
        win32home.libraries = "-ldinput8 -ldxguid";

        BuildTarget win32 = BuildTarget.newDefaultTarget(TargetOs.Windows, false);
        win32.cppIncludes = windowsSrc;
        win32.headerDirs = includes;
        win32.libraries = "-ldinput8 -ldxguid";

        BuildTarget win64 = BuildTarget.newDefaultTarget(TargetOs.Windows, true);
        win64.cppIncludes = windowsSrc;
        win64.headerDirs = includes;
        win64.libraries = "-ldinput8 -ldxguid";

        BuildTarget lin32 = BuildTarget.newDefaultTarget(TargetOs.Linux, false);
        lin32.cppIncludes = linuxSrc;
        lin32.headerDirs = includes;
        lin32.libraries = "-lX11";

        BuildTarget lin64 = BuildTarget.newDefaultTarget(TargetOs.Linux, true);
        lin64.cppIncludes = linuxSrc;
        lin64.headerDirs = includes;
        lin64.libraries = "-lX11";

        BuildTarget mac = BuildTarget.newDefaultTarget(TargetOs.MacOsX, false);
        mac.cppIncludes = mac64Src;
        mac.headerDirs = includes;
        mac.cppFlags += " -x objective-c++";
        mac.libraries = "-framework CoreServices -framework Carbon -framework IOKit -framework Cocoa";

        BuildTarget mac64 = BuildTarget.newDefaultTarget(TargetOs.MacOsX, true);
        mac64.cppIncludes = mac64Src;
        mac64.headerDirs = includes;
        mac64.cppFlags += " -x objective-c++";
        mac64.libraries = "-framework CoreServices -framework Carbon -framework IOKit -framework Cocoa";

        new AntScriptGenerator().generate(buildConfig, win32home, win32, win64, lin32, lin64, mac, mac64);
//      if (!BuildExecutor.executeAnt("jni/build-macosx32.xml", "-Dhas-compiler=true -v postcompile")) {
//          throw new Exception("build failed");
//      }
//      BuildExecutor.executeAnt("jni/build.xml", "pack-natives");
    }
项目:libgdxcn    文件:AntScriptGenerator.java   
private String getJniPlatform (TargetOs os) {
    if (os == TargetOs.Windows) return "win32";
    if (os == TargetOs.Linux) return "linux";
    if (os == TargetOs.MacOsX) return "mac";
    return "";
}