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 version.h generated from the numbers in CMakeLists.txt #1029

Merged
merged 8 commits into from Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Expand Up @@ -2,6 +2,8 @@

## v3.x.x

* a version.h is created by CMake and installed to access version minor and major from C++.

* MR Geometry
- fixed GadgetronImagesVector::reorient() to only consider slice index
and ignore dimensions such as contrast, repetition etc.
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Expand Up @@ -188,12 +188,16 @@ endif(DISABLE_Matlab)

ENABLE_TESTING()

configure_file("cmake/version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake/version.h")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/cmake/version.h" DESTINATION "${CMAKE_INSTALL_PREFIX}/include/sirf/common/")
paskino marked this conversation as resolved.
Show resolved Hide resolved

ADD_SUBDIRECTORY(src)

include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/setup.py.cmake")
configure_file("cmake/config.py.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake/config.py")
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/cmake/config.py" DESTINATION "${PYTHON_DEST}/sirf")


set(SHARE_DIR ${CMAKE_INSTALL_PREFIX}/share/SIRF-${VERSION_MAJOR}.${VERSION_MINOR})
install(DIRECTORY ${CMAKE_SOURCE_DIR}/examples
COMPONENT DOC
Expand Down
9 changes: 9 additions & 0 deletions cmake/version.h.in
@@ -0,0 +1,9 @@
#ifndef SIRF_VERSION_H
#define SIRF_VERSION_H

#define SIRF_VERSION_MAJOR @VERSION_MAJOR@
#define SIRF_VERSION_MINOR @VERSION_MINOR@
#define SIRF_VERSION_PATCH @VERSION_PATCH@


#endif /* SIRF_VERSION_H */
4 changes: 4 additions & 0 deletions src/common/CMakeLists.txt
Expand Up @@ -105,3 +105,7 @@ if (BUILD_MATLAB)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/+sirf/+Utilities/examples_data_path.m.in" ${MATLAB_DEST}/+sirf/+Utilities/examples_data_path.m)

endif (BUILD_MATLAB)

if(CMAKE_TESTING_ENABLED)
add_subdirectory(tests)
endif()
5 changes: 5 additions & 0 deletions src/common/tests/CMakeLists.txt
@@ -0,0 +1,5 @@
add_executable(test_version test_version.cpp)
target_include_directories(test_version PUBLIC ${CMAKE_BINARY_DIR}/cmake)
paskino marked this conversation as resolved.
Show resolved Hide resolved

add_test(NAME SIRF_TEST_COMMON_CPLUSPLUS
COMMAND test_version )
11 changes: 11 additions & 0 deletions src/common/tests/test_version.cpp
@@ -0,0 +1,11 @@
#include "version.h"
paskino marked this conversation as resolved.
Show resolved Hide resolved
#include <iostream>


int main(int argc, char ** argv){

std::cout << SIRF_VERSION_MAJOR << "." << SIRF_VERSION_MINOR << std::endl;

return 0;

}