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

Tidies up CMake, enables core libraries to build with -Wall -Wextra -… #190

Merged
merged 34 commits into from
Oct 31, 2024

Conversation

luketpickering
Copy link
Contributor

…Werror

  • updates to yaml 0.8.0
  • updates to CPM 0.40.2
  • removes dependency on NuHepMC/CMakeModules
  • sets CXX standard to 17, can probably roll it back, but there is C++17 code in here
  • separates warning/error flags from other compiler flags
    • warnings/errors become a separate interface target that we link privately to library code
  • all core libraries updated (hopefully minimally) to build under stringent compiler checks. Most of this is:
    • myvect.size() -> int(myvect.size())
    • (int)mylong -> int(mylong)
    • (TObj*)SomeROOTFunc() -> static_cast<TObj*>(SomeROOTFunc())
  • Also changes macro types to using declarations

Pull request description

Changes or fixes

Examples

@github-actions github-actions bot added Plotting plotting related MCMC MCMC related Nu Osc/Xsec Related with neutrino interactions or oscialtions Samples Manager Cmake labels Oct 28, 2024
Copy link
Member

@KSkwarczynski KSkwarczynski left a comment

Choose a reason for hiding this comment

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

Thanks a lot for tidyng all of this mess.
I have some minor comments which bots might have not found

CMakeLists.txt Outdated
set(CMAKE_CXX_STANDARD 14)
endif()

# KS: If C++ standard is lower than C++ standard used for ROOT compilation things will go terribly wrong
if(DEFINED ROOT_CXX_STANDARD AND ROOT_CXX_STANDARD GREATER CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD ${ROOT_CXX_STANDARD})
endif()
cmessage(STATUS "CMAKE CXX Standard: ${CMAKE_CXX_STANDARD}")

# KS: ROOT changed cmake in 6.32, we should move avay from using Luke's hack, keep it for due to compatibility
if(ROOT_CXX_STANDARD LESS 14 AND ROOT_VERSION VERSION_LESS 6.32.00)
cmessage(WARNING "ROOT CXX STANDARD: ${ROOT_CXX_STANDARD}")
set(CMAKE_CXX_STANDARD 17)
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh, no its not, if we 'use' the RootUseFile then it sets the standard for the whole compilation, but it doesn't expose directly what standard it uses. I'll just grab the flag-stripping code from NuHepMC

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've put something a bit hacky in for the moment. NuOscillator uses the nuhepmc/cmakemodules still and it ends up setting up root, so I'd need to PR it out of that to properly just let ROOT set itself up. But this builds for the moment

splines/SplineCommon.h Outdated Show resolved Hide resolved
cmake/Modules/MaCh3Dependencies.cmake Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
@KSkwarczynski
Copy link
Member

KSkwarczynski commented Oct 28, 2024

According to CI Minuit2 flag is no longer on
image

if(ROOT_VERSION GREATER_EQUAL 6.32.00 OR ROOT_CXX_FLAGS MATCHES "-DMINUIT2_ENABLED")

we were reyling on ROOT_CXX_FLAGS set via NuHEP Tools
https://github.com/mach3-software/MaCh3/actions/runs/11558478688/job/32170957073?pr=190

@github-actions github-actions bot added the CI/CD CI/CD label Oct 29, 2024
@luketpickering luketpickering force-pushed the feature/picker24/wall-fix branch 3 times, most recently from b5d4fbf to 4d68790 Compare October 30, 2024 10:41
Luke Pickering added 10 commits October 30, 2024 11:18
…Werror

- updates to yaml 0.8.0
- updates to CPM 0.40.2
- removes dependency on NuHepMC/CMakeModules
- sets CXX standard to 17, can probably roll it back, but there is C++17 code
  in here
- separates warning/error flags from other compiler flags
  - warnings/errors become a separate interface target that we link privately to
    library code
- all core libraries updated (hopefully minimally) to build under stringent
  compiler checks. Most of this is:
  * myvect.size() -> int(myvect.size())
  * (int)mylong -> int(mylong)
  * (TObj*)SomeROOTFunc() -> static_cast<TObj*>(SomeROOTFunc())
- Also changes macro types to using declarations
Luke Pickering added 16 commits October 30, 2024 11:22
- Updates note about float types for low memory structs
- adds not about diagnostic disabling
- points NuOscillator at luketpickering fork momentarily to test letting that
  set up ROOT directly.
- builds with DEBUG enabled now as well which was highlighting other issues
  during CI.
`abs` is a C-library function which operates on ints, `fabs` is the float
version. We should use std::abs which is the C++ version that has overloads
(which don't exist in C).
- also catches a few more uses of `abs` rather than `std::abs`.
- also fix bug in ROOT c++ standard constraint
Luke Pickering added 2 commits October 30, 2024 14:10
- make Catch2 find_package quite
- fix bug in GetPentaltyTerm where dial value was an int
- lots of explicit type cats
- ignore useless-cast in lots of places to allow M3::float_t = double/float
  compilation
Copy link
Member

@KSkwarczynski KSkwarczynski left a comment

Choose a reason for hiding this comment

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

Soma comments

cmake/Modules/NuOscillatorSetup.cmake Outdated Show resolved Hide resolved
covariance/covarianceBase.h Outdated Show resolved Hide resolved
covariance/covarianceBase.h Outdated Show resolved Hide resolved
tests/manager_tests.cpp Outdated Show resolved Hide resolved
@KSkwarczynski KSkwarczynski merged commit aae06b6 into develop Oct 31, 2024
11 of 14 checks passed
@KSkwarczynski KSkwarczynski deleted the feature/picker24/wall-fix branch October 31, 2024 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/CD CI/CD Cmake Manager MCMC MCMC related Nu Osc/Xsec Related with neutrino interactions or oscialtions Plotting plotting related Samples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants