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

Support CMake-only build and submoduling. #15

Closed
wants to merge 3 commits into from

Conversation

pvc1989
Copy link
Contributor

@pvc1989 pvc1989 commented Sep 13, 2020

This request has already been proposed in #2 and #7.

The main reason (as I understand) to use a Makefile as a preprocessor is to prepend two #define lines to metis.h, which then might be installed somewhere (currently in ~/local by default). As @karypis mentioned in #2, the attempt made by @zheng-da leaves the burden of defining these macros to the user of (the installed) METIS, since the installed metis.h, which is copied from the source directory, has commented out these two lines.

My attempt is based on the configure_file() command, which sets the values of IDXTYPEWIDTH and REALTYPEWIDTH in the configuration stage. The configured metis.h, which contains the two #defines, will then be used to build the targets in this project, and will be copied to ${CMAKE_INSTALL_PREFIX}/include in the installation stage. At the point of running make install or ninja install (as mentioned by @gruenich in #7), my approach has the same effect as the current Makefile-driven one.

@pvc1989
Copy link
Contributor Author

pvc1989 commented Sep 14, 2020

The second commit is to fix another tiny problem about CMake.

When someone build METIS as a stand-alone project, both ${CMAKE_SOURCE_DIR} and ${CMAKE_CURRENT_SOURCE_DIR} point to the top directory of METIS. Everything is OK.

However, if someone use METIS as a submodule of another project, say "ABC", then ${CMAKE_SOURCE_DIR} will point to the top directory of ABC, which means ${CMAKE_SOURCE_DIR}/GKlib will be ABC/GKlib, rather than ABC/METIS/GKlib or ABC/ThirdParty/METIS/GKlib.

This can be fixed simply by replacing ${CMAKE_SOURCE_DIR}/GKlib with ${CMAKE_CURRENT_SOURCE_DIR}/GKlib, since ${CMAKE_CURRENT_SOURCE_DIR} will be the top directory of the submoduled METIS.

@pvc1989 pvc1989 changed the title Support CMake-only build. Support CMake-only build and submoduling. Sep 14, 2020
@pvc1989
Copy link
Contributor Author

pvc1989 commented Sep 19, 2020


The CMake-only build passed in all of the three typical operating systems, see this run in GitHub Actions for details.
At this point, non-cross-platform scripts (i.e. BUILD-Windows.txt, Makefile, vsgen.bat) can be git rmed from the root directory.

@gruenich
Copy link

Off-topic: Do you mind rebasing your branch and making a forced push? That would reduce this MR to three commits instead of having two merges from master sitting between your changes. Thanks!

@pvc1989 pvc1989 force-pushed the fix-cmake branch 2 times, most recently from c229db4 to 8d6c0e1 Compare September 23, 2020 04:44
@pvc1989
Copy link
Contributor Author

pvc1989 commented Sep 23, 2020

Off-topic: Do you mind rebasing your branch and making a forced push? That would reduce this MR to three commits instead of having two merges from master sitting between your changes. Thanks!

Thanks for your advice. The commit history has been cleaned up.

@pvc1989
Copy link
Contributor Author

pvc1989 commented Dec 16, 2020

The maintainer has made GKlib an external dependency. So this PR cannot been rebased on the targeting branch now.

@pvc1989 pvc1989 closed this Dec 16, 2020
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