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

Improve code quality 1 #8617

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Schildkroet
Copy link
Contributor

Description

This PR does not add any functional changes. It only improves code quality and fixes serveral compile warnings.

Tests

Tested app overall if i encounter any issues.

Additional testing would be appreciated!

@rubienr
Copy link

rubienr commented Mar 1, 2025

Hi @Schildkroet,

I would like to help out w.r.t. warnings. Can sb. point me to docs/guidelines where to find the minimal compiler version OrcaSlicher shall support? I guess the code would benefit from C++17 and above.

Just an example:

int ret = fclose(fp);
(void)ret;

vs.

[[maybe_unused]] int ret = fclose(fp);

Btw. I introduced colored compiler output that helps chasing warnings (also better support for ccache to drastically reduce compiling duration) - #8269:

  • enables ANSI-colored output for GNU or Clang
  • adds -p flag to optionally disable PCH for boosting ccache hit rate

regards, rr

@Schildkroet Schildkroet force-pushed the Improve_Code_Quality_1 branch from b823617 to b76d840 Compare March 1, 2025 13:08
@Schildkroet
Copy link
Contributor Author

Hello @rubienr
thanks for the input. I updated the source since this feature is supported. Orca Slicer uses C++17.

OT
Why is this project always compiling the whole source? I thought cmake only recompiles changed sources?

@rubienr
Copy link

rubienr commented Mar 1, 2025

🤔 good Question!

I guess because with BuildLinux.sh it always re-runs CMake hence regenerates cmake files in build directoy. Once you run BuildLinux.sh and you have a build dir, try cd build && ninja all, you will see that it only re-builds modified and its dependencies. Btw it you install ccache (no special configs required) and turn off PCH (precompiled headers) as in #8269 you will benefit any time from ccache you rm -drf build and run BuildLinux.sh.

In your case the simplest way would be to manually turn PCH off and then compile:

sudo apt install ccache

export SLIC3R_PCH=OFF

rm -drf build
# build from scratch; that takes ages; if it runs out of memory re-try again
BuildLinux.sh -s

# while build is running watch ccache hit rate (will grow the 2nd time you run BuildLinux.sh -s or run ninja manually)
watch ccache -svv

# make your code changes
cd build
ninja

# if you are unsure remove build
cd ..
rm -drf build
BuildLinux.sh -s
# now ccache kicks in (new "build" takes about 1minute)

Depending on your available disk space you may want to reduce ccache, because it is then enabled for any compile job (OrcaSlicer takes just 1GB of cache space). My config is quite simple:

cat ~/.ccache/ccache.conf
max_size = 100G

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.

2 participants