Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

third_party dependencies #523

Merged
merged 14 commits into from
Aug 7, 2023
Merged

third_party dependencies #523

merged 14 commits into from
Aug 7, 2023

Conversation

pca006132
Copy link
Collaborator

@pca006132 pca006132 commented Aug 5, 2023

Reincarnation of #402, this uses system gtest if possible and automatically download gtest from github otherwise (e.g. for windows). It will also download tbb and compile from source if the user specified MANIFOLD_PAR=TBB and CMake is unable to find the installation.

I also added optional dependency to Tracy profiler, which is a handy graphical profiler.

@pca006132 pca006132 requested a review from elalish August 5, 2023 08:21
@pca006132 pca006132 changed the title use system gtest if possible third_party dependencies Aug 5, 2023
@codecov
Copy link

codecov bot commented Aug 5, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (1539947) 90.36% compared to head (c749750) 90.37%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #523   +/-   ##
=======================================
  Coverage   90.36%   90.37%           
=======================================
  Files          35       35           
  Lines        4433     4435    +2     
=======================================
+ Hits         4006     4008    +2     
  Misses        427      427           
Files Changed Coverage Δ
src/manifold/src/manifold.cpp 95.66% <100.00%> (+0.02%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

we should make the library type implicit, so users can decide whether or
not to build shared libraries.
Copy link
Owner

@elalish elalish left a comment

Choose a reason for hiding this comment

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

Awesome, this looks great! Can you give any example of what you can do with Tracy? I'm not familiar.

addRun(out, runNormalTransform, tri, meshIDtransform.at(meshID));
Impl::Relation rel;
auto it = meshIDtransform.find(meshID);
if (it != meshIDtransform.end()) rel = it->second;
Copy link
Owner

Choose a reason for hiding this comment

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

Is there a case where this is expected, or should this be an assert?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am not entirely sure, it seems that the our python test cases would somehow trigger this.

Copy link
Owner

Choose a reason for hiding this comment

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

That seems worth investigating. I think it implies we have marked some faces as coming from an ID for which there is no transform. Those things should be 1:1. We definitely don't have much testing of this in the Python bindings, so we could have a bug there.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

indeed, I think I saw this happening previously as well

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

maybe we can make an issue for this and merge this first?

Copy link
Owner

Choose a reason for hiding this comment

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

Sounds good.

pkg_check_modules(TBB tbb)
endif()
if(NOT TBB_FOUND)
message(STATUS "tbb not found, downloading from source")
Copy link
Owner

Choose a reason for hiding this comment

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

💯

src/utilities/include/public.h Outdated Show resolved Hide resolved

find_package(GTest 1.12)
if((NOT GTest_FOUND) OR NOT(GTest_VERSION GREATER_EQUAL 1.12))
message(STATUS "GTest not found, downloading from source")
Copy link
Owner

Choose a reason for hiding this comment

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

@kintel - what do you think of this approach? Would this make consuming our library easier for the likes of OpenSCAD?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks reasonable. It does make the build system depend on having access to github.com, which is a known issue from some countries, as well as for people with limited connectivity, but that's a separate challenge. For OpenSCAD we'll likely try to hit the find_package call, so this should work well for us!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes it depends on access to github by default, but if for some reason that is not possible and find_package still cannot find the package, you can specify the directory by setting -DFETCHCONTENT_SOURCE_DIR_GOOGLETEST. I tried using this for the nix package (it blocks internet connection when building) and it works.

Copy link
Contributor

@kintel kintel Aug 9, 2023

Choose a reason for hiding this comment

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

Awesome! Not familiar with FetchContent..

Copy link
Owner

Choose a reason for hiding this comment

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

Nice - would be good to add that trick to the README somewhere.

@pca006132
Copy link
Collaborator Author

pca006132 commented Aug 6, 2023

I am not familiar with Tracy either :) We should be able to add more client markups to make the profiler easier to use.
For now, we can see the CPU utilization and roughly what functions are running.

image
image
image

no need to use sudo,
and we need some debug flags for good stack capture
@pca006132
Copy link
Collaborator Author

Sadly it seems that some features are not available on OSX.
image

Copy link
Owner

@elalish elalish left a comment

Choose a reason for hiding this comment

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

Thanks!

@pca006132 pca006132 merged commit a7eac92 into elalish:master Aug 7, 2023
23 checks passed
@pca006132 pca006132 deleted the googletest branch August 15, 2023 12:54
@elalish elalish mentioned this pull request Nov 3, 2023
cartesian-theatrics pushed a commit to SovereignShop/manifold that referenced this pull request Mar 11, 2024
* use system gtest if possible

* optional tracy support

* fix meshid not found situation

* try fix CI

* fix ubuntu build

* disable windows tbb build first

* update tbb config

* format

* fix cmake BUILD_SHARED_LIBS

we should make the library type implicit, so users can decide whether or
not to build shared libraries.

* revert public.h changes

* remove version requirement for gtest

* update tracy instructions

no need to use sudo,
and we need some debug flags for good stack capture

* fix js build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants