From cab9e97e88d795659710b68bee2afc05576ca48a Mon Sep 17 00:00:00 2001 From: Phil Ahrenkiel Date: Thu, 7 Nov 2024 14:14:14 -0700 Subject: [PATCH] Restore execute_process. --- src/CMakeLists.txt | 41 +++++++++++++++++++---------------------- src/HPWH.cc | 3 +-- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ede7ede6..4547f43e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 diff --git a/src/HPWH.cc b/src/HPWH.cc index 5dca14ed..7de11b3d 100644 --- a/src/HPWH.cc +++ b/src/HPWH.cc @@ -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"];