Skip to content

Commit

Permalink
Merge branch 'feature-efficientsaving'
Browse files Browse the repository at this point in the history
  • Loading branch information
GammaPi committed Dec 14, 2021
2 parents e5f6406 + 0b89e9f commit 0bfd261
Show file tree
Hide file tree
Showing 23 changed files with 794 additions and 848 deletions.
55 changes: 28 additions & 27 deletions libScalerHook/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ project(ScalerHook)

# Set global (Relative this folder until reset) compiler options
set(CMAKE_C_STANDARD 11)
set(SCALER_HOOK_COMPILATION_FLAGS "-O2" "-mavx" "-mavx512f" "-mavx512vl" "-Werror")
set(SCALER_HOOK_COMPILATION_FLAGS "-O3" "-g" "-mavx" "-mavx512f" "-mavx512vl" "-Werror")
# https://json.nlohmann.me/integration/cmake/
set(JSON_BuildTests OFF CACHE INTERNAL "")
add_subdirectory(lib/json)
Expand All @@ -12,22 +12,18 @@ add_subdirectory(lib/watcher)
set(ScalerHookSrc
src/ExtFuncCallHook_Linux.cpp
src/ExtFuncCallHookAsm.cpp
src/ExtFuncCallHookPtrace.cpp
src/ExtFuncCallHookBrkpoint.cpp
src/ProcInfoParser.cpp
src/ElfParser.cpp
src/MemTool.cpp
src/MemTool_Linux.cpp
src/MemToolPtrace.cpp
src/FileTool.cpp
src/install.cpp
src/Timer.cpp
src/Config.cpp
src/Serilizable.cpp
src/VMEmulator.cpp
src/InvocationTree.cpp
src/StringTool.cpp
src/breakpoint.cpp)
src/StringTool.cpp)

list(APPEND CMAKE_PREFIX_PATH "/media/umass/datasystem/steven/lib/intel/build/kits/xed-install-base-2021-08-26-lin-x86-64")
find_package(XED REQUIRED)
Expand All @@ -41,34 +37,39 @@ target_link_libraries(ScalerHook-HookManualAsm PUBLIC pthread dl nlohmann_json::
target_compile_definitions(ScalerHook-HookManualAsm PUBLIC XED_ENCODER)
target_compile_options(ScalerHook-HookManualAsm PRIVATE ${SCALER_HOOK_COMPILATION_FLAGS})

add_executable(ScalerHook-HookManualPtrace
src/PtraceHookMain.cpp
${ScalerHookSrc}
)
target_include_directories(ScalerHook-HookManualPtrace PUBLIC src/include lib/inireader)
target_link_libraries(ScalerHook-HookManualPtrace PUBLIC pthread dl nlohmann_json::nlohmann_json xed2 xed2-ild)
target_compile_definitions(ScalerHook-HookManualPtrace PUBLIC XED_ENCODER)
target_compile_options(ScalerHook-HookManualPtrace PRIVATE ${SCALER_HOOK_COMPILATION_FLAGS})

add_executable(ScalerRun
src/injector.cpp)

add_library(ScalerHook-HookBrkpoint SHARED
${ScalerHookSrc})
target_include_directories(ScalerHook-HookBrkpoint PUBLIC src/include lib/inireader)
target_link_libraries(ScalerHook-HookBrkpoint PUBLIC pthread dl nlohmann_json::nlohmann_json xed2 xed2-ild)
target_compile_definitions(ScalerHook-HookBrkpoint PUBLIC XED_ENCODER)
target_compile_options(ScalerHook-HookBrkpoint PRIVATE ${SCALER_HOOK_COMPILATION_FLAGS})

#add_executable(ScalerHook-HookManualPtrace
# src/PtraceHookMain.cpp
# ${ScalerHookSrc}
# )
#target_include_directories(ScalerHook-HookManualPtrace PUBLIC src/include lib/inireader)
#target_link_libraries(ScalerHook-HookManualPtrace PUBLIC pthread dl nlohmann_json::nlohmann_json xed2 xed2-ild)
#target_compile_definitions(ScalerHook-HookManualPtrace PUBLIC XED_ENCODER)
#target_compile_options(ScalerHook-HookManualPtrace PRIVATE ${SCALER_HOOK_COMPILATION_FLAGS})

#
#add_library(ScalerHook-HookBrkpoint SHARED
# ${ScalerHookSrc})
#target_include_directories(ScalerHook-HookBrkpoint PUBLIC src/include lib/inireader)
#target_link_libraries(ScalerHook-HookBrkpoint PUBLIC pthread dl nlohmann_json::nlohmann_json xed2 xed2-ild)
#target_compile_definitions(ScalerHook-HookBrkpoint PUBLIC XED_ENCODER)
#target_compile_options(ScalerHook-HookBrkpoint PRIVATE ${SCALER_HOOK_COMPILATION_FLAGS})


#ScalerHook with auto installation enabled. Scaler hook will run automatically before main.
add_library(ScalerHook-HookAuto SHARED src/autoinstall.cpp)
target_compile_options(ScalerHook-HookAuto PRIVATE "--verbose")
target_link_libraries(ScalerHook-HookAuto PUBLIC ScalerHook-HookManualAsm)
add_library(ScalerHook-HookAuto SHARED src/autoinstall.cpp ${ScalerHookSrc})
target_include_directories(ScalerHook-HookAuto PUBLIC src/include lib/inireader)
target_link_libraries(ScalerHook-HookAuto PUBLIC pthread dl nlohmann_json::nlohmann_json xed2 xed2-ild)
target_compile_definitions(ScalerHook-HookAuto PUBLIC XED_ENCODER NDEBUG)
target_compile_options(ScalerHook-HookAuto PRIVATE ${SCALER_HOOK_COMPILATION_FLAGS})


add_library(ScalerHook-HookAuto-Brkpoint SHARED src/autoinstall.cpp)
target_link_libraries(ScalerHook-HookAuto-Brkpoint PUBLIC ScalerHook-HookBrkpoint)
target_compile_options(ScalerHook-HookAuto-Brkpoint PRIVATE ${SCALER_HOOK_COMPILATION_FLAGS})
#add_library(ScalerHook-HookAuto-Brkpoint SHARED src/autoinstall.cpp)
#target_link_libraries(ScalerHook-HookAuto-Brkpoint PUBLIC ScalerHook-HookBrkpoint)
#target_compile_options(ScalerHook-HookAuto-Brkpoint PRIVATE ${SCALER_HOOK_COMPILATION_FLAGS})

#Add tests
add_subdirectory(tests)
Loading

0 comments on commit 0bfd261

Please sign in to comment.