Skip to content

Commit

Permalink
Restore execute_process.
Browse files Browse the repository at this point in the history
  • Loading branch information
spahrenk committed Nov 7, 2024
1 parent 2be4504 commit cab9e97
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 24 deletions.
41 changes: 19 additions & 22 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,25 @@ set(pythonScriptDir "${PROJECT_SOURCE_DIR}/scripts/python")
set(dataModelDir "${PROJECT_SOURCE_DIR}/vendor/hpwh_data_model")
set(genCodeDir "${PROJECT_SOURCE_DIR}/src/hpwh_data_model")

if (NOT ${PROJECT_NAME}_DATA_MODEL_GENERATED)
include(poetry-install)
install_poetry()
execute_process(
COMMAND ${CMAKE_COMMAND} -E make_directory "${dataModelDir}"

COMMAND ${GIT_EXECUTABLE} submodule update --init "${dataModelDir}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT

COMMAND poetry run python "${pythonScriptDir}/data_model/build_data_model.py" "${PROJECT_SOURCE_DIR}" "${dataModelDir}" "${genCodeDir}"
WORKING_DIRECTORY "${pythonScriptDir}"
RESULT_VARIABLE result1
ERROR_VARIABLE errors1
OUTPUT_VARIABLE outputs1)


set(${PROJECT_NAME}_DATA_MODEL_GENERATED TRUE CACHE BOOL "Data-model code has been generated" FORCE)
message("Poetry install success? ${result0} ${errors0} ${outputs0}")
message("Update submodule success? ${GIT_SUBMOD_RESULT}")
message("Data-model generation success? ${result1} ${errors1} ${outputs1}")
endif ()
include(poetry-install)
install_poetry()
execute_process(
COMMAND ${CMAKE_COMMAND} -E make_directory "${dataModelDir}"

COMMAND ${GIT_EXECUTABLE} submodule update --init "${dataModelDir}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT

COMMAND poetry run python "data_model/build_data_model.py" "${PROJECT_SOURCE_DIR}" "${dataModelDir}" "${genCodeDir}"
WORKING_DIRECTORY "${pythonScriptDir}"
RESULT_VARIABLE result1
ERROR_VARIABLE errors1
OUTPUT_VARIABLE outputs1)

set(${PROJECT_NAME}_PYTHON_SETUP TRUE CACHE BOOL "Python environment is already setup" FORCE)
message("Poetry install success? ${result0} ${errors0} ${outputs0}")
message("Update submodule success? ${GIT_SUBMOD_RESULT}")
message("Data-model generation success? ${result1} ${errors1} ${outputs1}")

set(headers
HPWHversion.in.hh
Expand Down
3 changes: 1 addition & 2 deletions src/HPWH.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4085,8 +4085,7 @@ void HPWH::readFileAsJSON(string modelName, nlohmann::json& j)
void HPWH::initFromFileJSON(nlohmann::json& j)
{

std::cout << j.dump(2) << "\n";

// std::cout << j.dump(2) << "\n";
auto& j_tank = j["tank"];
auto& j_heatsourceconfigs = j["heat_source_configurations"];

Expand Down

0 comments on commit cab9e97

Please sign in to comment.