diff --git a/CMakeLists.txt b/CMakeLists.txt index f018788..68ec985 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,12 +4,12 @@ ## cmake_minimum_required(VERSION 3.14) -project(nekohook) +project(nekohook CXX) # Settings set(NEKOHOOK_BUILD_SHARED OFF CACHE BOOL "Build the shared library") set(NEKOHOOK_BUILD_STATIC ON CACHE BOOL "Build the static library") set(NEKOHOOK_GFX opengl CACHE STRING "Graphics api to use: none;opengl") - +set(NEKOHOOK_X86 OFF CACHE BOOL "Build x86 libraries for x86_64") # Lib itself -add_subdirectory(src) +add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/") diff --git a/src/nekohook/CMakeLists.txt b/src/nekohook/CMakeLists.txt index aa778be..82ecbc4 100644 --- a/src/nekohook/CMakeLists.txt +++ b/src/nekohook/CMakeLists.txt @@ -1,15 +1,24 @@ # TODO: add function to test a library for wanted functions and apply conditionals as nessesary -file(GLOB_RECURSE sources "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp") -file(GLOB_RECURSE headers "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") +set(sources "") +add_subdirectory(features) +add_subdirectory(game) +add_subdirectory(gfx) +add_subdirectory(ui) +add_subdirectory(util) + +set(suffix "") +if (NEKOHOOK_X86) + set(suffix "32") +endif(NEKOHOOK_X86) add_custom_target(nekohook) - macro(ApplyCommon in_target) add_dependencies(nekohook ${in_target}) set_property(TARGET ${in_target} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) set_property(TARGET ${in_target} PROPERTY CXX_STANDARD 17) + set_property(TARGET ${in_target} PROPERTY OUTPUT_NAME nekohook) target_include_directories(${in_target} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/") target_include_directories(${in_target} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../") @@ -17,7 +26,7 @@ macro(ApplyCommon in_target) target_link_libraries(${in_target} PUBLIC rt pthread) endif () - install(TARGETS ${in_target} DESTINATION lib) + install(TARGETS ${in_target} DESTINATION lib${suffix}) endmacro() if(NEKOHOOK_BUILD_SHARED) diff --git a/src/nekohook/features/CMakeLists.txt b/src/nekohook/features/CMakeLists.txt new file mode 100644 index 0000000..e70987d --- /dev/null +++ b/src/nekohook/features/CMakeLists.txt @@ -0,0 +1,6 @@ + +file(GLOB tmp_sources "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp") +file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") +set(sources ${sources} ${tmp_sources} PARENT_SCOPE) +install(FILES ${headers} DESTINATION include/nekohook/features) + diff --git a/src/nekohook/game/CMakeLists.txt b/src/nekohook/game/CMakeLists.txt new file mode 100644 index 0000000..a9e17f6 --- /dev/null +++ b/src/nekohook/game/CMakeLists.txt @@ -0,0 +1,4 @@ +file(GLOB tmp_sources "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp") +file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") +set(sources ${sources} ${tmp_sources} PARENT_SCOPE) +install(FILES ${headers} DESTINATION include/nekohook/game) diff --git a/src/nekohook/game/trace.hpp b/src/nekohook/game/trace.hpp index 164413b..61096e0 100644 --- a/src/nekohook/game/trace.hpp +++ b/src/nekohook/game/trace.hpp @@ -25,16 +25,15 @@ namespace nekohook::trace { - geo::Vec3 Terrain(const geo::Segment3&); using EndInfo = std::pair; EndInfo Shot(const geo::Segment3&, Entity* ignore = Entity::GetLocalPlayer()); // Check if line hits entity, this is for convienience -bool Entity(Entity* entity, const geo::Segment3& v, Entity* ignore = Entity::GetLocalPlayer()) { +bool Entity(Entity* entity, const geo::Segment3& v, Entity* ignore = Entity::GetLocalPlayer()); /* { assert(entity != ignore); return Shot(v, ignore).first == entity; -} +}*/ } // namespace neko::trace diff --git a/src/nekohook/gfx/CMakeLists.txt b/src/nekohook/gfx/CMakeLists.txt new file mode 100644 index 0000000..1d07755 --- /dev/null +++ b/src/nekohook/gfx/CMakeLists.txt @@ -0,0 +1,4 @@ +file(GLOB tmp_sources "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp") +file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") +set(sources ${sources} ${tmp_sources} PARENT_SCOPE) +install(FILES ${headers} DESTINATION include/nekohook/gfx) diff --git a/src/nekohook/ui/CMakeLists.txt b/src/nekohook/ui/CMakeLists.txt new file mode 100644 index 0000000..93b8774 --- /dev/null +++ b/src/nekohook/ui/CMakeLists.txt @@ -0,0 +1,4 @@ +file(GLOB tmp_sources "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp") +file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") +set(sources ${sources} ${tmp_sources} PARENT_SCOPE) +install(FILES ${headers} DESTINATION include/nekohook/ui) diff --git a/src/nekohook/util/CMakeLists.txt b/src/nekohook/util/CMakeLists.txt new file mode 100644 index 0000000..93b8774 --- /dev/null +++ b/src/nekohook/util/CMakeLists.txt @@ -0,0 +1,4 @@ +file(GLOB tmp_sources "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp") +file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") +set(sources ${sources} ${tmp_sources} PARENT_SCOPE) +install(FILES ${headers} DESTINATION include/nekohook/ui)