-
Notifications
You must be signed in to change notification settings - Fork 45
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
Untangle export files #11
Conversation
This accommodates packages with subpackages (e.g, Trilinos::Teuchos).
Conflicts: package_arch/TribitsWriteClientExportFiles.cmake
The referenced Trilinos bug is gone now, so this is ready to be merged in. |
We need some type of test for export files in TriBITS proper. We have the example TriBITS project like TribitsExampleProject that gets built and tested as part of the TriBITS package build. We can set up a test that configures, builds, and installs TribitsExampleProject and then we can configure and build an example client CMake project that uses the export files. |
I suppose if we just |
Yes, I am thinking that What types of use cases should be tested? Including the entire project's Config.cmake file? Including only selected components from Config.cmake? Including the a set of individual packages Config.cmake? |
We could do both. First finding all packages à la
(or whatever the packages are called), then at the end (or in a separate CMake file
|
Given that these changes touch a lot of parts of TriBITS, I need to merge this in before I continue with my work to improve the configure times for large TriBITS projects. Therefore, I will look over this branch tomorrow see about merging it in (or some modified version of it). |
When used in flexible mode, PACKAGE_NAME is passed in and set, it is not just pulled out of the current scope. Therefore, the call to TRIBITS_SET_DEFINE_CMAKE_CURRENT_LIST_DIR_CODE_SNIPPET() had to be moved down. I add a unit test next that protects this.
…BITS TriBITSPub#11) This provides the most basic protection of this functionality. It is not much but it is something.
…SPub#11) Before, the include guard `_INCLUDE` was getting used when used in flexible mode (not what you want) and the name of the last package was getting used in the <ProjectName>Config.cmake file. This would have caused it to conflict with the include guard from the package's include guard. For example, with TribitsExampleProject (TriBITSExProj), TriBITSExProjConfig.cmake was using the include guard PackageWithSubpackages_INCLUDED. That is not good. With this commit, this is fixed. I will not try to add some automated tests for the generated export files.
…b#11) Here I just turned on the generation of the export files but I am not testing them yet. At least this way I can see what these files look like and we can be assured that we are not crashing the configure. That alone would have stopped one of my previous bad pushes.
CMAKE_CURRENT_LIST_DIR is guaranteed from CMake 2.8.3 on, so since the requirement for 2.8.11, we don't need this anymore.
…riBITSPub#11) Here I have updated the test TribitsExampleProject_ALL_PT_NoFortran so that it installs the project into an install directory then it reads in one of the <Package>Config.cmake files from the install dir to make sure that it is setting the right variables. It was a bit of a pain to set up this test but test represents the very first automated test for generating, installing, and reading in <Package>Config.cmake files. I have not added a test for the project-level <Project>Config.cmake file. But we can just copy and paste the files to create a test of the project-level file. There is also no validate test for the Makefile.export.<Package> files but that test would be created in a similar way.
Nico, I have done quite a bit of work with this and I think I am ready to merge and push. Detailed Review: Reviewing the TriBITS branch nschloe:untangle_export_files ... First, I get access to Nico's git repo:
Here are the commits in that branch:
The full set of files that are changed is given by:
There is just one non-whitespace, non-comment change in the file
I don't know the impliciations of changing the EXPORT argument but that looks reasonble to me. The only change in the file The real changes are all in the one file I added some unit testing for the generation of the Config.cmake files. I also added generation of all the export files for the TribitsExampleProject (TriBITSExProj). I have found a few issues with the version of the code. First, I see that include guards were added to the XXXConfig.cmake files. This include guard did not work when generating flexible export files (it was just This is captured in the new commit:
I am noticing a defect right away in the project export files and that is that they are duplicating libraries. For example, in the generated file:
it shows:
But we don't see duplicated libraries in the package-specific file:
which shows:
or in: /tribits/doc/examples/UnitTests/TriBITS_TribitsExampleProject_ALL_PT_NoFortran/packages/package_with_subpackages/Makefile.export.PackageWithSubpackages
Frankly I don't care if the project-level export files are messed up because none of the projects I care about use them. However, CASL VERA does use the package-level exported makefiles to allow us to build MOOSE as a TriBITS project. More automated test is needed for the generation of these files is needed. For that, I have created the commit:
I have pushed the updated branch to:
I think this branch is ready to merge and push to TriBITS. |
We only need CMake 2.8.3 for this functionality, which is now 4 years old.
The situation where this might occur is cross-compiling for a system with CMake older than 2.8.3. I think we can safely neglect this. |
As of commit c65be90, this should now be pushed to the github/master branch. I am working to sync this with Trilinos as we speak. Once this is synced with Trilinos, I will close this pull request. However, I don't know why Github does not know that this has already been merged? |
Not sure. Didn't push the "Merge" button here? As for the workflow: If you're adding tests to another branch (e.g., master), we could have merge that branch into this one, fix the defects that are revealed by the new tests, and then merge this branch into master. GitHub would have understood better I'm sure.
Feel free to close now. |
This branch is merged but github does not seem to realize this. I wonder what would happen if I clicked "Merge"? |
Closing. |
When used in flexible mode, PACKAGE_NAME is passed in and set, it is not just pulled out of the current scope. Therefore, the call to TRIBITS_SET_DEFINE_CMAKE_CURRENT_LIST_DIR_CODE_SNIPPET() had to be moved down. I add a unit test next that protects this.
…BITS TriBITSPub#11) This provides the most basic protection of this functionality. It is not much but it is something.
…SPub#11) Before, the include guard `_INCLUDE` was getting used when used in flexible mode (not what you want) and the name of the last package was getting used in the <ProjectName>Config.cmake file. This would have caused it to conflict with the include guard from the package's include guard. For example, with TribitsExampleProject (TriBITSExProj), TriBITSExProjConfig.cmake was using the include guard PackageWithSubpackages_INCLUDED. That is not good. With this commit, this is fixed. I will not try to add some automated tests for the generated export files.
…b#11) Here I just turned on the generation of the export files but I am not testing them yet. At least this way I can see what these files look like and we can be assured that we are not crashing the configure. That alone would have stopped one of my previous bad pushes.
…riBITSPub#11) Here I have updated the test TribitsExampleProject_ALL_PT_NoFortran so that it installs the project into an install directory then it reads in one of the <Package>Config.cmake files from the install dir to make sure that it is setting the right variables. It was a bit of a pain to set up this test but test represents the very first automated test for generating, installing, and reading in <Package>Config.cmake files. I have not added a test for the project-level <Project>Config.cmake file. But we can just copy and paste the files to create a test of the project-level file. There is also no validate test for the Makefile.export.<Package> files but that test would be created in a similar way.
ATTENTION: This pull request is tied to Trilinos bug #6228 which must be resolved first.
This pull request is concerned with the structure of the export files.
Up until now, all package export files
include
d the main project configuration export file to get access to their dependent packages. Also, there was only one target export file that incorporated all targets built by the project.The present pull request changes this:
Everything that worked previously still works, in particular the project export files contain the same information as they did before.
One exception is that the pull requires CMake's deprecated
SUBDIRS()
command not to be used. The reason for this is that we need to be sure now thatADD_LIBRARY()
is called before theEXPORT
files are installed.SUBDIRS()
works unpredictably (or probably rather in unexpected ways).Fixes bug #1.