simplified build setup

This commit is contained in:
17ms 2023-12-30 23:21:14 +02:00
parent 3fed499559
commit da726402fe
2 changed files with 23 additions and 16 deletions

View File

@ -8,20 +8,12 @@ if(NOT CMAKE_SYSTEM_NAME MATCHES Windows)
endif() endif()
if(NOT MSVC) if(NOT MSVC)
add_compile_options("-Wall") add_compile_options("-Wall" "-Wextra")
else() else()
# Level 4 warnings # Level 4 warnings
add_compile_options("-W4") add_compile_options("/W4" "/WX")
endif() endif()
# Discord API wrapper dependency
FetchContent_Declare(
concord
GIT_REPOSITORY https://github.com/Cogmasters/concord
GIT_TAG 769bdb7 # v2.2.1 release
)
FetchContent_MakeAvailable(concord)
# *) Reflective loader (DLL) # *) Reflective loader (DLL)
add_library(reflective_loader SHARED reflective_loader/loader.c reflective_loader/loader.h) add_library(reflective_loader SHARED reflective_loader/loader.c reflective_loader/loader.h)
@ -30,12 +22,6 @@ add_library(payload SHARED payload/payload.c)
# *) Injector (EXE) # *) Injector (EXE)
add_executable(injector injector/injector.c) add_executable(injector injector/injector.c)
target_link_libraries(injector PRIVATE concord)
# *) Shellcode generator (EXE) # *) Shellcode generator (EXE)
add_executable(shellcode_generator shellcode_generator/generator.c) add_executable(shellcode_generator shellcode_generator/generator.c)
target_link_libraries(shellcode_generator PRIVATE concord)
# Include directories
target_include_directories(injector PRIVATE concord)
target_include_directories(shellcode_generator PRIVATE concord)

21
build.sh Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env bash
CORES=$(nproc)
USED=$(($CORES / 2))
case $(uname -a) in
Linux*)
echo "[+] Using Linux toolchain"
TOOLCHAIN="linux-mingw-w64-x86_64.cmake"
;;
Darwin*)
echo "[+] Using MacOS toolchain"
TOOLCHAIN="macos-mingw-w64-x86_64.cmake"
;;
esac
echo "Running CMake"
cmake -DCMAKE_TOOLCHAIN_FILE=toolchains/$TOOLCHAIN -B build
echo "Running Make with $USED threads"
make -j$USED -C build