From 55688b5ae07552eeae2ecccaa4dc195a5c760742 Mon Sep 17 00:00:00 2001 From: ZSaberLv0 Date: Thu, 28 Nov 2024 00:06:37 +0800 Subject: [PATCH] update --- ZFLoader/zfproj/cmake/ZFLoader/CMakeLists.txt | 1 + ZFLoader/zfproj/cmake/ZFLoader/cmake_main.cpp | 35 +++++++++++++++++++ .../cmake/ZFLoader/CMakeLists.txt | 2 ++ .../cmake/ZFLoader/cmake_main.cpp | 35 +++++++++++++++++++ 4 files changed, 73 insertions(+) create mode 100644 ZFLoader/zfproj/cmake/ZFLoader/cmake_main.cpp create mode 100644 ZFLoader/zfproj_with_src/cmake/ZFLoader/cmake_main.cpp diff --git a/ZFLoader/zfproj/cmake/ZFLoader/CMakeLists.txt b/ZFLoader/zfproj/cmake/ZFLoader/CMakeLists.txt index 3ac1e84..ff54606 100644 --- a/ZFLoader/zfproj/cmake/ZFLoader/CMakeLists.txt +++ b/ZFLoader/zfproj/cmake/ZFLoader/CMakeLists.txt @@ -13,6 +13,7 @@ else() endif() file(GLOB_RECURSE ZF_SRC_FILES RELATIVE "${PROJECT_SOURCE_DIR}" + "${PROJECT_SOURCE_DIR}/cmake_main.cpp" "${PROJECT_SOURCE_DIR}/../../../zfsrc/*.c" "${PROJECT_SOURCE_DIR}/../../../zfsrc/*.cpp" "${PROJECT_SOURCE_DIR}/../../../zfsrc_ext/*.c" diff --git a/ZFLoader/zfproj/cmake/ZFLoader/cmake_main.cpp b/ZFLoader/zfproj/cmake/ZFLoader/cmake_main.cpp new file mode 100644 index 0000000..919e9ca --- /dev/null +++ b/ZFLoader/zfproj/cmake/ZFLoader/cmake_main.cpp @@ -0,0 +1,35 @@ +#include "ZFCore.h" +#include "ZFCore/protocol/ZFProtocolZFMainEntry.h" + +#include "ZFImpl/ZFImpl_env.h" + +#if ZF_ENV_sys_Windows +#include +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { + ZFFrameworkInit(); + + ZFCoreArray params; + ZFCoreArgSplit(params, lpCmdLine); + if(params.count() > 0) { + params.removeFirst(); + } + zfint ret = ZFMainExecute(params); + + ZFFrameworkCleanup(); + return (int)ret; +} +#else // #if ZF_ENV_sys_Windows +int main(int argc, char **argv) { + ZFFrameworkInit(); + + ZFCoreArray params; + for(int i = 1; i < argc; ++i) { + params.add(argv[i]); + } + zfint ret = ZFMainExecute(params); + + ZFFrameworkCleanup(); + return (int)ret; +} +#endif // #if ZF_ENV_sys_Windows + diff --git a/ZFLoader/zfproj_with_src/cmake/ZFLoader/CMakeLists.txt b/ZFLoader/zfproj_with_src/cmake/ZFLoader/CMakeLists.txt index 50d7fc8..03e34ca 100644 --- a/ZFLoader/zfproj_with_src/cmake/ZFLoader/CMakeLists.txt +++ b/ZFLoader/zfproj_with_src/cmake/ZFLoader/CMakeLists.txt @@ -11,6 +11,8 @@ set(ZF_ROOT_PATH "${PROJECT_SOURCE_DIR}/../../../../../ZFFramework") include("${ZF_ROOT_PATH}/tools/spec/cmake/util.cmake") add_compile_options("$<$:-DDEBUG>") +set(ZF_SRC_FILES ${ZF_SRC_FILES} "${PROJECT_SOURCE_DIR}/cmake_main.cpp") + function(ZFAddSrc ZF_LIB_NAMES_ LIB_NAME_ ZF_SRC_FILES_ PROJ_PATH_) set(${ZF_LIB_NAMES_} ${${ZF_LIB_NAMES_}} ${LIB_NAME_} PARENT_SCOPE) file(GLOB_RECURSE zfprojConfigPath "${PROJ_PATH_}/zfproj/cmake/${LIB_NAME_}/zfprojConfig.cmake") diff --git a/ZFLoader/zfproj_with_src/cmake/ZFLoader/cmake_main.cpp b/ZFLoader/zfproj_with_src/cmake/ZFLoader/cmake_main.cpp new file mode 100644 index 0000000..919e9ca --- /dev/null +++ b/ZFLoader/zfproj_with_src/cmake/ZFLoader/cmake_main.cpp @@ -0,0 +1,35 @@ +#include "ZFCore.h" +#include "ZFCore/protocol/ZFProtocolZFMainEntry.h" + +#include "ZFImpl/ZFImpl_env.h" + +#if ZF_ENV_sys_Windows +#include +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { + ZFFrameworkInit(); + + ZFCoreArray params; + ZFCoreArgSplit(params, lpCmdLine); + if(params.count() > 0) { + params.removeFirst(); + } + zfint ret = ZFMainExecute(params); + + ZFFrameworkCleanup(); + return (int)ret; +} +#else // #if ZF_ENV_sys_Windows +int main(int argc, char **argv) { + ZFFrameworkInit(); + + ZFCoreArray params; + for(int i = 1; i < argc; ++i) { + params.add(argv[i]); + } + zfint ret = ZFMainExecute(params); + + ZFFrameworkCleanup(); + return (int)ret; +} +#endif // #if ZF_ENV_sys_Windows +