Comments (8)
@dirk-thomas At a basic level, we would like to use -ftree-vectorize
and -grecord-gcc-switches
:
-ftree-vectorize
will affect the ABI-grecord-gcc-switches
will allow us to write tools that check that the different binaries are built with the same flags, so we can tell, for example, that a given package didn't add a problematic flag like-fsanitize=address
from ament_cmake.
To clarify which compile options you are referring to (which affect ABI) can you please explicitly enumerate them.
I see a few problems with the described approach:
- Plain CMake packages not using the function would still be subject to ABI incompatibilities.
- In general we don't want to embed ROS specific values like this in
ament*
packages. Maybe ament_cmake_ros would be a better place. (Obviously that would raise the bar of the first bullet to include packages which useament_cmake
but notament_cmake_ros
.)
CMake toolchain files would be one proper way of ensuring the same compiler options are being used across multiple packages. Others would be passing CMAKE_CXX_STANDARD
, CMAKE_CPP_FLAGS
, etc. to CMake.
Should the compile options also be added to
add_test
?
The CMake function add_test
doesn't build any code so I don't think compile options are relevant here.
from ament_cmake.
I like the idea of a toolchain file. I'll look into that and report back.
As for add_test
: maybe I was thinking of packages like ament_add_gtest
, where an executable is created, but I guess this scenario would be addressed by the toolchain file too
from ament_cmake.
@dirk-thomas I've looked into using a toolchain file, and I see two main drawbacks:
- The recommended way of setting a compiler options is with
target_set_compile_option
- Granted, this still leave the issue of plain CMake packages, in which case a toolchain file is still the better solution
- Having to type out the path to the toolchain file when calling
colcon
:
colcon build --cmake-args -DCMAKE_TOOLCHAIN_FILE="$(pwd)/path/to/toolchain.cmake"
I was thinking, I could just add the --cmake-args
to the colcon
defaults.yaml
, but then I would have to hard-code the path, and I would have to change it for different workspaces. Or is there a way to have variables (e.g. PWD
or current work directory) that can be used in the defaults.yaml
?
I also realized I haven't answered the question about which flags affect the ABI. This article gives a good overview of compiler flags and their potential consequences
from ament_cmake.
The recommended way of setting a compiler options is with target_set_compile_option
Granted, this still leave the issue of plain CMake packages, in which case a toolchain file is still the better solution
That is why a toolchain file is the preferred approach.
Having to type out the path to the toolchain file when calling
colcon
:
While that is certainly not convenient there is no reason this can't be improved. That would probably fall into the same category as colcon/colcon-core#168.
I could just add the --cmake-args to the colcon defaults.yaml, but then I would have to hard-code the path, and I would have to change it for different workspaces.
The downside of using defaults.yaml
is that if you pass custom --cmake-args
on the command line they will override your defaults. Using a mixin
is probably more appropriate - but that doesn't solve the need for different configurations for different workspaces if it contains workspace specific paths.
I also realized I haven't answered the question about which flags affect the ABI. This article gives a good overview of compiler flags and their potential consequences
That doesn't really answer the question which of the flags you want to use.
from ament_cmake.
@dirk-thomas Would it be viable to extend colcon
to allow variables in the defaults.yaml
or metadata files?
from ament_cmake.
Would it be viable to extend
colcon
to allow variables in thedefaults.yaml
or metadata files?
Of course 👍
from ament_cmake.
Closing due to no activity. It also sounds like the direction is to address this on the build tool level instead.
from ament_cmake.
Related Issues (20)
- Backporting features from `ament_cmake_extension` to `ament_cmake_auto`
- add support for COMPONENTS in `ament_export_dependencies` HOT 2
- "Files to be generated by multiple different commands" Problem in Iron HOT 2
- Using install(DIRECTORY ... TYPE ...) results in "can't find error"
- Using install(DIRECTORY ... TYPE ...) results in "can't find error" HOT 1
- Resolving ament packages at build time HOT 4
- ament_vendor should be able to use mirror site of git HOT 2
- ament_vendor() does not install vendor project to correct path HOT 1
- How to install ament on ubuntu20.04? Or build front the source? HOT 1
- Question about `ament_export_include_directories(include)` and `${PACKAGE_INCLUDE_DIRS}`. HOT 3
- Exporting dependencies of header-only (interface) libraries to downstream packages HOT 3
- ament_pack_build_configuration is very slow for many dependencies HOT 4
- PRIVATE option to ament_target_dependencies does not work HOT 1
- Add support for gmock in ament_cmake_auto
- Enable compulsory sign-off for ament organization or ament_cmake repo? HOT 3
- Backport `ament_auto_add_gmock` to humble HOT 3
- Fix compiler warnings related to gtest/gmock (backport #408 to humble) HOT 2
- ament cmake core fails on unexpected keyword argument 'encoding' HOT 1
- Installing Python3.12 causes import error: No module named 'distutils' HOT 3
- ament_export_dependencies can't export all PkgConfig projects found in CMake HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ament_cmake.