Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ZSaberLv0 committed Nov 27, 2024
1 parent 711e053 commit 55688b5
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
1 change: 1 addition & 0 deletions ZFLoader/zfproj/cmake/ZFLoader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
35 changes: 35 additions & 0 deletions ZFLoader/zfproj/cmake/ZFLoader/cmake_main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "ZFCore.h"
#include "ZFCore/protocol/ZFProtocolZFMainEntry.h"

#include "ZFImpl/ZFImpl_env.h"

#if ZF_ENV_sys_Windows
#include <Windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
ZFFrameworkInit();

ZFCoreArray<zfstring> 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<zfstring> 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

2 changes: 2 additions & 0 deletions ZFLoader/zfproj_with_src/cmake/ZFLoader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ set(ZF_ROOT_PATH "${PROJECT_SOURCE_DIR}/../../../../../ZFFramework")
include("${ZF_ROOT_PATH}/tools/spec/cmake/util.cmake")
add_compile_options("$<$<CONFIG:DEBUG>:-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")
Expand Down
35 changes: 35 additions & 0 deletions ZFLoader/zfproj_with_src/cmake/ZFLoader/cmake_main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "ZFCore.h"
#include "ZFCore/protocol/ZFProtocolZFMainEntry.h"

#include "ZFImpl/ZFImpl_env.h"

#if ZF_ENV_sys_Windows
#include <Windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
ZFFrameworkInit();

ZFCoreArray<zfstring> 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<zfstring> 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

0 comments on commit 55688b5

Please sign in to comment.