Commit Graph

202 Commits

Author SHA1 Message Date
irengrig b207809dba
Correction for what tests to run on CI on Windows with Bazel 0.22.0 (#207)
As Bazel 0.22.0 is broken for rules_foreign_cc on Windows, we do not want to run any tests with this version on CI. So we are selecting the list of tests to run according to recorded-in-workspace Bazel version.
But list of tests can not be empty! Instead, have a test that just prints the Bazel version.
2019-01-29 14:21:31 +01:00
irengrig 8c019a368f
Add bison/yacc example (configure & make) (#206)
For MAC/Linux
2019-01-28 22:10:31 +01:00
irengrig 5511d9e1fe
Launch at least some Windows tests on CI (#201)
All custom tools (MS Visual Studio) information goes into
windows_commands.bzl
2019-01-18 18:43:37 +01:00
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 fcd01e4a23
Fix reference to environment variables in examples, (#199)
provide more hints for configure-make example
2019-01-10 15:51:27 +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 8ec19f3959
Fix build, remove configure-make failing on CI, ubuntu 16 (#179) 2018-12-16 20:57:23 +01:00
irengrig 888a8a67e8
Add example how to produce binaries with configure_make (#178) 2018-12-16 11:35:52 +01:00
irengrig b08610b154
Improve the boost rule including user_options attribute. (#177)
* Improve the boost rule including user_options attribute.

Then --with-<library> parameter can be passed to build only that library
Modify examples to demonstrate how to use it.
However, building examples takes too long time, so do not include them into the tests.
2018-12-07 14:30:41 +01:00
irengrig 5d1cecfa08
Switch libevent example to configure_make implementation. (#175) 2018-12-06 20:11:13 +01:00
irengrig 9a261f7993
Crosstool example + fixes (#174)
* Add crosstool example; does not work with cmake rule yet

the code is taken from Bazel test data (bazel_toolchain_test_data)

* Make crosstool compilation of cmake_external + cc_binary work

To build example, cd examples/cmake_crosstool bazel build //:libhello_test

Changes:
1) Initially suggested in #124: put $EXT_BUILD_ROOT on path, so that relative paths can be resolved by CMake
2) Toolchain tools are references as relative paths, and they themselves refer to external repository with external/ prefix.
This will not work with CMake, as CMake also perform compiler tests and the build is performed in some temp directory.
We need to convert to absolute paths.
I did a trick with checking of $EXT_BUILD_ROOT is defined and then using it as a prefix.
3) I had to change the visibility of the cc-compiler-k8 toolchain to public
4) For CMake crosstool file, CMAKE_C_COMPILER, CMAKE_CXX_COMPILER, CMAKE_AR need to be absolute, so in cases when they are relative and not under external directory, force paths conversion
2018-12-06 18:14:00 +01:00
irengrig d39887d3d6
Do not run configure-make test on mac ci machines for now (#169)
Do not run configure-make test on mac ci machines for now
2018-12-04 18:54:21 +01:00
irengrig c82068dd2d
Correct the reference in Android example (#164) 2018-12-03 11:19:46 +01:00
irengrig 13419882d6
Put each of binary files into OutputGroupInfo under its name. (#148)
Add CMake test for building a binary and using that binary in a test.
2018-10-25 16:28:43 +02:00
irengrig c28320b89d
rename hello world examples (#146) 2018-10-25 12:56:42 +02:00
irengrig b3552bfef8
Fix dynamic libraries (#141)
* move cmake_hello example with static library into a subdirectory

* Fix #139; correct arguments to create_library_to_link

However, the test (which should link the externally built shared library to the calling .c file) fails with assertion that the .so file is in a "wrong" directory, so I am providing it here for additional work [possibly] on Bazel side; and I do not include it into the tests list

* As cc_common.create_library_to_link is now broken for shared libraries,
use the "old" variant cc_common.create_symlink_library_to_link.

As it will later be removed (and create_library_to_link fixed),
it is safe to check for the existence of create_symlink_library_to_link and call it.

Now the test with shared library built by CMake runs, so add it ot the [non-Windows, for now] suite.

* Adapt building shared library with cmake test for mac

* increment version

* Add comment on CMAKE_MACOSX_RPATH
2018-10-23 16:49:20 +02:00
irengrig 4965090335
External C/C++ libraries rules need to pass transitive info (#112)
* External C/C++ libraries rules need to pass transitive info

- to have the same interface as cc_library to hide the "implementation details",
so that the information about the install directory and its contents of non-direct external dependencies of external library was available for external build
- this is particularly needed for configure-make rule, where we do not control the way needed libraries are found, so we want to provide the install directory and the -L, -I flags (include and library directories to be searched) consistently,
pointing to the directories under $EXT_BUILD_DEPS
- as a side effect, *.la files that contained links to absolute paths of dependencies (pointing somewhere under ...sandbox/bazel-out/...) now will point to directories under $EXT_BUILD_DEPS and so will be replaced correctly/will not point to paths under the previous sandbox

* External C/C++ libraries rules need to pass transitive info [improve]
By review comments;

- rename to do not collate with internally reserved list, dir, provider
- rename providers to use the same "foreign_cc" prefix and be shorter
- improve providers description
- return back output groups to do not reduce the flexibility

* External C/C++ libraries rules need to pass transitive info [improve]
By review comments:

- some more renames

* External C/C++ libraries rules need to pass transitive info: version++

* Correct review comments
2018-10-05 22:04:54 +02:00
irengrig c7d13b34e5
Give libgd configure hints with directory paths (#111) 2018-09-21 11:56:24 +02:00
irengrig e1c3ce3ef5
Adjust configure-make: also replace absolute paths in -config files (#109)
+ assert libz, freetype, libpng to be found by configure for libgd
2018-09-21 10:57:02 +02:00
irengrig 29f66a98cd
Correct bugs and make configure-make work on MacOS (#108)
* correct shell utilities: params differ on mac, remove debug print,

+ correct a bug on windows

* Simplify the example, libz is also needed by libgd

* Framework function: simplify code gathering deps, collect_libs public

* Correct configure-make: get all lib files, also built with bazel

and pass them in LDFLAGS; correct the linking paths (add prefix)

* Make maximum line length for shell = 80

* Improve comments to the _InputFiles provider
2018-09-20 20:19:38 +02:00
irengrig aba303eb2a
Make configure-make examples into tests and include into the test list (#107) 2018-09-18 13:44:33 +02:00
irengrig 7d3bdc7e95
Add configure_make rule with zlib, freetype, libpng, libgd examples (#106)
+ fix replacement of the absolute paths in linked directories,
replace only in .pc files for speed
2018-09-18 13:20:58 +02:00
irengrig 4c27a2bb9d
Exclude synthetic tests from Ubuntu 16 on CI (#102)
Their main target is Windows
2018-09-14 15:37:00 +02:00
irengrig ace688c521
Synthetic tests: generate CMake crosstool file only on windows (#101) 2018-09-14 12:45:42 +02:00
irengrig b69aec07b6
Allow synthetic test on Windows (#97) 2018-09-14 10:24:10 +02:00
irengrig 64de227420
Adapt tests for Windows: set .a library name, use crosstool file (#95)
- On Linux, lib is added to the name
- Use CMake crosstool file (needed for Windows)
2018-09-14 10:10:39 +02:00
irengrig 242e932c60
Add CMake synthetic test with two libraries and cc_test (#93) 2018-09-13 14:34:55 +02:00
irengrig 9de19b91fe
Add Windows tests to the list (#91) 2018-09-12 15:41:19 +02:00
irengrig 913f437994
Windows tests: each library should be in a separate directory (#90) 2018-09-12 15:37:12 +02:00
irengrig 169cdca87b
More corrections for building on Windows (#89)
* Get cc_toolchain environment variables also for linking

* Correct environment setup

* Add Windows tests for Ninja and NMake generators
2018-09-12 15:20:31 +02:00
irengrig 86ea154cd9
More windows tests corrections (#87)
* Use rlocation for artifact paths in the test shell scripts

* CMake text tests: split into lines to be good with line separators
2018-09-11 13:55:25 +02:00
irengrig 10ab431c38
Modify hello world example with CMake to build on Windows (#86)
- with MSBuild generator (the path to it should be on the PATH)
- use CMake crosstool file
2018-09-11 13:07:11 +02:00
irengrig 3547a24075
Correct dependency on Ninja: do not depend on ninja if it is local (#84)
Also, provide a variable to put into dependencies, empty in case local ninja is installed, or containing the reference to ninja target
2018-09-10 11:54:59 +02:00
bbarnes52 9949b17fe2 implements pcl cmake_external build rule (#68)
* implements pcl cmake_external build rule

* Improve example with building PCL (Point Cloud Library):

- build boost library and use it as dependency
- add/correct some properties

* implements pcl cmake_external build rule

* Improve example with building PCL (Point Cloud Library):

- build boost library and use it as dependency
- add/correct some properties
2018-09-05 22:24:41 +02:00
irengrig 6f81b6e39e
fix #75 "trying to mutate a frozen object" (#79) 2018-08-31 20:11:12 +02:00
irengrig 8ef43c6f3c
make cmake and ninja build rules be available from util repository (#72) 2018-08-30 17:31:02 +02:00
irengrig 515c15a392
Add a feature of generating CMake toolchain file and writing tools and flags information there (#70)
* cmake toolchain files support

* extract cmake script consruction code into a separate file

for further testing

* simplify cmake script creation code

* first four tests for CMake script creation functions

* + move_dict_values_test for CMake script creation functions

* + reverse_descriptor_dict_test for CMake script creation functions

* + toolchain_and_user_values_test for CMake script creation functions

* add create_cmake_script_no_toolchain_file_test for CMake script creation

* do not insert executable linker rule option if it uses cxx compiler

since it would be the same as default
add one more test for command line

* add test for cmake script with toolchain file

* add test for cmake script with toolchain file with user values

* propagate information about target into CMake toolchain file
2018-08-30 13:12:51 +02:00
irengrig af0871023c
updte example to show out_include_dir usage (#61) 2018-08-24 11:28:34 +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 51e2fac3d8
C ares test (#48)
* c-ares to be built with CMake+Ninja, c-ares version test

* remove not relevant comment
2018-08-21 15:04:12 +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 66f0863c32
do not pass android ndk as additional dependency (#31)
because now it gets passed with the cc_toolchain files
2018-08-17 21:27:27 +02:00
irengrig f1ada8ad32
restore android example BUILD file (#24) 2018-08-13 20:01:39 +02:00
irengrig 21391856d0
first tests for ci (#16) 2018-08-13 12:44:53 +02:00
irengrig 6c11ff4482
move examples into examples directory (#14) 2018-08-13 11:55:05 +02:00
Carmi Grushko 5fda9e82bd
Add code and examples (#1) 2018-04-26 13:52:06 -04:00