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

Revert "Export compile definitions for dependent targets" #16924

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

tamiko
Copy link
Member

@tamiko tamiko commented Apr 23, 2024

We have switched to adding target compile definitions to the interface targets recorded in cmake/deal.II/deal.IITargets.cmake.

Here, for the deal.II targets themselves and all external features we configure we record everything that is necessary to compile and link against deal.II successfully. On my system this looks as follows:

# Create imported target dealii::dealii_debug
add_library(dealii::dealii_debug SHARED IMPORTED)

set_target_properties(dealii::dealii_debug PROPERTIES
  INTERFACE_COMPILE_DEFINITIONS "DEBUG"
  INTERFACE_COMPILE_FEATURES "cxx_std_17"
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "dealii::interface_lapack;dealii::interface_mpi;dealii::interface_tbb;dealii::interface_zlib;dealii::interface_boost;dealii::interface_ginkgo;dealii::interface_metis;dealii::interface_petsc;dealii::interface_trilinos;dealii::interface_umfpack;dealii::interface_kokkos;dealii::interface_adolc;dealii::interface_arborx;dealii::interface_arpack;dealii::interface_assimp;dealii::interface_cgal;dealii::interface_gmsh;dealii::interface_gsl;dealii::interface_hdf5;dealii::interface_muparser;dealii::interface_opencascade;dealii::interface_p4est;dealii::interface_scalapack;dealii::interface_slepc;dealii::interface_sundials;dealii::interface_symengine"
  INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "include"
)

# Create imported target dealii::dealii_release
add_library(dealii::dealii_release SHARED IMPORTED)

set_target_properties(dealii::dealii_release PROPERTIES
  INTERFACE_COMPILE_DEFINITIONS "NDEBUG"
  INTERFACE_COMPILE_FEATURES "cxx_std_17"
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "dealii::interface_lapack;dealii::interface_mpi;dealii::interface_tbb;dealii::interface_zlib;dealii::interface_boost;dealii::interface_ginkgo;dealii::interface_metis;dealii::interface_petsc;dealii::interface_trilinos;dealii::interface_umfpack;dealii::interface_kokkos;dealii::interface_adolc;dealii::interface_arborx;dealii::interface_arpack;dealii::interface_assimp;dealii::interface_cgal;dealii::interface_gmsh;dealii::interface_gsl;dealii::interface_hdf5;dealii::interface_muparser;dealii::interface_opencascade;dealii::interface_p4est;dealii::interface_scalapack;dealii::interface_slepc;dealii::interface_sundials;dealii::interface_symengine"
  INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "include"
)

<snip>

set_target_properties(dealii::interface_trilinos PROPERTIES
  INTERFACE_COMPILE_DEFINITIONS "KOKKOS_DEPENDENCE"
  INTERFACE_INCLUDE_DIRECTORIES "/usr/include;/usr/include/trilinos;/usr/include/eigen3;/usr/include/scotch;/usr/include/blacs"
  INTERFACE_LINK_LIBRARIES "<snip>"
  INTERFACE_LINK_OPTIONS "-DKOKKOS_DEPENDENCE"
  INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "/usr/include;/usr/include/trilinos;/usr/include/eigen3;/usr/include/scotch;/usr/include/blacs"
)

<snip>

Now, when linking to deal.II with either the macro deal_ii_setup_target(), or with target_link_libraries(<target> dealii::dealii<|_debug|_release>)
CMake automatically constructs final compile and link options for the target:

/usr/lib/llvm/18/bin/clang++ -DKOKKOS_DEPENDENCE -DNDEBUG <includes> <compile flags> <warning flags> <...> -c .../examples/step-1/step-1.cc
/usr/lib/llvm/18/bin/clang++ <linker flags> -DKOKKOS_DEPENDENCE .../step-1.cc.o <libraries>

Reverified on my machine.

This reverts commit a29f491.

In reference to #16834

Copy link
Member

@gassmoeller gassmoeller left a comment

Choose a reason for hiding this comment

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

I am ok reverting this. It just means I will have to re-check what prompted me to #16834.

Copy link
Member

@masterleinad masterleinad left a comment

Choose a reason for hiding this comment

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

I can confirm that the respective debug and release targets look good and, in particular, contain

INTERFACE_COMPILE_DEFINITIONS "DEBUG"
INTERFACE_COMPILE_DEFINITIONS "NDEBUG"

Copy link
Member

@gassmoeller gassmoeller left a comment

Choose a reason for hiding this comment

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

Ok let's revert this for now. I will see if I can reproduce my original issue, but if it doesnt come up again this is not need.

@gassmoeller
Copy link
Member

/rebuild

@tamiko
Copy link
Member Author

tamiko commented Apr 23, 2024

@gassmoeller Again, apologies for not having spotted the PR earlier.

@kronbichler kronbichler merged commit d67ba3e into dealii:master Apr 24, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants