Skip to content

Commit

Permalink
Separate version into in.hh
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Ahrenkiel authored and Phil Ahrenkiel committed Nov 17, 2023
1 parent b59030b commit 3c82620
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 10 deletions.
4 changes: 2 additions & 2 deletions cmake/git-version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ endif()
message("Building ${PROJECT_NAME} ${${PROJECT_NAME}_VRSN_MAJOR}.${${PROJECT_NAME}_VRSN_MINOR}.${${PROJECT_NAME}_VRSN_PATCH}${${PROJECT_NAME}_VRSN_META}")

configure_file(
"${PROJECT_SOURCE_DIR}/src/HPWH.in.hh"
"${PROJECT_BINARY_DIR}/src/HPWH.hh"
"${PROJECT_SOURCE_DIR}/src/HPWHversion.in.hh"
"${PROJECT_BINARY_DIR}/src/HPWHversion.hh"
)
7 changes: 4 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Set HPWHsim Version
add_custom_target(${PROJECT_NAME}_version_header
DEPENDS ${PROJECT_SOURCE_DIR}/src/HPWH.in.hh
DEPENDS ${PROJECT_SOURCE_DIR}/src/HPWHversion.in.hh
COMMAND ${CMAKE_COMMAND}
ARGS -DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}
-DPROJECT_BINARY_DIR=${PROJECT_BINARY_DIR}
Expand All @@ -10,10 +10,11 @@ add_custom_target(${PROJECT_NAME}_version_header
)

set_target_properties(${PROJECT_NAME}_version_header PROPERTIES FOLDER Dependencies/HPWHsim)
include_directories("${PROJECT_BINARY_DIR}/src")
include_directories("${PROJECT_BINARY_DIR}/src" "${PROJECT_SOURCE_DIR}/src")

set(headers
HPWH.in.hh
HPWHversion.in.hh
HPWH.hh
)

set(source
Expand Down
5 changes: 1 addition & 4 deletions src/HPWH.in.hh → src/HPWH.hh
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ namespace Btwxt { class RegularGridInterpolator; };
* excluded from compiling. This is done in order to reduce the size of the
* final compiled code. */

#define HPWHVRSN_MAJOR @HPWHsim_VRSN_MAJOR@
#define HPWHVRSN_MINOR @HPWHsim_VRSN_MINOR@
#define HPWHVRSN_PATCH @HPWHsim_VRSN_PATCH@
#define HPWHVRSN_META "@HPWHsim_VRSN_META@"
#include "HPWHversion.hh"

class HPWH {
public:
Expand Down
21 changes: 21 additions & 0 deletions src/HPWHversion.in.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef HPWHversion_hh
#define HPWHversion_hh

#include <string>
#include <sstream>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <functional>
#include <memory>

#include <cstdio>
#include <cstdlib> //for exit
#include <vector>

#define HPWHVRSN_MAJOR @HPWHsim_VRSN_MAJOR@
#define HPWHVRSN_MINOR @HPWHsim_VRSN_MINOR@
#define HPWHVRSN_PATCH @HPWHsim_VRSN_PATCH@
#define HPWHVRSN_META "@HPWHsim_VRSN_META@"

#endif
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build test tool
include_directories("${PROJECT_BINARY_DIR}/src")
include_directories("${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}/src")

add_executable(testTool main.cc )
add_executable(testTankSizeFixed testTankSizeFixed.cc)
Expand Down

0 comments on commit 3c82620

Please sign in to comment.