diff options
-rw-r--r-- | bench/DeferredSurfaceCopyBench.cpp | 6 | ||||
-rw-r--r-- | bench/ResultsWriter.h | 2 | ||||
-rw-r--r-- | bench/benchmain.cpp | 7 | ||||
-rw-r--r-- | gyp/bench.gyp | 8 | ||||
-rw-r--r-- | gyp/common_conditions.gypi | 6 | ||||
-rw-r--r-- | gyp/common_variables.gypi | 5 | ||||
-rw-r--r-- | gyp/jsoncpp.gyp | 68 | ||||
-rw-r--r-- | include/utils/SkJSONCPP.h | 6 | ||||
-rwxr-xr-x | platform_tools/android/bin/gyp_to_android.py | 16 | ||||
-rw-r--r-- | platform_tools/android/gyp_gen/gypd_parser.py | 3 | ||||
-rw-r--r-- | platform_tools/android/gyp_gen/makefile_writer.py | 2 | ||||
-rw-r--r-- | platform_tools/android/gyp_gen/tool_makefile_writer.py | 19 |
12 files changed, 99 insertions, 49 deletions
diff --git a/bench/DeferredSurfaceCopyBench.cpp b/bench/DeferredSurfaceCopyBench.cpp index fcc19d4c39..6449b611bd 100644 --- a/bench/DeferredSurfaceCopyBench.cpp +++ b/bench/DeferredSurfaceCopyBench.cpp @@ -6,14 +6,14 @@ * found in the LICENSE file. */ -#if SK_SUPPORT_GPU -#include "GrRenderTarget.h" -#endif #include "SkBenchmark.h" #include "SkDeferredCanvas.h" #include "SkDevice.h" #include "SkImage.h" #include "SkSurface.h" +#if SK_SUPPORT_GPU +#include "GrRenderTarget.h" +#endif class DeferredSurfaceCopyBench : public SkBenchmark { enum { diff --git a/bench/ResultsWriter.h b/bench/ResultsWriter.h index 29d3d1df41..12c968a507 100644 --- a/bench/ResultsWriter.h +++ b/bench/ResultsWriter.h @@ -77,6 +77,7 @@ private: const char* fTimeFormat; }; +#ifdef SK_BUILD_JSON_WRITER /** * This ResultsWriter handles writing out the results in JSON. * @@ -133,6 +134,7 @@ private: Json::Value* fConfig; }; +#endif // SK_BUILD_JSON_WRITER /** * This ResultsWriter writes out to multiple ResultsWriters. */ diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp index e2cc9c160f..25c552c5e0 100644 --- a/bench/benchmain.cpp +++ b/bench/benchmain.cpp @@ -267,8 +267,9 @@ DEFINE_double(error, 0.01, DEFINE_string(timeFormat, "%9.2f", "Format to print results, in milliseconds per 1000 loops."); DEFINE_bool2(verbose, v, false, "Print more."); DEFINE_string2(resourcePath, i, "resources", "directory for test resources."); +#ifdef SK_BUILD_JSON_WRITER DEFINE_string(outResultsFile, "", "If given, the results will be written to the file in JSON format."); - +#endif DEFINE_bool(dryRun, false, "Don't actually run the tests, just print what would have been done."); // Has this bench converged? First arguments are milliseconds / loop iteration, @@ -301,11 +302,15 @@ int tool_main(int argc, char** argv) { LoggerResultsWriter logWriter(logger, FLAGS_timeFormat[0]); MultiResultsWriter writer; writer.add(&logWriter); + +#ifdef SK_BUILD_JSON_WRITER SkAutoTDelete<JSONResultsWriter> jsonWriter; if (FLAGS_outResultsFile.count()) { jsonWriter.reset(SkNEW(JSONResultsWriter(FLAGS_outResultsFile[0]))); writer.add(jsonWriter.get()); } +#endif + // Instantiate after all the writers have been added to writer so that we // call close() before their destructors are called on the way out. CallEnd<MultiResultsWriter> ender(writer); diff --git a/gyp/bench.gyp b/gyp/bench.gyp index 9e8d1d714b..553c0e72cd 100644 --- a/gyp/bench.gyp +++ b/gyp/bench.gyp @@ -33,6 +33,14 @@ ], }, ], + ['skia_android_framework == 1', + { + 'libraries': [ + '-lskia', + '-lcutils', + ], + }, + ], ], 'includes': [ 'bench.gypi', diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi index 6a800b48ef..4a60cd0502 100644 --- a/gyp/common_conditions.gypi +++ b/gyp/common_conditions.gypi @@ -639,6 +639,12 @@ ], }], + [ 'skia_build_json_writer', { + 'defines': [ + 'SK_BUILD_JSON_WRITER', + ] + }], + ], # end 'conditions' # The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details 'xcode_settings': { diff --git a/gyp/common_variables.gypi b/gyp/common_variables.gypi index b6d4e76af4..033073f447 100644 --- a/gyp/common_variables.gypi +++ b/gyp/common_variables.gypi @@ -60,9 +60,13 @@ [ 'skia_android_framework == 1', { 'skia_os%': 'android', 'skia_chrome_utils%': 0, + # FIXME (scroggo): JSON is disabled in Android framework until we + # solve skbug.com/2448 + 'skia_build_json_writer%': 0, }, { 'skia_os%': '<(skia_os)', 'skia_chrome_utils%': 1, + 'skia_build_json_writer%': 1, }], [ 'skia_os == "win"', { 'os_posix%': 0, @@ -198,6 +202,7 @@ 'skia_mesa%': '<(skia_mesa)', 'skia_stroke_path_rendering%': '<(skia_stroke_path_rendering)', 'skia_android_framework%': '<(skia_android_framework)', + 'skia_build_json_writer%': '<(skia_build_json_writer)', 'skia_android_path_rendering%': '<(skia_android_path_rendering)', 'skia_resource_cache_mb_limit%': '<(skia_resource_cache_mb_limit)', 'skia_resource_cache_count_limit%': '<(skia_resource_cache_count_limit)', diff --git a/gyp/jsoncpp.gyp b/gyp/jsoncpp.gyp index 1b5b7845e8..0507ed06a1 100644 --- a/gyp/jsoncpp.gyp +++ b/gyp/jsoncpp.gyp @@ -19,38 +19,42 @@ { 'target_name': 'jsoncpp', 'type': 'static_library', - 'defines': [ - 'JSON_USE_EXCEPTION=0', - ], - 'sources': [ - '../third_party/externals/jsoncpp/include/json/assertions.h', - '../third_party/externals/jsoncpp/include/json/autolink.h', - '../third_party/externals/jsoncpp/include/json/config.h', - '../third_party/externals/jsoncpp/include/json/features.h', - '../third_party/externals/jsoncpp/include/json/forwards.h', - '../third_party/externals/jsoncpp/include/json/json.h', - '../third_party/externals/jsoncpp/include/json/reader.h', - '../third_party/externals/jsoncpp-chromium/overrides/include/json/value.h', - '../third_party/externals/jsoncpp/include/json/writer.h', - '../third_party/externals/jsoncpp/src/lib_json/json_batchallocator.h', - '../third_party/externals/jsoncpp/src/lib_json/json_reader.cpp', - '../third_party/externals/jsoncpp/src/lib_json/json_tool.h', - '../third_party/externals/jsoncpp-chromium/overrides/src/lib_json/json_value.cpp', - '../third_party/externals/jsoncpp/src/lib_json/json_writer.cpp', - ], - 'include_dirs': [ - '../third_party/externals/jsoncpp-chromium/overrides/include/', - '../third_party/externals/jsoncpp/include/', - '../third_party/externals/jsoncpp/src/lib_json/', - ], - 'direct_dependent_settings': { - 'include_dirs': [ - '../third_party/externals/jsoncpp-chromium/overrides/include/', - '../third_party/externals/jsoncpp/include/', - ], - }, - 'cflags': [ - '-w', + 'conditions': [ + ['skia_build_json_writer', { + 'defines': [ + 'JSON_USE_EXCEPTION=0', + ], + 'sources': [ + '../third_party/externals/jsoncpp/include/json/assertions.h', + '../third_party/externals/jsoncpp/include/json/autolink.h', + '../third_party/externals/jsoncpp/include/json/config.h', + '../third_party/externals/jsoncpp/include/json/features.h', + '../third_party/externals/jsoncpp/include/json/forwards.h', + '../third_party/externals/jsoncpp/include/json/json.h', + '../third_party/externals/jsoncpp/include/json/reader.h', + '../third_party/externals/jsoncpp-chromium/overrides/include/json/value.h', + '../third_party/externals/jsoncpp/include/json/writer.h', + '../third_party/externals/jsoncpp/src/lib_json/json_batchallocator.h', + '../third_party/externals/jsoncpp/src/lib_json/json_reader.cpp', + '../third_party/externals/jsoncpp/src/lib_json/json_tool.h', + '../third_party/externals/jsoncpp-chromium/overrides/src/lib_json/json_value.cpp', + '../third_party/externals/jsoncpp/src/lib_json/json_writer.cpp', + ], + 'include_dirs': [ + '../third_party/externals/jsoncpp-chromium/overrides/include/', + '../third_party/externals/jsoncpp/include/', + '../third_party/externals/jsoncpp/src/lib_json/', + ], + 'direct_dependent_settings': { + 'include_dirs': [ + '../third_party/externals/jsoncpp-chromium/overrides/include/', + '../third_party/externals/jsoncpp/include/', + ], + }, + 'cflags': [ + '-w', + ], + }], ], }, ], diff --git a/include/utils/SkJSONCPP.h b/include/utils/SkJSONCPP.h index 8dbb40c91b..966d064e9f 100644 --- a/include/utils/SkJSONCPP.h +++ b/include/utils/SkJSONCPP.h @@ -10,6 +10,8 @@ #ifndef SkJSONCPP_DEFINED #define SkJSONCPP_DEFINED +#ifdef SK_BUILD_JSON_WRITER + #ifdef SK_BUILD_FOR_WIN // json includes xlocale which generates warning 4530 because we're // compiling without exceptions; @@ -23,4 +25,6 @@ #pragma warning(pop) #endif -#endif +#endif // SK_BUILD_JSON_WRITER + +#endif // SkJSONCPP_DEFINED diff --git a/platform_tools/android/bin/gyp_to_android.py b/platform_tools/android/bin/gyp_to_android.py index e885399644..8994efdf05 100755 --- a/platform_tools/android/bin/gyp_to_android.py +++ b/platform_tools/android/bin/gyp_to_android.py @@ -135,14 +135,14 @@ def main(target_dir=None, require_sk_user_config=False): local_module_name='skia_test', local_module_tags=['eng', 'tests']) - # TODO (scroggo): Generate bench/Android.mk. See skbug.com/2448 - #tool_makefile_writer.generate_tool(gyp_dir=tmp_folder, - # target_file='bench.gyp', - # skia_trunk=target_dir, - # dest_dir='bench', - # skia_lib_var_dict=common, - # local_module_name='skia_bench', - # local_module_tags=['tests']) + tool_makefile_writer.generate_tool(gyp_dir=tmp_folder, + target_file='bench.gyp', + skia_trunk=target_dir, + dest_dir='bench', + skia_lib_var_dict=common, + local_module_name='skia_bench', + local_module_tags=['tests'], + place_in_local_tmp=True) # Now that the defines have been written to SkUserConfig and they've been # used to skip adding them to the tools makefiles, they are not needed in diff --git a/platform_tools/android/gyp_gen/gypd_parser.py b/platform_tools/android/gyp_gen/gypd_parser.py index b0e1417046..e992637637 100644 --- a/platform_tools/android/gyp_gen/gypd_parser.py +++ b/platform_tools/android/gyp_gen/gypd_parser.py @@ -97,6 +97,9 @@ def parse_dictionary(var_dict, d, current_target_name, dest_dir): # wants relative to dest_dir. rel_include = os.path.relpath(include, os.pardir) rel_include = os.path.relpath(rel_include, dest_dir) + # No need to include the base directory. + if rel_include is os.curdir: + continue rel_include = os.path.join('$(LOCAL_PATH)', rel_include) # Remove a trailing slash, if present. diff --git a/platform_tools/android/gyp_gen/makefile_writer.py b/platform_tools/android/gyp_gen/makefile_writer.py index 212979925c..1c927601df 100644 --- a/platform_tools/android/gyp_gen/makefile_writer.py +++ b/platform_tools/android/gyp_gen/makefile_writer.py @@ -117,7 +117,7 @@ SKIA_TOOLS = ( # # benchmark (timings) -#include $(BASE_PATH)/bench/Android.mk +include $(BASE_PATH)/bench/Android.mk # golden-master (fidelity / regression test) #include $(BASE_PATH)/gm/Android.mk diff --git a/platform_tools/android/gyp_gen/tool_makefile_writer.py b/platform_tools/android/gyp_gen/tool_makefile_writer.py index bdcd8846b7..ac2a75857e 100644 --- a/platform_tools/android/gyp_gen/tool_makefile_writer.py +++ b/platform_tools/android/gyp_gen/tool_makefile_writer.py @@ -15,27 +15,37 @@ import os import vars_dict_lib -def write_tool_android_mk(target_dir, var_dict): +def write_tool_android_mk(target_dir, var_dict, place_in_local_tmp): """Write Android.mk for a Skia tool. Args: target_dir: Destination for the makefile. Must not be None. var_dict: VarsDict containing variables for the makefile. + place_in_local_tmp: If True, the executable will be synced to + /data/local/tmp. """ target_file = os.path.join(target_dir, 'Android.mk') with open(target_file, 'w') as f: f.write(makefile_writer.AUTOGEN_WARNING) + + if place_in_local_tmp: + f.write('local_target_dir := $(TARGET_OUT_DATA)/local/tmp\n') + makefile_writer.write_local_path(f) makefile_writer.write_clear_vars(f) makefile_writer.write_local_vars(f, var_dict, False, None) + if place_in_local_tmp: + f.write('LOCAL_MODULE_PATH := $(local_target_dir)\n') + makefile_writer.write_include_stlport(f) f.write('include $(BUILD_EXECUTABLE)\n') def generate_tool(gyp_dir, target_file, skia_trunk, dest_dir, - skia_lib_var_dict, local_module_name, local_module_tags): + skia_lib_var_dict, local_module_name, local_module_tags, + place_in_local_tmp=False): """Common steps for building one of the skia tools. Parse a gyp file and create an Android.mk for this tool. @@ -52,6 +62,8 @@ def generate_tool(gyp_dir, target_file, skia_trunk, dest_dir, ensure we do not duplicate anything in this Android.mk. local_module_name: Name for this tool, to set as LOCAL_MODULE. local_module_tags: Tags to pass to LOCAL_MODULE_TAG. + place_in_local_tmp: If True, the executable will be synced to + /data/local/tmp. """ result_file = android_framework_gyp.main(target_dir=gyp_dir, target_file=target_file, @@ -89,4 +101,5 @@ def generate_tool(gyp_dir, target_file, skia_trunk, dest_dir, if not os.path.exists(full_dest): os.mkdir(full_dest) - write_tool_android_mk(target_dir=full_dest, var_dict=var_dict) + write_tool_android_mk(target_dir=full_dest, var_dict=var_dict, + place_in_local_tmp=place_in_local_tmp) |