From 1122614a930e8bf7af2112526f50de595fad24b8 Mon Sep 17 00:00:00 2001 From: xiaoshuyui <528490652@qq.com> Date: Tue, 30 Apr 2024 22:09:41 +0800 Subject: [PATCH] Update CMakeLists.txt --- windows/runner/CMakeLists.txt | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/windows/runner/CMakeLists.txt b/windows/runner/CMakeLists.txt index fe81c06..2401b8e 100644 --- a/windows/runner/CMakeLists.txt +++ b/windows/runner/CMakeLists.txt @@ -47,8 +47,25 @@ string(REPLACE "/build/windows/x64" "" ROOT_DIR ${P1}) message(STATUS "ROOT_DIR ==> " ${ROOT_DIR}) +# create .env if .env not exists +set(ENV_PATH ${ROOT_DIR}/.env) + +if(NOT EXISTS ${ENV_PATH}) + set(MULTILINE_TEXT + "LLM_BASE =\" your api here \" +LLM_MODEL_NAME =\" your model name here \" +LLM_SK =\" your api key here \" +CHAT_CHAT_BASE = \" your chatchat api here \" + " + ) + file(WRITE ${ENV_PATH} ${MULTILINE_TEXT}) + message("File did not exist, so it was created.") +else() + message("File already exists.") +endif() + add_custom_target(copy-runtime-files ALL - COMMAND ${CMAKE_COMMAND} -E copy ${ROOT_DIR}/.env ${P1}/runner/Debug/.env - COMMAND ${CMAKE_COMMAND} -E copy ${ROOT_DIR}/.env ${P1}/runner/Release/.env - COMMAND ${CMAKE_COMMAND} -E copy ${ROOT_DIR}/.env ${P1}/runner/Profile/.env + COMMAND ${CMAKE_COMMAND} -E copy ${ENV_PATH} ${P1}/runner/Debug/.env + COMMAND ${CMAKE_COMMAND} -E copy ${ENV_PATH} ${P1}/runner/Release/.env + COMMAND ${CMAKE_COMMAND} -E copy ${ENV_PATH} ${P1}/runner/Profile/.env )