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

Update utilities #1663

Draft
wants to merge 44 commits into
base: dev
Choose a base branch
from
Draft

Update utilities #1663

wants to merge 44 commits into from

Conversation

tomaszkax86
Copy link
Contributor

@tomaszkax86 tomaszkax86 commented May 8, 2024

This pull requests updates a variety of CMake and system utilities.

General list of changes:

  • CSystemUtils is now a proper singleton; you're not meant to create multiple not fully initialized instances of it.
  • Time utilities now use std::chrono::steady_clock instead of std::chrono::high_resolution_clock. This fixes a problem with negative time counter differences.
  • Extracted compiler- and platform-specific configuration to separate CMake files. With this change it should be easier to port Colobot to other platforms and use different compilers.
  • The game can be run in a different directory than the executable's directory. Helps run the game from build directory on multi-config build systems.
  • Removed some of explicit compiler options. These options should be specified by the user or in CMake configuration profiles.
  • Changed default build type to RelWithDebInfo. There's no point in using Debug by default.
  • Moved error handling (signal handlers) to CSystemUtils
  • Implemented stack trace in critical error messages for Windows

tomaszkax86 and others added 30 commits April 17, 2024 12:07
We have DEV_BUILD and we have COLOBOT_DEVELOPMENT_MODE. It was unclear to me which does what and which one I should use.

It turned out that DEV_BUILD has exactly the same effect as PORTABLE_SAVES.

I removed the DEV_BUILD option to reduce confusion.
@hexagonrecursion
Copy link
Contributor

  • Time utilities now use std::chrono::steady_clock instead of std::chrono::high_resolution_clock. This fixes a problem with negative time counter differences.

@tomaszkax86
Copy link
Contributor Author

It should. High-res clock isn't guaranteed to be monotonic and can be aliased to system clock. So it can go back in time when the system randomly chooses to update the system clock. Steady clock is guaranteed to be monotonic and never go back in time.

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.

None yet

2 participants