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

Split study in CMakefile #1583

Merged
merged 61 commits into from
Sep 12, 2023
Merged

Split study in CMakefile #1583

merged 61 commits into from
Sep 12, 2023

Conversation

JasonMarechal25
Copy link
Contributor

@JasonMarechal25 JasonMarechal25 commented Aug 23, 2023

  • Move study in a CMakeFile
  • Remove dependency to Study in date

# Conflicts:
#	src/libs/antares/array/matrix.cpp
#	src/libs/antares/memory/memory.cpp
#	src/libs/antares/study/area/area.cpp
Base automatically changed from feature/split_benchmarking to develop August 28, 2023 13:17
JasonMarechal25 and others added 11 commits August 28, 2023 17:00
# 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
Copy link
Member

@flomnes flomnes left a 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 ?

.github/workflows/windows-vcpkg.yml Outdated Show resolved Hide resolved
src/libs/antares/checks/CMakeLists.txt Outdated Show resolved Hide resolved
Comment on lines 405 to 407
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;
Copy link
Member

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

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 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}/../..
Copy link
Member

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"

Copy link
Contributor Author

@JasonMarechal25 JasonMarechal25 Sep 1, 2023

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

Comment on lines +146 to +150
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});
Copy link
Member

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 deleted

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 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

Copy link
Member

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

src/libs/antares/study/parameters/adq-patch-params.h Outdated Show resolved Hide resolved
src/libs/antares/writer/CMakeLists.txt Outdated Show resolved Hide resolved
Comment on lines +77 to +82
Antares::date
Antares::benchmarking
Antares::result_writer
Antares::sys
Antares::infoCollection
Antares::checks
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See #1606 for discussion

src/tools/cleaner/main.cpp Show resolved Hide resolved
* 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
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 15 Code Smells

14.0% 14.0% Coverage
0.0% 0.0% Duplication

@flomnes flomnes merged commit b6d0993 into develop Sep 12, 2023
7 checks passed
@flomnes flomnes deleted the feature/study branch September 12, 2023 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants