almondyoung / libyuv

Automatically exported from code.google.com/p/libyuv
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

GN build #411

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
switch from gyp to GN build.
1. r991 added BUILD.gn, supporting chrome builds of libyuv via GN.
2. r1317 added setup support to allow stand alone GN builds

Next steps are switching all gyp build scripts to GN, improving functionality 
and documenting how to build with GN

Original issue reported on code.google.com by fbarch...@google.com on 10 Mar 2015 at 4:52

GoogleCodeExporter commented 8 years ago
Test of 32 bit Windows build
With GN
call gn gen out/Release "--args=is_debug=false target_cpu=\"x86\""
call gn gen out/Debug "--args=is_debug=true target_cpu=\"x86\""
ninja -C out/Release
ninja -C out/Debug
21.95 seconds

With GYP
set GYP_DEFINES=target_arch=ia32 libyuv_enable_svn=1
call python gyp_libyuv -fninja -G msvs_version=2013 libyuv_test.gyp
ninja -C out\Debug
ninja -C out\Release
24.97 seconds

Original comment by fbarch...@google.com on 10 Mar 2015 at 5:28

GoogleCodeExporter commented 8 years ago
Updated Getting Started for Windows
https://code.google.com/p/libyuv/wiki/GettingStarted

Original comment by fbarch...@chromium.org on 20 Mar 2015 at 10:39

GoogleCodeExporter commented 8 years ago
Does GN support different compilers?  vs2015 vs clang vs vs2013?

Original comment by fbarch...@google.com on 9 May 2015 at 2:40

GoogleCodeExporter commented 8 years ago
dpranke: do you know the answer to #3 above?

Original comment by kjellan...@google.com on 10 May 2015 at 1:30

GoogleCodeExporter commented 8 years ago
I don't think the win GN build supports clang yet.I believe vs2015 vs. vs2013 
*might* work, but I haven't tested it (we use pretty much the same underlying 
scripts to setup the toolchain for GN that we do for GYP).

I would cc' thakis and scottmg if I had edit rights on this :).

Original comment by dpra...@google.com on 11 May 2015 at 11:28

GoogleCodeExporter commented 8 years ago
+thakis, scottmg: Can you provide more info on #3 above?

Original comment by kjellan...@google.com on 12 May 2015 at 6:29

GoogleCodeExporter commented 8 years ago
No one that I know of has tested GN-clang. Even gyp-clang is still 
non-mainstream on Windows.

I would guess that vs2015 "might" work too. The compiler is not yet shipped, 
and there's no bots testing chrome. So if it works, it's by chance, and if it 
breaks, you get both pieces (for now).

Original comment by scottmg@chromium.org on 12 May 2015 at 4:56

GoogleCodeExporter commented 8 years ago
clang/win doesn't work in GN yet (see also the caveats at 
https://code.google.com/p/chromium/wiki/Clang#Windows ). I do want to look at 
that soon though.

Original comment by thakis@chromium.org on 12 May 2015 at 6:57

GoogleCodeExporter commented 8 years ago
call gn gen out/Debug "--args=is_debug=true target_cpu=\"x86\""

produces an error now?

ERROR Can't find source root.
I could not find a ".gn" file in the current directory or any parent,
and the --root command-line argument was not specified.

Original comment by fbarch...@chromium.org on 8 Oct 2015 at 4:21

GoogleCodeExporter commented 8 years ago
That sounds like something is messed up in your checkout. Do you actually have 
a .gn file?

Original comment by dpranke@chromium.org on 8 Oct 2015 at 3:49

GoogleCodeExporter commented 8 years ago
Nope, libyuv doesn't:
https://chromium.googlesource.com/libyuv/libyuv/+/master

In WebRTC, we maintain a slimmed down copy of Chromium's 
(https://chromium.googlesource.com/chromium/src/+/master/.gn) at
https://chromium.googlesource.com/external/webrtc/+/master/.gn

It's not ideal, since we need to update it when new scripts are added to 
exec_script_whitelist, but it hasn't been that often.

Original comment by kjellan...@google.com on 9 Oct 2015 at 8:52

GoogleCodeExporter commented 8 years ago
Yes a very simple BUILD.gn

d:\src\libyuv\libyuv>more BUILD.gn
# Copyright 2014 The LibYuv Project Authors. All rights reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.

import("//build/config/arm.gni")
import("//build/config/sanitizers/sanitizers.gni")

config("libyuv_config") {
  include_dirs = [
    ".",
    "include",
  ]
}

use_neon = current_cpu == "arm" && (arm_use_neon || arm_optionally_use_neon)

source_set("libyuv") {
  sources = [
    "include/libyuv.h",
    "include/libyuv/basic_types.h",
    "include/libyuv/compare.h",
    "include/libyuv/convert.h",
    "include/libyuv/convert_argb.h",
    "include/libyuv/convert_from.h",
    "include/libyuv/convert_from_argb.h",
    "include/libyuv/cpu_id.h",
    "include/libyuv/mjpeg_decoder.h",
    "include/libyuv/planar_functions.h",
    "include/libyuv/rotate.h",
    "include/libyuv/rotate_argb.h",
    "include/libyuv/rotate_row.h",
    "include/libyuv/row.h",
    "include/libyuv/scale.h",
    "include/libyuv/scale_argb.h",
    "include/libyuv/scale_row.h",
    "include/libyuv/version.h",
    "include/libyuv/video_common.h",

    # sources.
    "source/compare.cc",
    "source/compare_common.cc",
    "source/compare_gcc.cc",
    "source/compare_win.cc",
    "source/convert.cc",
    "source/convert_argb.cc",
    "source/convert_from.cc",
    "source/convert_from_argb.cc",
    "source/convert_jpeg.cc",
    "source/convert_to_argb.cc",
    "source/convert_to_i420.cc",
    "source/cpu_id.cc",
    "source/mjpeg_decoder.cc",
    "source/mjpeg_validate.cc",
    "source/planar_functions.cc",
    "source/rotate.cc",
    "source/rotate_any.cc",
    "source/rotate_argb.cc",
    "source/rotate_common.cc",
    "source/rotate_mips.cc",
    "source/rotate_gcc.cc",
    "source/rotate_win.cc",
    "source/row_any.cc",
    "source/row_common.cc",
    "source/row_mips.cc",
    "source/row_gcc.cc",
    "source/row_win.cc",
    "source/scale.cc",
    "source/scale_any.cc",
    "source/scale_argb.cc",
    "source/scale_common.cc",
    "source/scale_mips.cc",
    "source/scale_gcc.cc",
    "source/scale_win.cc",
    "source/video_common.cc",
  ]

  configs -= [ "//build/config/compiler:chromium_code" ]
  configs += [ "//build/config/compiler:no_chromium_code" ]

  public_configs = [ ":libyuv_config" ]

  defines = []

  if (!is_ios) {
    defines += [ "HAVE_JPEG" ]
  }

  if (is_msan) {
    # MemorySanitizer does not support assembly code yet.
    # http://crbug.com/344505
    defines += [ "LIBYUV_DISABLE_X86" ]
  }

  deps = [
    "//third_party:jpeg",
  ]

  if (use_neon) {
    deps += [ ":libyuv_neon" ]
  }
}

if (use_neon) {
  static_library("libyuv_neon") {
    sources = [
      "source/compare_neon.cc",
      "source/compare_neon64.cc",
      "source/rotate_neon.cc",
      "source/rotate_neon64.cc",
      "source/row_neon.cc",
      "source/row_neon64.cc",
      "source/scale_neon.cc",
      "source/scale_neon64.cc",
    ]

    public_configs = [ ":libyuv_config" ]

    configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
    cflags = [ "-mfpu=neon" ]
  }
}

Original comment by fbarch...@chromium.org on 9 Oct 2015 at 5:12

GoogleCodeExporter commented 8 years ago
You need a .gn file in order for GN to work correctly; I don't know how it 
would've ever worked for you without one.

Original comment by dpranke@chromium.org on 9 Oct 2015 at 7:10

GoogleCodeExporter commented 8 years ago
The following revision refers to this bug:
  https://chromium.googlesource.com/libyuv/libyuv.git/+/c2bff1a1af3933c866673c8184e635495d648739

commit c2bff1a1af3933c866673c8184e635495d648739
Author: Frank Barchard <fbarchard@google.com>
Date: Wed Nov 04 19:09:00 2015

add .gn file for gn builds

using a stripped down gn file from webrtc.

BUG=libyuv:411,libyuv:519
R=kjellander@chromium.org

Review URL: https://codereview.chromium.org/1417613007 .

[modify] http://crrev.com/c2bff1a1af3933c866673c8184e635495d648739/.gitignore
[add] http://crrev.com/c2bff1a1af3933c866673c8184e635495d648739/.gn
[modify] 
http://crrev.com/c2bff1a1af3933c866673c8184e635495d648739/README.chromium
[modify] 
http://crrev.com/c2bff1a1af3933c866673c8184e635495d648739/include/libyuv/version
.h

Original comment by bugdroid1@chromium.org on 4 Nov 2015 at 7:10

GoogleCodeExporter commented 8 years ago

Original comment by fbarch...@chromium.org on 5 Nov 2015 at 1:19