-
Notifications
You must be signed in to change notification settings - Fork 24
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
Split study in CMakefile #1583
Split study in CMakefile #1583
Conversation
JasonMarechal25
commented
Aug 23, 2023
•
edited
Loading
edited
- Move study in a CMakeFile
- Remove dependency to Study in date
…ry_2 # Conflicts: # src/libs/antares/CMakeLists.txt # src/libs/antares/array/CMakeLists.txt # src/libs/antares/benchmarking/CMakeLists.txt # src/libs/antares/checks/CMakeLists.txt # src/libs/antares/correlation/CMakeLists.txt # src/libs/antares/logs/CMakeLists.txt # src/libs/antares/memory/memory.cpp # src/libs/antares/study/memory-usage.h # src/libs/antares/sys/policy.cpp # src/tests/src/libs/antares/CMakeLists.txt
# Conflicts: # src/libs/antares/array/matrix.cpp # src/libs/antares/memory/memory.cpp # src/libs/antares/study/area/area.cpp
# Conflicts: # src/analyzer/CMakeLists.txt # src/libs/antares/CMakeLists.txt # src/libs/antares/InfoCollection/CMakeLists.txt # src/libs/antares/benchmarking/DurationCollector.cpp # src/libs/antares/correlation/CMakeLists.txt # src/libs/antares/memory/CMakeLists.txt # src/libs/antares/sys/CMakeLists.txt # src/solver/CMakeLists.txt # src/solver/main/CMakeLists.txt # src/solver/simulation/CMakeLists.txt # src/tools/cleaner/CMakeLists.txt # src/tools/config/CMakeLists.txt # src/tools/kirchhoff-cbuilder/main.cpp # src/tools/updater/CMakeLists.txt # src/tools/yby-aggregator/CMakeLists.txt # src/ui/simulator/CMakeLists.txt # src/ui/simulator/application/main/create.cpp # src/ui/simulator/cmake/application.cmake
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add libantares-version
?
Does the build time decrease a bit after this change when editing a deep header, e.g study.h ?
src/libs/antares/date/date.cpp
Outdated
void Calendar::reset(settings settings) | ||
{ | ||
reset(parameters, parameters.leapYear); | ||
} | ||
|
||
void Calendar::reset(const Data::Parameters& parameters, bool leapyear) | ||
{ | ||
// retrieve the new settings | ||
settings.weekday1rstJanuary = parameters.dayOfThe1stJanuary; | ||
settings.firstMonth = parameters.firstMonthInYear; | ||
settings.weekFirstDay = parameters.firstWeekday; | ||
|
||
// We do not retrieve directly the `leapyear` parameters | ||
// A simulation should be made in ignoring this parameter (aka false) | ||
// but the outputs should rely on it (for printing). | ||
// It goes the same for the GUI : since it is _merely_ printing, | ||
// it should be taken into consideration. | ||
// Consequently, we will let the calling code specifying this value | ||
settings.leapYear = leapyear; | ||
|
||
// re-initialize the calendar with the new settings | ||
settings_ = settings; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Pass
settings
by rvalue-reference ? - Class names come with a capital, so that would be
Settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think r-value ref is proper here. It's a lot of supposition to ask for ownership of a value whereas with pass by value we're signifying that we're doing something to the value without impacting the client.
|
||
target_include_directories(study | ||
PUBLIC | ||
${CMAKE_CURRENT_SOURCE_DIR}/../.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this should avoided just like #include "../../header.hpp"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added some comment
#Dirty trick to allow inclusion via <antares/study/X>
# Make more than just study visible but it's the lesser evil for now
The proper way would be to have a proper include folder with all study includes (or split study in several library/objects) but it is in itself a task
calendar.reset({parameters.dayOfThe1stJanuary, parameters.firstWeekday, parameters.firstMonthInYear, false}); | ||
else | ||
calendar.reset(parameters); | ||
calendar.reset({parameters.dayOfThe1stJanuary, parameters.firstWeekday, parameters.firstMonthInYear, parameters.leapYear}); | ||
|
||
calendarOutput.reset(parameters); | ||
calendarOutput.reset({parameters.dayOfThe1stJanuary, parameters.firstWeekday, parameters.firstMonthInYear, parameters.leapYear}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could indeed be passed by &&
. But then make sure to mark the copy constructor as delete
d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if this usage should direct the implementation choice of the interface.
For all intent and purpose, parameters could have a Settings struct instead of several values and e would be passing a copy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that would be nice
Antares::date | ||
Antares::benchmarking | ||
Antares::result_writer | ||
Antares::sys | ||
Antares::infoCollection | ||
Antares::checks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should avoid heterogeneous naming in CMake targets
- infoCollection
- result_writer
- tests-ts-numbers
In other words, we should pick a convention and stick to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #1606 for discussion
* Fix merge * Fix compil * Fix compil * Reestablish -j2 build option as it doesn't change anything removing it * Remove commented code * Use proper casing for s(S)ettings struct * Remove duplicated link dependency * add missing dependency in writer
Kudos, SonarCloud Quality Gate passed! |