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 option for external libs in CMakeLists #97

Merged
merged 4 commits into from
Jan 6, 2025

Conversation

jeanwsr
Copy link
Contributor

@jeanwsr jeanwsr commented Jan 3, 2025

Recently libxc_itrf2 is added, which links to libxc. But in some cases one may not place the libxc in pyscf/lib/deps. So an option for libxc directory should be added.

@MatthewRHermes
Copy link
Collaborator

Is this necessary? If LibXC were to be installed externally, wouldn't it naturally already be in LD_LIBRARY_PATH? I don't see this kind of option in the PySCF core module.

@jeanwsr
Copy link
Contributor Author

jeanwsr commented Jan 3, 2025

Yes, it is in the LD_LIBRARY_PATH. But that's not sufficient to make it be recognized by cmake. cmake uses the link_directories() command to determine the path of dynamical lib to be used in "cc -L xxx -l xxx". I'm not sure whether there's any other way to do it, like any cmake options?

In pyscf core program, the CMakeLists add CMAKE_INSTALL_PREFIX/lib to link_directories() (See https://github.com/pyscf/pyscf/blob/a0665c4a7bf54e33f01295b3eea390be7a17d76d/pyscf/lib/CMakeLists.txt#L121), which allows users using -DCMAKE_INSTALL_PREFIX to specify the libxc path. This is documented in https://pyscf.org/user/install.html#install-without-internet . The option name is a little bit weird because pyscf itself does not use CMAKE_INSTALL_PREFIX to install anything. Probably it comes from the CMAKE_INSTALL_PREFIX of libcint and libxc in the same installing instruction.

In summary, I think it's necessary to provide the same cmake option as pyscf core do. The name of the option can be discussed: to use XC_DIR as it's simple, or use CMAKE_INSTALL_PREFIX to keep consistency with pyscf, or something else like EXTERNAL_DEPS_DIR.

@MatthewRHermes
Copy link
Collaborator

I see. I would suggest copying the PySCF core-module solution to this issue if possible, just to minimize confusion.

@jeanwsr
Copy link
Contributor Author

jeanwsr commented Jan 4, 2025

Copied.

@jeanwsr jeanwsr changed the title Add XC_DIR in CMakeLists Add option for external libs in CMakeLists Jan 4, 2025
Copy link
Collaborator

@MatthewRHermes MatthewRHermes left a comment

Choose a reason for hiding this comment

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

Cool, thanks

@MatthewRHermes MatthewRHermes merged commit e8036bc into pyscf:master Jan 6, 2025
4 checks passed
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