# ???????????cmake???·Ú
CMAKE_MINIMUM_REQUIRED(VERSION 3.0)

# ????????++11

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32 -fpic -fexceptions -Wno-int-to-pointer-cast -Wdeprecated-declarations")


add_compile_options(
    -Wno-pointer-arith
    -Wdeprecated-declarations
    -fvisibility=hidden
    -fno-asynchronous-unwind-tables)

file(GLOB_RECURSE DIR_ASMJIT_LIB_SRCS 
	"asmjit/core/*.c"
	"asmjit/core/*.cc"
	"asmjit/core/*.cpp"
	"asmjit/core/*.cxx"
	"asmjit/arm/*.c"
	"asmjit/arm/*.cc"
	"asmjit/arm/*.cpp"
	"asmjit/arm/*.cxx"
	"asmjit/x86/*.c"
	"asmjit/x86/*.cc"
	"asmjit/x86/*.cpp"
	"asmjit/x86/*.cxx"
)


#??????????
include_directories(${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/include/Squirrel ${PROJECT_SOURCE_DIR}/lib/mysql/include /home/asio/asio-1.28.0/include/ ${PROJECT_SOURCE_DIR}/src/ ${PROJECT_SOURCE_DIR}/src/sdk/ /home/muduo-2.0.2 /home/squirrel-master/squirrel-master/include)
add_compile_definitions(ASMJIT_STATIC)

# ?????????
set(LIB_SOURCE
        "df_main.cpp"
		"Tool.cpp"
		"l_squirrel.cpp"
		"l_socket.cpp"
		"CConnectPool.cpp"
)


# ??????????????shared
ADD_LIBRARY(hook_aurora SHARED ${DIR_ASMJIT_LIB_SRCS} ${LIB_SOURCE})

# ????????????????
SET_TARGET_PROPERTIES(hook_aurora PROPERTIES OUTPUT_NAME "Aurora")


target_link_libraries(hook_aurora libstdc++.a -L/home/squirrel-master/squirrel-master/build/lib -lsqstdlib_static -L/home/squirrel-master/squirrel-master/build/lib -lsquirrel_static -L/home/dnf_project/dnf_project/build/lib/mysql/lib libmysqlclient.a -lpthread -L/home/openssl/openssl-3.0.13 libssl.a -L/home/openssl/openssl-3.0.13 libcrypto.a -L/home/dnf_project/dnf_project/build/lib/frida libfrida-gum.a -ldl -pthread -lresolv libffi.a -L/home/opencc/build/src libopencc.a libkeystone.a libz.a)

# target_link_libraries(hook_aurora /usr/local/lib/libffi.a)
# ????????·Ú, ????????????????
# VERSION:?????·Ú??SOVERSION:API?·Ú
#SET_TARGET_PROPERTIES(hook_aurora PROPERTIES VERSION 0.1.1 SOVERSION 0)


# ?????????????
SET(LIBRARY_OUTPUT_PATH /dp_s/lib) 
