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

SDK compliance of adding api version #111

Merged
merged 5 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions resolve/resolve_defs.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
#cmakedefine RESOLVE_USE_EIGEN
#cmakedefine RESOLVE_USE_KLU
#define RESOLVE_VERSION "@PROJECT_VERSION@"
// #define RESOLVE_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
// #define RESOLVE_VERSION_MINOR @PROJECT_VERSION_MINOR@
// #define RESOLVE_VERSION_PATCH @PROJECT_VERSION_PATCH@

#define RESOLVE_VERSION_MAJOR "@PROJECT_VERSION_MAJOR@"
#define RESOLVE_VERSION_MINOR "@PROJECT_VERSION_MINOR@"
#define RESOLVE_VERSION_PATCH "@PROJECT_VERSION_PATCH@"

// /// Date of build with the format "%Y-%m-%d"
// #define RESOLVE_RELEASE_DATE "@RESOLVE_RELEASE_DATE@"
Expand Down
20 changes: 20 additions & 0 deletions resolve/utilities/version.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <unordered_map>
#include <string>

#include "version.hpp"
#include <resolve/resolve_defs.hpp>

// Function that splits the verison in major minor and patch ints
int ReSolveVersionGetVersion(int *major, int *minor, int *patch) {
*major = atoi(RESOLVE_VERSION_MAJOR);
*minor = atoi(RESOLVE_VERSION_MINOR);
*patch = atoi(RESOLVE_VERSION_PATCH);
return 0;
}

// Function that grabs ReSolves Version as a string
int ReSolveVersionGetVersionStr(std::string &str) {
str = RESOLVE_VERSION;
return 0;
}

18 changes: 18 additions & 0 deletions resolve/utilities/version.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef RESOLVE_VERSION_H
#define RESOLVE_VERSION_H


/**
* Sets major, minor, and patch versions for current ReSolve build. The user is
* responsible for free'ing this memory.
*/
int ResolveVersionGetVersion(int *, int *, int *);
ryandanehy marked this conversation as resolved.
Show resolved Hide resolved

/**
* Sets string with build version for current ExaGO build in format
* "major.minor.patch". The user is responsible for free'ing this memory.
*/
int ReSolveVersionGetVersionStr(std::string &);


#endif
ryandanehy marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 5 additions & 0 deletions tests/functionality/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

]]

# Build basic version test
add_executable(version.exe testversion.cpp)
target_link_libraries(version.exe PRIVATE ReSolve)

# Build KLU+KLU test
add_executable(klu_klu_test.exe testKLU.cpp)
target_link_libraries(klu_klu_test.exe PRIVATE ReSolve)
Expand Down Expand Up @@ -81,6 +85,7 @@ install(DIRECTORY data DESTINATION bin/resolve/tests/functionality)

set(test_data_dir ${CMAKE_SOURCE_DIR}/tests/functionality/)

add_test(NAME version COMMAND $<TARGET_FILE:version.exe> "${test_data_dir}")
add_test(NAME klu_klu_test COMMAND $<TARGET_FILE:klu_klu_test.exe> "${test_data_dir}")
if(RESOLVE_USE_CUDA)
add_test(NAME klu_rf_test COMMAND $<TARGET_FILE:klu_rf_test.exe> "${test_data_dir}")
Expand Down
19 changes: 19 additions & 0 deletions tests/functionality/testversion.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <string>
#include <iostream>


#include <resolve/utilities/version.hpp>
#include <resolve/utilities/version.cpp>

//author: RD
//version test to check to make sure ReSolve's version can be printed


int main(int argc, char *argv[])
{
std::string versionstr;
ReSolveVersionGetVersionStr(versionstr);
std::cout<<"ReSolveVersionGetVersionStr Test: "<<versionstr<<std::endl<<std::endl;;

return 0;
}
pelesh marked this conversation as resolved.
Show resolved Hide resolved