• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*******************************************************************************
2  * Copyright 2011 See AUTHORS file.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *   http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  ******************************************************************************/
16 
17 package com.badlogic.gdx.jnigen;
18 
19 /** Specifies the global properties of a native build.</p>
20  *
21  * The shared library name will be used to generate the shared libraries. The build directory is used to store the object files
22  * during compilation for each {@link BuildTarget}. It is relative to the jni directory which houses the C/C++ source code. The
23  * libs directory is the final output directory where the natives jar and arm shared libraries will be written to.
24  *
25  * Used with {@link AntScriptGenerator} to generate the build scripts for build targets.
26  * @author mzechner */
27 public class BuildConfig {
28 	/** the name of the shared library, without prefix or suffix, e.g. 'gdx', 'bullet' **/
29 	public final String sharedLibName;
30 	/** the directory to put the object files in **/
31 	public final FileDescriptor buildDir;
32 	/** the directory to put the shared libraries and natives jar file in **/
33 	public final FileDescriptor libsDir;
34 	/** the directory containing the native code **/
35 	public final FileDescriptor jniDir;
36 	/** additional shared library files to be packed into the natives jar, relative to the jni dir **/
37 	public String[] sharedLibs;
38 
39 	/** Creates a new BuildConfig. The build directory, the libs directory and the jni directory are assumed to be "target", "libs"
40 	 * and "jni". All paths are relative to the application's working directory.
41 	 * @param sharedLibName the shared library name, without prefix or suffix, e.g. 'gdx', 'bullet' */
BuildConfig(String sharedLibName)42 	public BuildConfig (String sharedLibName) {
43 		this.sharedLibName = sharedLibName;
44 		this.buildDir = new FileDescriptor("target");
45 		this.libsDir = new FileDescriptor("libs");
46 		this.jniDir = new FileDescriptor("jni");
47 	}
48 
49 	/** Creates a new BuildConfig. All paths are relative to the application's working directory.
50 	 * @param sharedLibName the shared library name, without prefix or suffix, e.g. 'gdx', 'bullet'
51 	 * @param temporaryDir
52 	 * @param libsDir
53 	 * @param jniDir */
BuildConfig(String sharedLibName, String temporaryDir, String libsDir, String jniDir)54 	public BuildConfig (String sharedLibName, String temporaryDir, String libsDir, String jniDir) {
55 		this.sharedLibName = sharedLibName;
56 		this.buildDir = new FileDescriptor(temporaryDir);
57 		this.libsDir = new FileDescriptor(libsDir);
58 		this.jniDir = new FileDescriptor(jniDir);
59 	}
60 }
61