2
0
Fork 0
mirror of https://github.com/bazel-contrib/rules_foreign_cc synced 2024-11-25 17:31:25 +00:00
Commit graph

17 commits

Author SHA1 Message Date
irengrig c51480261c
Extract shell fragments into a toolchain (#196)
* Extract shell fragments into a toolchain

Construct script in framework.bzl using special notation for calling
shell fragments, defining and referencing environment variables;
have the script converted from this special notation into a real script
(see README.md notes.)
The special notation is used to keep script construction in code still readable.

Tools scripts (cmake, ninja) were also converted.

* Fix reference to environment variables in examples

.. and reference it correctly $$var_name$$ so it is replaced further

* Review comments: documentation, explicitly mark functions from toolchain

- mark functions from shell toolchain as ##funname##, so that they
can not be mixed with usual shell functions

* Fix operating system name for windows in toolchain file

* Additional env vars for windows

* Correct cmake tool build

* Do not build ninja on Windows

* When run on Windows under msys, find utility from Window could "leak"...

into the script. Use heuristics to use /usr/bin/find if it exists.
Also, use pwd -W to get Windows-styled paths (for cmake)
2019-01-18 18:06:10 +01:00
irengrig 99ea1b09fc
Extract cmake and ninja into a toolchain; provide defaults. (#192)
* Extract cmake and ninja into a toolchain; provide defaults.

In the workspace-level rule registration function, default toolchain
implementations are registered for all platforms, which are calling
the cmake and ninja just by name, assuming they are preinstalled.

Also, the user can pass the custom toolchains in the initialization
function, they will be registered before the defaults.

* Do not run ninja build test for now without nested workspaces support

* Corrections after merge

* Always build ninja from sources for tests, correct initialization order

* Add example of using prebuilt artefact in the native tools toolchain.

* Review comments, have native_tool_toolchain#target, not label

+ improve documentation

* Correct ninja toolchain label

* Correct documentation in native_tools_toolchain.bzl
2019-01-08 12:25:16 +01:00
irengrig 006d5f6f8b
Reorganize examples to be in a separate workspace (#188)
* Reorganize examples to be in a separate workspace

This will help to define native tools toolchains for examples

* Remove examples-related part from main WORKSPACE file

* Copy .bazelrc to the examples workspace.

* correction for Bazel HEAD compatibility

* Changes to run nested workspace tests from main workspace
2019-01-07 10:31:27 +01:00
irengrig 8ef43c6f3c
make cmake and ninja build rules be available from util repository (#72) 2018-08-30 17:31:02 +02:00
irengrig a46bef4945
make framework function work on apple: (#63)
- initialize apple tools on workspace level properly using universal install_ws_dependency() function
- pass proper environment variables to the shell script action
- pass proper hidden attributes to framework function rules in case of osx os
- also, clean up WORKSPACE file putting example repositories into a separate file
- correct: repositories needed by framework function itself should be defined in the same single function in workspace_definitions.bzl
- unfortunately, it is not possible to move android initialization anywhere from WORKSPACE file
2018-08-27 14:56:16 +02:00
irengrig b382ac435e
add pcl library targets - not ready yet (#59)
more dependencies need to be provided
2018-08-22 22:30:29 +02:00
irengrig d4880f8fac
build cmake if it is missing (should be configurable) (#57) 2018-08-22 22:06:37 +02:00
irengrig cefeeaf82d
add nghttp2 example with test (#51) 2018-08-22 10:22:56 +02:00
irengrig 7865d29bb4
use Skylark definition of http_archive (#50) 2018-08-22 10:16:44 +02:00
irengrig 04791568c5
Add cares build (#45) 2018-08-20 22:45:35 +02:00
irengrig eb8f2a461c
Add ninja tool as the separate rule + version test (#44) 2018-08-20 22:24:42 +02:00
irengrig 8590cb0da8
Add building example with pybind11 (#43)
- demonstrates loading CMake scripts from externally built library for use in the dependent external library CMake build
2018-08-20 21:41:16 +02:00
irengrig cfa5c56f23
Add build libgd example, add it to tests (#42)
Unfortunately, many additional variables needed to make CMake find libraries.
2018-08-20 21:22:45 +02:00
irengrig be719ee2fc
correct workspace_definitions.bzl, do not include self (#21)
* correct workspace_definitions.bzl, do not include self

* use workspace definitions from WORKSPACE
2018-08-13 15:02:25 +02:00
irengrig 067d4be22e
use tools paths and flags from the toolchain (#7)
* take tools paths and flags from the toolchain

* correct toolchain data extraction, correct cmake flags and environment

* framework script: export variables intended to be used in config script

config script can create child processes which could use this variables

* cmake: prepend relative [to the execroot] paths with "$EXT_BUILD_ROOT/"

unfortunately, CMake does not understand relative paths
(sometimes it runs tests for the passed compiler and for that
concatenates the passed relative path to some tmp directory created for test)

we replace only paths starting with external/ and <top-package-name>/,
so we are quite fine to not make a mistake with replacing some not related to paths text;
the targets for replacement take very different form (judging by examining
toolchain definitions), for instance "-Lexternal/something"

* test data for cross compilation for android and with --crosstool_top

data files taken from bazel examples and bazel test data;

NB one of the interesting things is that we need to specify tools dependency on android sdk and ndk, so that cmake_external shell script have access to these tools

* remove cross compilation example with CROSSTOOL for now

* add very simple CMake library (test data)

* rename target to indicate it is not a test, but example

* adjust android example:

rename the target to indicate it is not a test but example,
add android ndk sources as additional tool for cmake target,
(otherwise it is not available in sandbox)
use more simple cmake-built library

* corrections to the framework & cmake:

- correct search for the root directory of the filegroup (when it is not under external)
- it was a mistake to specify shared library linker, specify CMAKE_AR instead
- unfortunately, I have not discovered how to modify CMake behaviour to pass the custom static flags (rcsD) before "-qc <target>" to the ar linker; option from documentation does not work. To be investigated. For now, do not pass the static cxx linker options, taken from Bazel toolchain.
2018-08-06 15:23:18 +02:00
irengrig 0fd3a22fbc
external build framework function and cmake_external rule (#4)
* external build framework macro and cmake_external rule

* declare deps headers as inputs as well; correct sed expression

* use symlinking instead of copying, filter duplicates

* correct detect root

* corrections for copying tools and include directories

* correct review comments

* provide a way to pass modified attributes to the framework function

create a function that creates a dict from ctx.attr,
replaces/adds values and creates a resulting struct;
have mandatory attributes as mandatory parameters to this function

* correct review comments

* correct detect_root

* introduce parameter for passing user defined link options

* add documentation, define default static library to be built

* correct/improve documentation

* more correct gathering headers and include directories from dependencies

* correct review comments

* correct passing transitive link options
2018-07-30 12:56:09 +02:00
Carmi Grushko 5fda9e82bd
Add code and examples (#1) 2018-04-26 13:52:06 -04:00