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

Add native cmake support #28

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft

Add native cmake support #28

wants to merge 11 commits into from

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 <[email protected]>
@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 <[email protected]>
Signed-off-by: Cristian Le <[email protected]>
Signed-off-by: Cristian Le <[email protected]>
Signed-off-by: Cristian Le <[email protected]>
Signed-off-by: Cristian Le <[email protected]>
Signed-off-by: Cristian Le <[email protected]>
Signed-off-by: Cristian Le <[email protected]>
@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 <[email protected]>
# 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

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.

None yet

1 participant