Skip to content

Streamline CMake and build system, move to newer protobuf#150

Merged
Otterverse merged 17 commits intoviam-modules:mainfrom
Otterverse:cmake
Jun 22, 2023
Merged

Streamline CMake and build system, move to newer protobuf#150
Otterverse merged 17 commits intoviam-modules:mainfrom
Otterverse:cmake

Conversation

@Otterverse
Copy link
Copy Markdown
Contributor

@Otterverse Otterverse commented Jun 15, 2023

Should be ready for final review. Changes a lot of stuff, but tested a lot so far (but could use more) More notes on testing in comments below.

@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Jun 15, 2023
Copy link
Copy Markdown
Contributor

@jeremyrhyde jeremyrhyde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cd viam-cartographer && ./scripts/build_cartographer.sh && ./scripts/build_viam_cartographer_debug.sh
endif
build: ensure-submodule-initialized buf build-module
cd viam-cartographer && cmake -Bbuild -G Ninja ${EXTRA_CMAKE_FLAGS} && cmake --build build
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we dont have to run the ninja command anymore?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmake --build build runs it. (It says run a build in the directory "build", if the double-naming is confusing.) But if you ever switch to another cmake tooling instead of ninja, it'll run that too.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[q] so if we wanted separate build directories for different architectures, we would modify cmake --build build here?

[nit] if so, could we add a comment here for this, as that's something the slam team wants to look into doing in the future?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, in theory you can just change -Bbuild to -Bbuild-`uname -m` (or whatever name scheme you want, and it'll configure the output there. Then you can actually compile with the same thing just changing build to build-`uname -m` in the final command as well.

More realistically, you'd just want to make them variables in Make, then you can set the BUILD_DIR variable once and use everywhere. Do note that some of the cartographer tests in go are written using cgo and depending on explicit paths (which is why I had to change one) so there's not as easy of a way to handle that.

Likewise, it's not just the cmake part that would need to be per-architecture, as the golang stuff would be as well, so it's likely a bit of a more complex change you really want, to completely split out architectures if you really want to be able to build both in the same code space (without just doing "make clean" instead.)

Copy link
Copy Markdown
Contributor

@jeremyrhyde jeremyrhyde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: When I run the default make command from a new repo, it now downloads artifacts and stops there.

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jun 20, 2023
Copy link
Copy Markdown
Contributor Author

@Otterverse Otterverse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the makefile and renamed the setup script.

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jun 20, 2023
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jun 20, 2023
Copy link
Copy Markdown
Contributor

@jeremyrhyde jeremyrhyde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for answering all my questions James!

Copy link
Copy Markdown
Collaborator

@nicksanford nicksanford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First off:

  1. Thank you so much for this update @Otterverse ! I learned a lot about make and cmake from your PR.
  2. I've left a few questions

@@ -1,30 +0,0 @@
# Copyright 2018 The Cartographer Authors
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't we need this anymore?

@@ -1,143 +0,0 @@
# Copyright 2016 The Cartographer Authors
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't we need this anymore?

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jun 22, 2023
Copy link
Copy Markdown
Contributor Author

@Otterverse Otterverse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answered nick's questions, and removed that stray echo. Also rebased on main. I think it's good hopefully.

@Otterverse Otterverse requested a review from nicksanford June 22, 2023 18:55
@nicksanford
Copy link
Copy Markdown
Collaborator

@Otterverse this looks great to me! Thanks for all the work you put in & for making the cartographer build system much more reliable & maintainable.

@Otterverse Otterverse merged commit ec07b69 into viam-modules:main Jun 22, 2023
@Otterverse Otterverse deleted the cmake branch June 22, 2023 19:16
nicksanford added a commit that referenced this pull request Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test This pull request is marked safe to test from a trusted zone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants