-
Notifications
You must be signed in to change notification settings - Fork 99
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
feat: ability to read project major, minor & patch macros #766
base: main
Are you sure you want to change the base?
Conversation
src/fpm_compiler.f90
Outdated
do i = 1, size(version_parts) | ||
if (i == 1) then | ||
version_macros = version_macros//macro_definition_symbol//'PROJECT_VERSION_MAJOR'//'='//version_parts(i) | ||
else if (i == 2) then | ||
version_macros = version_macros//' '//macro_definition_symbol//'PROJECT_VERSION_MINOR'//'='//version_parts(i) | ||
else if (i == 3) then | ||
version_macros = version_macros//' '//macro_definition_symbol//'PROJECT_VERSION_PATCH'//'='//version_parts(i) | ||
end if | ||
end do |
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.
Should those be set automatically or in a similar way as the "VERSION={version}"
syntax for macros? Maybe something like "PROJECT_MAJOR_VERSION={version%major}"
and so on should work.
src/fpm_compiler.f90
Outdated
|
||
|
||
!> Extract the Major, Minor & Patch number from Version Number. | ||
call split(version, version_parts, delimiters='.') |
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.
There is a version_t
which does the parsing of a version number and guarantees that all three components (major, minor, patch) are initialized correctly.
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.
Hi @awvwgk , Sorry for getting late on this one.
I used version_t
for version numbers but to actually get hold of major
, minor
and patch
numbers. I did this in the commit
arteevraina@8186856#diff-3c32b450ab98df7cbf05abbaf7c96e19c556d9de123bb1f576cafe7f7ffb667bR515 but fortran
throws error that num
list is private. Should I make this variable public or is there a way I can get access of minor, major and patch versions from version_t
|
||
character(len=:), allocatable :: version_macros | ||
character(len=:), allocatable :: macro_definition_symbol | ||
character(:), allocatable :: version_parts(:) |
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.
character(:), allocatable :: version_parts(:) | |
character(len=:), allocatable :: version_parts(:) |
integer(compiler_enum), intent(in) :: id | ||
|
||
!> Version number of the target. | ||
character(len=:), allocatable, intent(in) :: version |
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.
Why is version
allocatable
in the same time as intent(in)
?
character(len=:), allocatable, intent(in) :: version | |
character(*), intent(in) :: version |
It's strange that I pushed a commit in https://github.com/arteevraina/fpm/tree/read-version-macros branch and still this PR does not shows that commit. It's actually the same branch 😕 |
This Pull Request adds the ability to read the
PROJECT_VERSION_MAJOR,
PROJECT_VERSION_MINOR
&PROJECT_VERSION_PATCH
and add them as macros.Discussed here : fortran-lang/stdlib#675 (comment)