@@ -8,11 +8,19 @@ option(EMMY_USE_LUA_SOURCE "Build with lua source" OFF)
88set (LINK_LIBRARIES uv_a)
99
1010file (GLOB SRC_LIST
11- *.cpp *.c proto/*.cpp
11+ *.cpp proto/*.cpp
1212)
1313file (GLOB HEADER_LIST
1414 *.h proto/*.h
1515)
16+ file (GLOB HOOK_LIST
17+ dllmain.cpp hook/*.h hook/*.cpp
18+ hook/libpe/*.h hook/libpe/*.cpp
19+ )
20+ file (GLOB SHARED_LIST
21+ ${CMAKE_SOURCE_DIR} /Shared/*.h
22+ ${CMAKE_SOURCE_DIR} /Shared/*.cpp
23+ )
1624
1725# rapid json
1826add_definitions (-DRAPIDJSON_HAS_STDSTRING)
@@ -21,10 +29,6 @@ if(EMMY_CORE_BUILD_AS_DLL)
2129 add_definitions (-DEMMY_CORE_BUILD_AS_DLL)
2230endif (EMMY_CORE_BUILD_AS_DLL)
2331
24- if (EMMY_BUILD_AS_HOOK)
25- add_definitions (-DEMMY_BUILD_AS_HOOK)
26- endif (EMMY_BUILD_AS_HOOK)
27-
2832if (EMMY_USE_LUA_SOURCE)
2933 add_definitions (-DEMMY_USE_LUA_SOURCE)
3034 include_directories (
@@ -34,35 +38,40 @@ if(EMMY_USE_LUA_SOURCE)
3438else (EMMY_USE_LUA_SOURCE)
3539 file (GLOB SRC_LIST
3640 *.cpp *.c api/*.cpp proto/*.cpp
37- hook/*.cpp
3841 )
3942 file (GLOB HEADER_LIST
4043 *.h api/*.h proto/*.h
41- hook/*.h
4244 )
4345endif (EMMY_USE_LUA_SOURCE)
4446
4547include_directories (
48+ ${CMAKE_SOURCE_DIR} /Shared
4649 ${CMAKE_SOURCE_DIR} /third-party/libuv-1.29.0/include
4750 ${CMAKE_SOURCE_DIR} /third-party/rapidjson-1.1.0/include
4851 ${CMAKE_SOURCE_DIR} /third-party/EasyHook/EasyHookDll
4952)
5053
5154source_group_by_dir(${CMAKE_CURRENT_SOURCE_DIR} SRC_LIST)
5255source_group_by_dir(${CMAKE_CURRENT_SOURCE_DIR} HEADER_LIST)
56+ source_group_by_dir(${CMAKE_CURRENT_SOURCE_DIR} HOOK_LIST)
57+ source_group ("SHME" FILES SHARED_LIST)
5358
5459add_library (emmy_core MODULE ${SRC_LIST} ${HEADER_LIST} )
5560set_target_properties (emmy_core PROPERTIES PREFIX "" )
61+ add_library (emmy_hook MODULE ${SRC_LIST} ${HEADER_LIST} ${HOOK_LIST} ${SHARED_LIST} )
62+ target_compile_definitions (emmy_hook PRIVATE EMMY_BUILD_AS_HOOK)
5663if (WIN32 )
57- add_dependencies (emmy_core EasyHookDll uv_a)
58- target_link_libraries (emmy_core EasyHookDll uv_a)
64+ add_dependencies (emmy_core uv_a)
65+ target_link_libraries (emmy_core uv_a)
66+ add_dependencies (emmy_hook EasyHook uv_a)
67+ target_link_libraries (emmy_hook EasyHook uv_a)
5968else (WIN32 )
6069 add_dependencies (emmy_core ${LINK_LIBRARIES} )
6170 target_link_libraries (emmy_core ${LINK_LIBRARIES} )
6271endif (WIN32 )
6372
6473install (
65- TARGETS emmy_core
66- LIBRARY DESTINATION lib
74+ TARGETS emmy_core emmy_hook
75+ LIBRARY DESTINATION bin
6776 RUNTIME DESTINATION bin
6877)
0 commit comments