diff --git a/gyp/CocoaDebuggerApp.gyp b/gyp/CocoaDebuggerApp.gyp index 1960a670e0..e53dfbb106 100644 --- a/gyp/CocoaDebuggerApp.gyp +++ b/gyp/CocoaDebuggerApp.gyp @@ -31,7 +31,7 @@ ], 'conditions' : [ # Only supports Mac currently - ['OS == "mac"', { + ['skia_os == "mac"', { 'sources': [ '../experimental/CocoaDebugger/CocoaDebugger-Info.plist', '../experimental/CocoaDebugger/CocoaDebugger_Prefix.pch', diff --git a/gyp/FileReaderApp.gyp b/gyp/FileReaderApp.gyp index 2db992ff99..0e2c48f802 100644 --- a/gyp/FileReaderApp.gyp +++ b/gyp/FileReaderApp.gyp @@ -30,7 +30,7 @@ ], 'conditions' : [ # Only supports Mac currently - ['OS == "mac"', { + ['skia_os == "mac"', { 'sources': [ '../experimental/SimpleCocoaApp/SkNSWindow.mm', '../experimental/SimpleCocoaApp/SkNSView.mm', diff --git a/gyp/SampleApp.gyp b/gyp/SampleApp.gyp index 4e01526452..0c4c04cb5e 100644 --- a/gyp/SampleApp.gyp +++ b/gyp/SampleApp.gyp @@ -135,19 +135,19 @@ 'pdf.gyp:pdf', ], 'conditions' : [ - [ 'OS == "linux" or OS == "freebsd" or OS == "openbsd" or OS == "solaris"', { + [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris"]', { 'sources!': [ '../samplecode/SampleDecode.cpp', ], }], - [ 'OS == "win"', { + [ 'skia_os == "win"', { 'sources!': [ # require UNIX functions '../samplecode/SampleEncode.cpp', '../samplecode/SamplePageFlip.cpp', ], }], - [ 'OS == "mac"', { + [ 'skia_os == "mac"', { 'sources!': [ '../samplecode/SampleDecode.cpp', ], diff --git a/gyp/SimpleCocoaApp.gyp b/gyp/SimpleCocoaApp.gyp index 9f415e4d11..ead9fe4f98 100644 --- a/gyp/SimpleCocoaApp.gyp +++ b/gyp/SimpleCocoaApp.gyp @@ -28,7 +28,7 @@ ], 'conditions' : [ # Only supports Mac currently - [ 'OS == "mac"', { + [ 'skia_os == "mac"', { 'sources': [ '../include/utils/mac/SkCGUtils.h', '../src/utils/mac/SkCreateCGImageRef.cpp', diff --git a/gyp/bench.gyp b/gyp/bench.gyp index 11f0461556..c57b51e803 100644 --- a/gyp/bench.gyp +++ b/gyp/bench.gyp @@ -1,11 +1,5 @@ # GYP file to build performance testbench. # -# To build and run on Linux: -# ./gyp_skia bench.gyp && make -# out/Debug/bench -repeat 2 -# -# Building on other platforms not tested yet. -# { 'includes': [ 'apptype_console.gypi', @@ -53,13 +47,13 @@ 'utils.gyp:utils', ], 'conditions': [ - [ 'OS != "mac"', { + [ 'skia_os != "mac"', { 'sources!': [ '../bench/BenchSysTimer_mach.h', '../bench/BenchSysTimer_mach.cpp', ], }], - [ 'OS not in ["linux", "freebsd", "openbsd", "solaris"]', { + [ 'skia_os not in ["linux", "freebsd", "openbsd", "solaris"]', { 'sources!': [ '../bench/BenchSysTimer_posix.h', '../bench/BenchSysTimer_posix.cpp', @@ -71,13 +65,13 @@ ], }, }], - [ 'OS != "win"', { + [ 'skia_os != "win"', { 'sources!': [ '../bench/BenchSysTimer_windows.h', '../bench/BenchSysTimer_windows.cpp', ], }], - [ 'OS in ["win", "mac", "linux", "freebsd", "openbsd", "solaris"]', { + [ 'skia_os in ["win", "mac", "linux", "freebsd", "openbsd", "solaris"]', { 'sources!': [ '../bench/BenchGpuTimer_none.h', '../bench/BenchGpuTimer_none.cpp', diff --git a/gyp/common.gypi b/gyp/common.gypi index d1f23d5758..a9b0b537fe 100644 --- a/gyp/common.gypi +++ b/gyp/common.gypi @@ -12,13 +12,29 @@ # See the License for the specific language governing permissions and # limitations under the License. { + # Define all variables, allowing for override in GYP_DEFINES. + # + # One such variable is 'skia_os', which we use instead of 'OS' throughout + # our gyp files. We set it automatically based on 'OS', but allow the + # user to override it via GYP_DEFINES if they like. + 'variables': { + 'skia_scalar%': 'float', + 'skia_os%': '<(OS)', + }, + 'skia_scalar%': '<(skia_scalar)', + 'skia_os': '<(skia_os)', + 'target_defaults': { - # Define variables, and allow for override in GYP_DEFINES environment var. + # Validate the 'skia_os' setting against 'OS', because only certain + # combinations work. You should only override 'skia_os' for certain + # situations, like building for iOS on a Mac. 'variables': { - 'skia_scalar%': 'float', + 'conditions': [ + ['skia_os != OS and not (skia_os == "ios" and OS == "mac")', + {'error': '', ], }], - [ 'OS == "linux"', { + [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris"]', { 'link_settings': { 'libraries': [ '-lz', ], }, 'defines': [ 'SK_ZLIB_INCLUDE=', ], }],