Skip to content

changes to cmake list to install rol as package#28

Open
rjbaraldi wants to merge 16 commits into
developfrom
cmakechange
Open

changes to cmake list to install rol as package#28
rjbaraldi wants to merge 16 commits into
developfrom
cmakechange

Conversation

@rjbaraldi

Copy link
Copy Markdown
Collaborator

Modified the cmake file to allow for rol to be built as a package.

  • Follow-up addition: should we provide sample build script to help with installation? Website change? I can raise this as an issue for the future.

@rjbaraldi rjbaraldi requested a review from dridzal May 20, 2026 18:58

@dridzal dridzal left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This looks good. Can you add to this PR the change to README.md that goes all the way to make install? Making this change would update the build instructions for our github website. Later, we can copy the instructions to rol.sandia.gov. Also, I am wondering if it would be possible to provide a (very) compact cmake project example that uses ROL, including the cmake file and a ROL::StdVector based example. It could go into Getting Started.

@rjbaraldi

Copy link
Copy Markdown
Collaborator Author

Can do - would you want to change make to cmake or ninja? I haven't tested with make install but I would assume it works.

Re: cmake project example - I was thinking we put the MFEM example hook-up as well somewhere once that's up and running. But for the simple one, perhaps I can raise an issue and put it in a subsequent PR?

@dridzal

dridzal commented May 20, 2026

Copy link
Copy Markdown
Collaborator

would you want to change make to cmake or ninja

You can just use make and make install. In your script, you can test it by deleting the line with ninja and just running plain make.

Regarding the example, I was hoping that it would be compact enough to include in README.md, but it's ok to raise an issue.

@dridzal dridzal left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, looks good.

@rjbaraldi

Copy link
Copy Markdown
Collaborator Author

I'm not sure it would be compact enough to include in the "getting started". Would you want a whole example? To me it feels like a whole website section/page.

@dridzal

dridzal commented May 20, 2026

Copy link
Copy Markdown
Collaborator

feels like a whole website section/page.

Yes, it may be better to have this on rol.sandia.gov.

@GrahamBenHarper GrahamBenHarper left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I can confirm this works on Ubuntu with CMake 3.28.3 and gcc 13.3.0 by linking it against a minimal external example.

$ cmake .
-- CMAKE_PREFIX_PATH=
-- ROL_LIB=/home/gbharpe/Programming/cpp/rol/rol-install/lib/librol.so
-- ROL_INCLUDE_DIR=/home/gbharpe/Programming/cpp/rol/rol-install/include
-- Configuring done (0.0s)
-- Generating done (0.1s)
-- Build files have been written to: /home/gbharpe/Programming/cpp/rol/rol-examples
$ make
[ 50%] Linking CXX executable main
[100%] Built target main
$ ./main 
Hello from ROL
$ cat main.cpp
#include <iostream>
#include "ROL_Ptr.hpp"

int main() {
  ROL::Ptr<int> p;
  std::cout << "Hello from ROL" << std::endl;
}

Comment thread CMakeLists.txt Outdated
@rjbaraldi

Copy link
Copy Markdown
Collaborator Author

We should also include the cmake example.

@GrahamBenHarper GrahamBenHarper left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ROL_config.h is only created in the build directory but not the install directory, so we need to make sure that also gets copied into the install directory

@GrahamBenHarper GrahamBenHarper left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These should fix one problem, but I still see those Teuchos linker errors, which might be a little more tricky

Comment thread CMakeLists.txt Outdated
Comment thread README.md Outdated
Comment thread README.md
rjbaraldi and others added 2 commits May 29, 2026 19:01
Co-authored-by: Graham Harper <GrahamBenHarper@users.noreply.github.com>

@GrahamBenHarper GrahamBenHarper left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That looks good! I've tested that setup and it works for me.

@rjbaraldi

rjbaraldi commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator Author

@dridzal - this is ready to go, but the building ROL as a part of Trilinos test failed. I ran this test on develop to check if it was this branch or not, but that also failed. Do you know the reason?

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.

3 participants