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

remove need for SIRF_PATH and SIRF_INSTALL_PATH env variables #1235

Open
KrisThielemans opened this issue Feb 29, 2024 · 0 comments
Open

remove need for SIRF_PATH and SIRF_INSTALL_PATH env variables #1235

KrisThielemans opened this issue Feb 29, 2024 · 0 comments
Assignees
Milestone

Comments

@KrisThielemans
Copy link
Member

We still use the SIRF_PATH env variable explicitly in 2 places in the C++ tests where we should use examples_data_path() instead

std::string SIRF_path = std::getenv("SIRF_PATH");
if (SIRF_path.length() < 1) {

std::string SIRF_path = std::getenv("SIRF_PATH");
if (SIRF_path.length() < 1) {
std::cout << "SIRF_PATH not defined, cannot find data" << std::endl;
return 1;
}

(It is also used in the obsolete matlab code, so let's ignore that).

In fact, we should not have to rely on the STIR_INSTALL_PATH env variable either. This should be resolved by making a .h.in file setting something like

const char * const SIRF_INSTALL_PATH = "@CMAKE_INSTALL_PREFIX@";
const char * const SIRF_INSTALLED_EXAMPLE_DATA_PATH = "@SIRF_EXAMPLE_DATA_PATH";

where the latter is set in CMake, rewriting the following slightly:

set(SHARE_DIR ${CMAKE_INSTALL_PREFIX}/share/SIRF-${VERSION_MAJOR}.${VERSION_MINOR})

SIRF/CMakeLists.txt

Lines 228 to 230 in 6fc60a4

install(DIRECTORY ${CMAKE_SOURCE_DIR}/examples
COMPONENT DOC
DESTINATION ${SHARE_DIR})

After that, examples_data_path() should be rewritten to only use the optional SIRF_DATA_PATH env variable and the new SIRF_INSTALLED_EXAMPLE_DATA_PATH.

Note that the current corresponding doc is not quite accurate. This paragraph should be removed I believe

SIRF/examples/README.md

Lines 41 to 43 in 5ec1fac

Alternatively, `SIRF_PATH` should be set by the user to the full path to the root folder containing the SIRF source,
and `SIRF_INSTALL_PATH` to the full path to the folder where the user installed SIRF binaries and other files (i.e.
set by `CMAKE_INSTALL_PREFIX`).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants