Skip to content

Conversation

@LecrisUT
Copy link

@LecrisUT LecrisUT commented Jul 5, 2023

This provides helpful cmake interfaces:

  • Fypp_target_sources equivalent to target_sources. This is the main interface that should be used
  • Fypp_add_library = add_library + Fypp_target_sources
  • Fypp_add_executable = add_executable + Fypp_target_sources

The project is structured such that users can include fypp via FetchContent, e.g.:

cmake_minimum_required(VERSION 3.11)
project(test_fypp LANGUAGES Fortran)

FetchContent_Declare(
  Fypp
  # Pointing to my fork until it is merged
  GIT_REPOSITORY https://github.com/LecrisUT/fypp
  GIT_TAG cmake/cmake
)
FetchContent_MakeAvailable(Fypp)

Fypp_add_executable(test_fypp main.fypp)

Depends on #27, #29

- For backwards compatibility, -D will continue to be interpreted as Python expression until 4.0
- Introduced a temporary variable -d/--define-value-type to switch to the proper interpretation when set to `str`

Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
@LecrisUT LecrisUT marked this pull request as draft September 8, 2023 11:42
@LecrisUT
Copy link
Author

LecrisUT commented Sep 8, 2023

Going to wait for #27 and #29 because it is better to handle the call with python -m fypp

Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
@LecrisUT LecrisUT force-pushed the cmake/cmake branch 2 times, most recently from 5253b78 to 0a1bf9f Compare September 8, 2023 13:59
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
# Append the name of the generated files to the fypp_files
# TODO: This might duplicate the file names when dependency is rerun
COMMAND ${CMAKE_COMMAND} -E echo ${out_file} >> ${target_fypp_files}
COMMAND ${Fypp_EXECUTABLE} -p ${define_flags} ${include_flags} ${source_path} ${out_path}
Copy link
Author

Choose a reason for hiding this comment

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

Use either python -m fypp or pipx --spec /path/to/fypp/module

@eduardz1
Copy link

eduardz1 commented May 5, 2025

I am very interested in this PR, is there something missing or can this be merged, alongside #29 and #27 ?

@LecrisUT
Copy link
Author

LecrisUT commented May 5, 2025

I have various design notes for improvement if someone wants to pick this up again.

@eduardz1
Copy link

eduardz1 commented May 5, 2025

I have various design notes for improvement if someone wants to pick this up again.

I would be interested, yes

@LecrisUT
Copy link
Author

LecrisUT commented May 6, 2025

I have various design notes for improvement if someone wants to pick this up again.

I would be interested, yes

Cool, you can start by breaking up the PRs and ping me for review and I will share change proposals then.

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.

2 participants