Skip to content

Commit

Permalink
revise version management
Browse files Browse the repository at this point in the history
- manage EPA engine and toolkit api version separately
  • Loading branch information
karosc committed May 9, 2023
1 parent 2e5b21d commit 414a397
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 27 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ endif()


project(swmm-solver
VERSION 5.2.3
VERSION 1.0.0
LANGUAGES C CXX
)

Expand Down
19 changes: 6 additions & 13 deletions extern/version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,17 @@


#define PROJECT "SWMM"
#define ORGANIZATION "Open_Water_Analytics"
#define ORGANIZATION "pyswmm"

#define VERSION "@swmm-solver_VERSION@"
#define VERSION_MAJOR @swmm-solver_VERSION_MAJOR@
#define VERSION_MINOR @swmm-solver_VERSION_MINOR@
#define VERSION_PATCH @swmm-solver_VERSION_PATCH@
#define GIT_HASH "@GIT_HASH@"
#define TK_VERSION "@swmm-solver_VERSION@"
#define TK_VERSION_MAJOR @swmm-solver_VERSION_MAJOR@
#define TK_VERSION_MINOR @swmm-solver_VERSION_MINOR@
#define TK_VERSION_PATCH @swmm-solver_VERSION_PATCH@
#define Tk_GIT_HASH "@GIT_HASH@"

#define PLATFORM "@CMAKE_SYSTEM_NAME@"
#define COMPILER "@CMAKE_C_COMPILER_ID@"
#define COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@"
#define BUILD_ID "@BUILD_ID@"


static inline int get_version_legacy() { \
return VERSION_MAJOR * 10000 + VERSION_MINOR * 1000 + VERSION_PATCH; \
}



#endif /* VERSION_H_ */
3 changes: 1 addition & 2 deletions src/solver/consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
// General Constants
//------------------

// OWA Version string stored in version.h
// #define VERSION 52003
#define VERSION 52003
#define MAGICNUMBER 516114522
#define EOFMARK 0x1A // Use 0x04 for UNIX systems
#define MAXTITLE 3 // Max. # title lines
Expand Down
8 changes: 1 addition & 7 deletions src/solver/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,7 @@ int output_open()
F_SEEK(Fout.file, 0, SEEK_SET);
k = MAGICNUMBER;
fwrite(&k, sizeof(INT4), 1, Fout.file); // Magic number

// OWA EDIT ########################################################
// OWA manages model version differently from EPA SWMM.
//This function call maintains compatibility
k = get_version_legacy();
//##################################################################

k = VERSION;
fwrite(&k, sizeof(INT4), 1, Fout.file); // Version number
k = FlowUnits;
fwrite(&k, sizeof(INT4), 1, Fout.file); // Flow units
Expand Down
5 changes: 3 additions & 2 deletions src/solver/report.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,10 @@ void report_writeLogo()
//
// OWA manages model version differently from EPA SWMM.
{
fprintf(Frpt.file, FMT08);
sprintf(Msg, \
"\n OWA STORM WATER MANAGEMENT MODEL - VERSION v%s (OWA %.10s)",
VERSION, BUILD_ID);
"\n PYSWMM TOOLKIT API - VERSION v%s (%.10s)",
TK_VERSION, BUILD_ID);

fprintf(Frpt.file, "%s", Msg);
fprintf(Frpt.file, FMT09);
Expand Down
4 changes: 2 additions & 2 deletions src/solver/swmm5.c
Original file line number Diff line number Diff line change
Expand Up @@ -774,14 +774,14 @@ int DLLEXPORT swmm_getMassBalErr(float *runoffErr, float *flowErr,
int DLLEXPORT swmm_getVersion()
//
// Input: none
// Output: returns SWMM engine version number in legacy format
// Output: returns SWMM engine version number
// Purpose: retrieves version number of current SWMM engine which
// uses a format of xyzzz where x = major version number,
// y = minor version number, and zzz = build number.
//
// NOTE: Each New Release should be updated in consts.h
{
return get_version_legacy();
return VERSION;
}

//=============================================================================
Expand Down

0 comments on commit 414a397

Please sign in to comment.