Chromium инструментарий

Вопросы написания собственного программного кода (на любых языках)

Модератор: Olej

Аватара пользователя
Olej
Писатель
Сообщения: 21338
Зарегистрирован: 24 сен 2011, 14:22
Откуда: Харьков
Контактная информация:

Re: Chromium инструментарий

Непрочитанное сообщение Olej » 19 авг 2021, 11:22

Olej писал(а):
17 авг 2021, 17:39
Облом
ВСЁ из документации, что касается ng, ninja и вообще всего Chromium инструментария - отвратительно по качеству!
Документы и примеры написаны 2014 годом максимум, или ранее + написаны так, чтобы чуть ли не специально не соответствовать реальному состоянию дел: примеры не работают, инсталляции не устанавливаются (на все 100%, с ошибками) и т.д. и т.п.
Такое впечатление, что эта "документация" пишется с целью завлечь, заинтересовать (как альтернатива autoconf, make, Cmake и т.д.), но не дать реальной возможности использовать. :evil:

Из документации gn - Examples:
There is a simple example in examples/simple_build directory that is a good place to get started with the minimal configuration.

И то как подробно это же описано в Система сборки
... оно так просто не работает! Там нужно для самого простого примера ещё кучу конфигурационных файлов.

Сам их пример, как он есть, gn / gn / HEAD / . / examples / simple_build скачал ... не без труда...
Вложения
examples.tgz
(3.19 КБ) 75 скачиваний

Аватара пользователя
Olej
Писатель
Сообщения: 21338
Зарегистрирован: 24 сен 2011, 14:22
Откуда: Харьков
Контактная информация:

Re: Chromium инструментарий

Непрочитанное сообщение Olej » 19 авг 2021, 11:59

Olej писал(а):
17 авг 2021, 17:47
И это, по крайней мере, отличается от того, что устанавливалось в составе Chromium:
Пока временно отвлекусь именно на сборку браузера Chromium ... та как это выглядит на сегодняшний день.
И продолжу это, раз уже есть (была!) такая тема, в Chromium - сборка и модификация.
...
И вот в итоге ;-) :
Изображение

Аватара пользователя
Olej
Писатель
Сообщения: 21338
Зарегистрирован: 24 сен 2011, 14:22
Откуда: Харьков
Контактная информация:

Re: Chromium инструментарий

Непрочитанное сообщение Olej » 20 авг 2021, 12:44

Olej писал(а):
19 авг 2021, 11:59
Пока временно отвлекусь
Возвращаемся:
Olej писал(а):
19 авг 2021, 11:22
Сам их пример, как он есть, gn / gn / HEAD / . / examples / simple_build скачал ... не без труда...

Код: Выделить всё

olej@R420:~/2021/OWN_TEST.codes/GN$ du -hs examples
72K	examples

olej@R420:~/2021/OWN_TEST.codes/GN$ tree examples
examples
└── simple_build
    ├── build
    │   ├── BUILDCONFIG.gn
    │   ├── BUILD.gn
    │   └── toolchain
    │       └── BUILD.gn
    ├── BUILD.gn
    ├── hello.cc
    ├── hello_shared.cc
    ├── hello_shared.h
    ├── hello_static.cc
    ├── hello_static.h
    ├── README.md
    └── tutorial
        ├── README.md
        └── tutorial.cc

4 directories, 12 files

Аватара пользователя
Olej
Писатель
Сообщения: 21338
Зарегистрирован: 24 сен 2011, 14:22
Откуда: Харьков
Контактная информация:

Re: Chromium инструментарий

Непрочитанное сообщение Olej » 20 авг 2021, 14:21

Olej писал(а):
20 авг 2021, 12:44
Возвращаемся:
Использую тот бинарный экземпляр gn который скачан готовым из их сборки - Getting a binary
You can download the latest version of GN binary for Linux, macOS and Windows from Google's build infrastructure (see “Versioning and distribution” below for how this is expected to work).

Код: Выделить всё

olej@R420:~/2021/OWN_TEST.codes/GN/examples/simple_build$ ../../out/gn gen -C out
Done. Made 3 targets from 4 files in 4ms
И теперь дерево примеров приняло вид:

Код: Выделить всё

olej@R420:~/2021/OWN_TEST.codes/GN$ tree examples 
examples
└── simple_build
    ├── build
    │   ├── BUILDCONFIG.gn
    │   ├── BUILD.gn
    │   └── toolchain
    │       └── BUILD.gn
    ├── BUILD.gn
    ├── hello.cc
    ├── hello_shared.cc
    ├── hello_shared.h
    ├── hello_static.cc
    ├── hello_static.h
    ├── out
    │   ├── args.gn
    │   ├── build.ninja
    │   ├── build.ninja.d
    │   ├── obj
    │   │   ├── hello.ninja
    │   │   ├── hello_shared.ninja
    │   │   └── hello_static.ninja
    │   └── toolchain.ninja
    ├── README.md
    └── tutorial
        ├── README.md
        └── tutorial.cc

6 directories, 19 files
Видно, что сгенерированы скрипты в новый внутренний каталог out.

Аватара пользователя
Olej
Писатель
Сообщения: 21338
Зарегистрирован: 24 сен 2011, 14:22
Откуда: Харьков
Контактная информация:

Re: Chromium инструментарий

Непрочитанное сообщение Olej » 20 авг 2021, 14:24

Olej писал(а):
20 авг 2021, 14:21
Видно, что сгенерированы скрипты в новый внутренний каталог out.
И всё готово для сборки:

Код: Выделить всё

olej@R420:~/2021/OWN_TEST.codes/GN/examples/simple_build$ ninja -C out
ninja: Entering directory `out'
[6/6] LINK hello

olej@R420:~/2021/OWN_TEST.codes/GN/examples/simple_build$ out/hello 
Hello, world

Код: Выделить всё

olej@R420:~/2021/OWN_TEST.codes/GN/examples/simple_build$ ls -l out
итого 56
-rw-rw-r-- 1 olej olej    53 авг 20 13:37 args.gn
-rw-rw-r-- 1 olej olej   577 авг 20 13:37 build.ninja
-rw-rw-r-- 1 olej olej   111 авг 20 13:37 build.ninja.d
-rwxrwxr-x 1 olej olej 16824 авг 20 14:21 hello
-rwxrwxr-x 1 olej olej 15760 авг 20 14:21 libhello_shared.so
drwx------ 2 olej olej  4096 авг 20 14:21 obj
-rw-rw-r-- 1 olej olej  1429 авг 20 13:37 toolchain.ninja

Код: Выделить всё

olej@R420:~/2021/OWN_TEST.codes/GN/examples/simple_build$ ldd out/hello
	linux-vdso.so.1 (0x00007ffe26730000)
	libhello_shared.so => /home/olej/2021/OWN_TEST.codes/GN/examples/simple_build/out/libhello_shared.so (0x00007fb4f1417000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb4f120b000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fb4f1423000)
Собран исполнимый ELF файл и соответствующая ему shared библиотека .so
Вложения
GN.tgz
(1.93 МБ) 34 скачивания

Аватара пользователя
Olej
Писатель
Сообщения: 21338
Зарегистрирован: 24 сен 2011, 14:22
Откуда: Харьков
Контактная информация:

Re: Chromium инструментарий

Непрочитанное сообщение Olej » 20 авг 2021, 14:56

Olej писал(а):
20 авг 2021, 14:21
Использую тот бинарный экземпляр gn который скачан готовым из их сборки - Getting a binary

Код: Выделить всё

olej@R420:~/2021/OWN_TEST.codes/GN/examples/simple_build$ ls -l ../../out/gn
-rwxr-xr-x 1 olej olej 2355336 дек 31  1979 ../../out/gn
Но теперь использую тот, другой экземпляр gn, который я собирал здесь в теме вручную 3 дня назад (вот отсюда GN):
Olej писал(а):
17 авг 2021, 14:06
P.S. Вообще то, утверждается, что gn может устанавливаться автономно из Google-инструментария - gn / gn

Код: Выделить всё

olej@R420:~/2021/OWN_TEST.codes/GN/examples/simple_build$ ls -l ~/gn/out/gn
-rwxrwxr-x 1 olej olej 2373568 авг 17 16:31 /home/olej/gn/out/gn
Как легко видеть (и по дате и по размеру) - это разные модификации gn (но это и не тот Python-скрипт gn, который используется в дереве Chromium).
Генерация используя этот собранный релиз:

Код: Выделить всё

olej@R420:~/2021/OWN_TEST.codes/GN/examples/simple_build$ ~/gn/out/gn gen -C out
Done. Made 3 targets from 4 files in 5ms

Код: Выделить всё

olej@R420:~/2021/OWN_TEST.codes/GN/examples/simple_build$ ninja -C out
ninja: Entering directory `out'
[2/2] LINK hello

Код: Выделить всё

olej@R420:~/2021/OWN_TEST.codes/GN/examples/simple_build$ out/hello
Hello, world

Аватара пользователя
Olej
Писатель
Сообщения: 21338
Зарегистрирован: 24 сен 2011, 14:22
Откуда: Харьков
Контактная информация:

Re: Chromium инструментарий

Непрочитанное сообщение Olej » 03 сен 2021, 16:25

Olej писал(а):
20 авг 2021, 14:56
Использую тот бинарный экземпляр gn который скачан готовым из их сборки - Getting a binary
Olej писал(а):
20 авг 2021, 14:56
P.S. Вообще то, утверждается, что gn может устанавливаться автономно из Google-инструментария - gn / gn
Olej писал(а):
20 авг 2021, 14:56
Но теперь использую тот, другой экземпляр gn, который я собирал здесь в теме вручную 3 дня назад (вот отсюда GN):
Довольно странная ситуация, когда присутствуют, как минимум, 3 совершенно разных реализации gn ("Generate Ninja") ... одна из которых в дереве исходных кодов Chromium - это вообще Python-серипт, который выполняя проверки дальше вызывает следующие процессы.
Из 2-х бинарных (ELF-формата) реализаций: 1 требует присутствия .git и обязательной настроенной ссылки на сетевой репозиторий GIT, с обновления которого он вообще начинает работу...

Аватара пользователя
Olej
Писатель
Сообщения: 21338
Зарегистрирован: 24 сен 2011, 14:22
Откуда: Харьков
Контактная информация:

Re: Chromium инструментарий

Непрочитанное сообщение Olej » 06 сен 2021, 17:43

Olej писал(а):
03 сен 2021, 16:25
Довольно странная ситуация, когда присутствуют, как минимум, 3 совершенно разных реализации gn ("Generate Ninja") ... одна из которых в дереве исходных кодов Chromium - это вообще Python-серипт, который выполняя проверки дальше вызывает следующие процессы.
Из 2-х бинарных (ELF-формата) реализаций: 1 требует присутствия .git и обязательной настроенной ссылки на сетевой репозиторий GIT, с обновления которого он вообще начинает работу...
Использую вот тот GN именно из полного развёрнутого дерева кодов Chromium:

Код: Выделить всё

olej@R420:~/chromium/src$ pwd
/home/olej/chromium/src
Система help тут самая навороченная, и вариантов генерации предусмотрено множество:

Код: Выделить всё

olej@R420:~/chromium/src$ gn help gen
gn gen [--check] [<ide options>] <out_dir>

  Generates ninja files from the current tree and puts them in the given output
  directory.

  The output directory can be a source-repo-absolute path name such as:
      //out/foo
  Or it can be a directory relative to the current directory such as:
      out/foo

  "gn gen --check" is the same as running "gn check". "gn gen --check=system" is
  the same as running "gn check --check-system".  See "gn help check" for
  documentation on that mode.

  See "gn help switches" for the common command-line switches.

General options

  --ninja-executable=<string>
      Can be used to specify the ninja executable to use. This executable will
      be used as an IDE option to indicate which ninja to use for building. This
      executable will also be used as part of the gen process for triggering a
      restat on generated ninja files and for use with --clean-stale.

  --clean-stale
      This option will cause no longer needed output files to be removed from
      the build directory, and their records pruned from the ninja build log and
      dependency database after the ninja build graph has been generated. This
      option requires a ninja executable of at least version 1.10.0. It can be
      provided by the --ninja-executable switch. Also see "gn help clean_stale".

IDE options

  GN optionally generates files for IDE. Files won't be overwritten if their
  contents don't change. Possibilities for <ide options>

  --ide=<ide_name>
      Generate files for an IDE. Currently supported values:
      "eclipse" - Eclipse CDT settings file.
      "vs" - Visual Studio project/solution files.
             (default Visual Studio version: 2019)
      "vs2013" - Visual Studio 2013 project/solution files.
      "vs2015" - Visual Studio 2015 project/solution files.
      "vs2017" - Visual Studio 2017 project/solution files.
      "vs2019" - Visual Studio 2019 project/solution files.
      "xcode" - Xcode workspace/solution files.
      "qtcreator" - QtCreator project files.
      "json" - JSON file containing target information

  --filters=<path_prefixes>
      Semicolon-separated list of label patterns used to limit the set of
      generated projects (see "gn help label_pattern"). Only matching targets
      and their dependencies will be included in the solution. Only used for
      Visual Studio, Xcode and JSON.

Visual Studio Flags

  --sln=<file_name>
      Override default sln file name ("all"). Solution file is written to the
      root build directory.

  --no-deps
      Don't include targets dependencies to the solution. Changes the way how
      --filters option works. Only directly matching targets are included.

  --winsdk=<sdk_version>
      Use the specified Windows 10 SDK version to generate project files.
      As an example, "10.0.15063.0" can be specified to use Creators Update SDK
      instead of the default one.

  --ninja-executable=<string>
      Can be used to specify the ninja executable to use when building.

  --ninja-extra-args=<string>
      This string is passed without any quoting to the ninja invocation
      command-line. Can be used to configure ninja flags, like "-j".

Xcode Flags

  --xcode-project=<file_name>
      Override default Xcode project file name ("all"). The project file is
      written to the root build directory.

  --xcode-build-system=<value>
      Configure the build system to use for the Xcode project. Supported
      values are (default to "legacy"):
      "legacy" - Legacy Build system
      "new" - New Build System

  --ninja-executable=<string>
      Can be used to specify the ninja executable to use when building.

  --ninja-extra-args=<string>
      This string is passed without any quoting to the ninja invocation
      command-line. Can be used to configure ninja flags, like "-j".

  --ide-root-target=<target_name>
      Name of the target corresponding to "All" target in Xcode. If unset,
      "All" invokes ninja without any target and builds everything.

QtCreator Flags

  --ide-root-target=<target_name>
      Name of the root target for which the QtCreator project will be generated
      to contain files of it and its dependencies. If unset, the whole build
      graph will be emitted.


Eclipse IDE Support

  GN DOES NOT generate Eclipse CDT projects. Instead, it generates a settings
  file which can be imported into an Eclipse CDT project. The XML file contains
  a list of include paths and defines. Because GN does not generate a full
  .cproject definition, it is not possible to properly define includes/defines
  for each file individually. Instead, one set of includes/defines is generated
  for the entire project. This works fairly well but may still result in a few
  indexer issues here and there.

Generic JSON Output

  Dumps target information to a JSON file and optionally invokes a
  python script on the generated file. See the comments at the beginning
  of json_project_writer.cc and desc_builder.cc for an overview of the JSON
  file format.

  --json-file-name=<json_file_name>
      Overrides default file name (project.json) of generated JSON file.

  --json-ide-script=<path_to_python_script>
      Executes python script after the JSON file is generated or updated with
      new content. Path can be project absolute (//), system absolute (/) or
      relative, in which case the output directory will be base. Path to
      generated JSON file will be first argument when invoking script.

  --json-ide-script-args=<argument>
      Optional second argument that will passed to executed script.

Compilation Database

  --export-rust-project
      Produces a rust-project.json file in the root of the build directory
      This is used for various tools in the Rust ecosystem allowing for the
      replay of individual compilations independent of the build system.
      This is an unstable format and likely to change without warning.

  --export-compile-commands[=<target_name1,target_name2...>]
      Produces a compile_commands.json file in the root of the build directory
      containing an array of “command objects”, where each command object
      specifies one way a translation unit is compiled in the project. If a list
      of target_name is supplied, only targets that are reachable from any
      target in any build file whose name is target_name will be used for
      “command objects” generation, otherwise all available targets will be used.
      This is used for various Clang-based tooling, allowing for the replay of
      individual compilations independent of the build system.
      e.g. "foo" will match:
      - "//path/to/src:foo"
      - "//other/path:foo"
      - "//foo:foo"
      and not match:
      - "//foo:bar"
По поддерживаемым платформам IDE отчётливо видно, что вся эта кухня заточена преимущественно под Window ... повторю:

Код: Выделить всё

  --ide=<ide_name>
      Generate files for an IDE. Currently supported values:
      "eclipse" - Eclipse CDT settings file.
      "vs" - Visual Studio project/solution files.
             (default Visual Studio version: 2019)
      "vs2013" - Visual Studio 2013 project/solution files.
      "vs2015" - Visual Studio 2015 project/solution files.
      "vs2017" - Visual Studio 2017 project/solution files.
      "vs2019" - Visual Studio 2019 project/solution files.
      "xcode" - Xcode workspace/solution files.
      "qtcreator" - QtCreator project files.
      "json" - JSON file containing target information

Аватара пользователя
Olej
Писатель
Сообщения: 21338
Зарегистрирован: 24 сен 2011, 14:22
Откуда: Харьков
Контактная информация:

Re: Chromium инструментарий

Непрочитанное сообщение Olej » 06 сен 2021, 18:18

Olej писал(а):
17 авг 2021, 11:35
Генерация тестового проекта:
Возвращаясь к дереву Chromium и тестовому проекту (см. ранее)...
Olej писал(а):
06 сен 2021, 17:43
--ide=<ide_name>
Generate files for an IDE. Currently supported values:
"eclipse" - Eclipse CDT settings file.
"vs" - Visual Studio project/solution files.
(default Visual Studio version: 2019)
"vs2013" - Visual Studio 2013 project/solution files.
"vs2015" - Visual Studio 2015 project/solution files.
"vs2017" - Visual Studio 2017 project/solution files.
"vs2019" - Visual Studio 2019 project/solution files.
"xcode" - Xcode workspace/solution files.
"qtcreator" - QtCreator project files.
"json" - JSON file containing target information
... меня могла бы заинтересовать сборка под qtcreator.
Но для этого нужно иметь установленным (на этом свежем компьютере) сам qtcreator. ;-)

Аватара пользователя
Olej
Писатель
Сообщения: 21338
Зарегистрирован: 24 сен 2011, 14:22
Откуда: Харьков
Контактная информация:

Re: Chromium инструментарий

Непрочитанное сообщение Olej » 06 сен 2021, 18:21

Код: Выделить всё

olej@R420:~/chromium/src/example$ which qtcreator
olej@R420:~/chromium/src/example$
Olej писал(а):
06 сен 2021, 18:18
Но для этого нужно иметь установленным (на этом свежем компьютере) сам qtcreator.

Код: Выделить всё

olej@R420:~/chromium/src/example$ apt show qt5-default
Package: qt5-default
Version: 5.12.8+dfsg-0ubuntu1
Priority: optional
Section: universe/libs
Source: qtbase-opensource-src
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 170 kB
Depends: qtbase5-dev (= 5.12.8+dfsg-0ubuntu1) | qtbase5-gles-dev (>= 5.12.8+dfsg), qtchooser (>= 55-gc9562a1-1~)
Suggests: qt5-qmake, qtbase5-dev-tools
Conflicts: qt4-default
Homepage: https://www.qt.io/developers/
Download-Size: 24,4 kB
APT-Sources: http://ubuntu.org.ua/ubuntu focal/universe amd64 Packages
Description: Qt 5 development defaults package
 Qt — кросс-платформенная инфраструктура для написания приложений с
 пользовательским интерфейсом на C++. Главной особенностью Qt является
 богатый набор графических элементов управления стандартного
 пользовательского интерфейса.
 .
 This package sets Qt 5 to be the default Qt version to be used when using
 development binaries like qmake. It provides a default configuration for
 qtchooser, but does not prevent alternative Qt installations from being
 used.
 .
 This package should not be used for building Debian packages. Take a look
 at https://qt-kde-team.pages.debian.net/packagingqtbasedstuff.html for
 more information.

Код: Выделить всё

olej@R420:~/chromium/src/example$ apt show qtcreator
Package: qtcreator
Version: 4.11.0-2build2
Priority: optional
Section: universe/devel
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 115 MB
Depends: libqt5sql5-sqlite, qml-module-qtqml-models2, qml-module-qtquick-controls (>= 5.5.0~), qml-module-qtquick2 (>= 5.5.0~), qtchooser, qtcreator-data (= 4.11.0-2build2), libc6 (>= 2.29), libclang1-8 (>= 1:7~svn334604-1~+0~), libgcc-s1 (>= 3.0), libkf5syntaxhighlighting5, libllvm8 (>= 1:8~svn298832-1~), libqbscore1.13 (>= 1.12.0), libqt5concurrent5 (>= 5.6.2~), libqt5core5a (>= 5.12.2), libqt5designer5 (>= 5.6.2~), libqt5designercomponents5 (>= 5.6.2~), libqt5gui5 (>= 5.12.2) | libqt5gui5-gles (>= 5.12.2), libqt5help5 (>= 5.9.0), libqt5network5 (>= 5.6.2~), libqt5printsupport5 (>= 5.6.2~), libqt5qml5 (>= 5.2.0~rc1), libqt5quick5 (>= 5.9.0~beta) | libqt5quick5-gles (>= 5.9.0~beta), libqt5quickwidgets5 (>= 5.11.0), libqt5script5 (>= 5.6.2~), libqt5serialport5 (>= 5.9.0), libqt5sql5 (>= 5.6.2~), libqt5widgets5 (>= 5.12.2), libqt5xml5 (>= 5.6.2~), libstdc++6 (>= 9), qtbase-abi-5-12-8, qtdeclarative-abi-5-12-8
Recommends: clang, clang-tidy, gdb, make, qmlscene, qt5-doc, qt5-qmltooling-plugins, qtbase5-dev-tools, qtcreator-doc, qtdeclarative5-dev-tools, qttools5-dev-tools, qttranslations5-l10n, qtxmlpatterns5-dev-tools, xterm | x-terminal-emulator
Suggests: clazy (>= 1.5), cmake, g++, git, kate-data, subversion, valgrind
Breaks: qtcreator-data (<< 4.5.2-2~)
Replaces: qtcreator-data (<< 4.5.2-2~)
Homepage: https://doc.qt.io/qt-5/topics-app-development.html
Download-Size: 29,0 MB
APT-Sources: http://ubuntu.org.ua/ubuntu focal/universe amd64 Packages
Description: интегрированная среда разработки (IDE) для Qt
 Qt Creator — это кросс-платформенная интегрированная среда разработки
 программного обеспечения (IDE), предназначенная для ускорения и упрощения
 разработки программ, основанных на Qt.
 .
 It includes:
  * An advanced C++ code editor
  * Integrated GUI layout and forms designer
  * Project and build management tools
  * Integrated, context-sensitive help system
  * Visual debugger
  * Rapid code navigation tools
  * Supports multiple platforms
  * Qt Quick Designer

Ответить

Вернуться в «Программирование»

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и 6 гостей