Skip to content

Commit

Permalink
dont include unnecessary sources
Browse files Browse the repository at this point in the history
  • Loading branch information
cgytrus committed Feb 9, 2024
1 parent 7532acb commit b314b04
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 17 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ include(cmake/CPM.cmake)
option(TULIP_LINK_SOURCE "Link to TulipHook source files, including external libs" OFF)

if(TULIP_LINK_SOURCE OR PROJECT_IS_TOP_LEVEL)
add_subdirectory(libraries/dobby)
add_subdirectory(src)
endif()

Expand Down
60 changes: 44 additions & 16 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,44 @@ cmake_minimum_required(VERSION 3.21)

project(TulipHook LANGUAGES CXX C)

file(GLOB TULIP_HOOK_SOURCES
file(GLOB TULIP_HOOK_BASE_SOURCES
*.cpp
assembler/*.cpp
assembler/BaseAssembler.cpp
convention/*.cpp
generator/*.cpp
target/*.cpp
generator/Generator.cpp
target/Target.cpp
)

if(WIN32)
file(GLOB TULIP_HOOK_PLATFORM_SOURCES
assembler/X86Assembler.cpp
generator/X86Generator.cpp
target/WindowsTarget.cpp
)
elseif(APPLE)
file(GLOB TULIP_HOOK_PLATFORM_SOURCES
assembler/X64Assembler.cpp
generator/X64Generator.cpp
target/DarwinTarget.cpp
target/MacosTarget.cpp
)
elseif(ANDROID OR UNIX)
file(GLOB TULIP_HOOK_PLATFORM_SOURCES
assembler/ArmV7Assembler.cpp
assembler/ArmV8Assembler.cpp
generator/ArmV7Generator.cpp
generator/ArmV8Generator.cpp
target/PosixTarget.cpp
target/PosixArmV7Target.cpp
target/PosixArmV8Target.cpp
)
else()
message(FATAL_ERROR "Unsupported platform.")
endif()

add_library(${PROJECT_NAME} STATIC
${TULIP_HOOK_SOURCES}
${TULIP_HOOK_BASE_SOURCES}
${TULIP_HOOK_PLATFORM_SOURCES}
)

target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)
Expand All @@ -20,30 +48,30 @@ if (MSVC)
target_compile_options(${PROJECT_NAME} PUBLIC /EHsc)
endif ()

set(CAPSTONE_INSTALL Off)
set(CAPSTONE_ARCHITECTURE_DEFAULT Off)

if (WIN32 OR APPLE)
set(CAPSTONE_INSTALL Off)
set(CAPSTONE_ARCHITECTURE_DEFAULT Off)

set(CAPSTONE_X86_SUPPORT On)
set(CAPSTONE_X86_REDUCE Off)
set(CAPSTONE_X86_ATT_DISABLE On)
elseif (ANDROID)

CPMAddPackage("gh:geode-sdk/capstone#d2a14e5")
target_link_libraries(${PROJECT_NAME} PRIVATE capstone)
target_include_directories(${PROJECT_NAME} PRIVATE ${capstone_SOURCE_DIR}/include)
endif()
if(ANDROID OR UNIX)
add_subdirectory(../libraries/dobby)
target_link_libraries(${PROJECT_NAME} PRIVATE Dobby)
message(STATUS "${Dobby_SOURCE_DIR}/source")
endif()


CPMAddPackage("gh:geode-sdk/capstone#d2a14e5")

target_link_libraries(${PROJECT_NAME} PRIVATE capstone Dobby)
target_link_libraries(${PROJECT_NAME} PUBLIC Result)
target_compile_definitions(${PROJECT_NAME} PRIVATE -DTULIP_HOOK_EXPORTING=1)

message(STATUS "${Dobby_SOURCE_DIR}/source")

target_include_directories(${PROJECT_NAME} PRIVATE
${TulipHookRoot_SOURCE_DIR}/include
${TulipHookRoot_SOURCE_DIR}/include/tulip
${capstone_SOURCE_DIR}/include
)

target_include_directories(${PROJECT_NAME} INTERFACE
Expand Down

0 comments on commit b314b04

Please sign in to comment.