From 9c079623a5530afe9d240962a2f76ff2f9801e8c Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Fri, 29 May 2015 10:31:48 -0400 Subject: [PATCH] abstract_compiler: introduce root_compile_dir for platforms that need them Signed-off-by: Jean Privat --- src/compiler/abstract_compiler.nit | 12 ++++++++++-- src/platform/android.nit | 4 ++-- src/platform/ios.nit | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/compiler/abstract_compiler.nit b/src/compiler/abstract_compiler.nit index 904e73b..02bdade 100644 --- a/src/compiler/abstract_compiler.nit +++ b/src/compiler/abstract_compiler.nit @@ -142,14 +142,21 @@ class Toolchain # Compiler of the target program var compiler: AbstractCompiler - # Directory where to generate all C files - fun compile_dir: String + # Directory where to generate all files + # + # The option `--compile_dir` change this directory. + fun root_compile_dir: String do var compile_dir = toolcontext.opt_compile_dir.value if compile_dir == null then compile_dir = "nit_compile" return compile_dir end + # Directory where to generate all C files + # + # By default it is `root_compile_dir` but some platform may require that it is a subdirectory. + fun compile_dir: String do return root_compile_dir + # Write all C files and compile them fun write_and_make is abstract end @@ -168,6 +175,7 @@ class MakefileToolchain var time0 = get_time self.toolcontext.info("*** WRITING C ***", 1) + root_compile_dir.mkdir compile_dir.mkdir var cfiles = new Array[String] diff --git a/src/platform/android.nit b/src/platform/android.nit index a543672..948b4a1 100644 --- a/src/platform/android.nit +++ b/src/platform/android.nit @@ -52,7 +52,7 @@ class AndroidToolchain redef fun compile_dir do - var android_project_root = "{super}/android/" + var android_project_root = "{root_compile_dir}/android/" self.android_project_root = android_project_root return "{android_project_root}/jni/nit_compile/" end @@ -255,7 +255,7 @@ $(call import-module,android/native_app_glue) end toolcontext.exec_and_check(["ln", "-s", "{share_dir}/libgc/arm/include/gc/", - "{android_project_root}/jni/nit_compile/gc"], "Android project error") + "{compile_dir}/gc"], "Android project error") ### Link to assets (for mnit and others) # This will be accessed from `android_project_root` diff --git a/src/platform/ios.nit b/src/platform/ios.nit index 27c05c6..13f9386 100644 --- a/src/platform/ios.nit +++ b/src/platform/ios.nit @@ -56,7 +56,7 @@ private class IOSToolchain # Compile C files in `ios_project_root/app_project.name` redef fun compile_dir do - ios_project_root = super/"ios" + ios_project_root = root_compile_dir/"ios" return ios_project_root/app_project.short_name end -- 1.7.9.5