brute force it

This commit is contained in:
dcvz 2024-06-03 17:18:48 +02:00
parent fdfab70bd0
commit 89d1efa2c7
1 changed files with 24 additions and 19 deletions

View File

@ -75,26 +75,31 @@ target_sources(PatchesLib PRIVATE
set_source_files_properties(${CMAKE_SOURCE_DIR}/RecompiledPatches/patches.c PROPERTIES COMPILE_FLAGS -fno-strict-aliasing) set_source_files_properties(${CMAKE_SOURCE_DIR}/RecompiledPatches/patches.c PROPERTIES COMPILE_FLAGS -fno-strict-aliasing)
# Build patches elf # Build patches elf
set(PATCHES_COMMAND "") if (DEFINED PATCHES_C_COMPILER AND DEFINED PATCHES_LD AND DEFINED PATCHES_OBJCOPY)
if(DEFINED PATCHES_C_COMPILER)
set(PATCHES_COMMAND "${PATCHES_COMMAND} CC=${PATCHES_C_COMPILER}")
endif()
if(DEFINED PATCHES_LD)
set(PATCHES_COMMAND "${PATCHES_COMMAND} LD=${PATCHES_LD}")
endif()
if(DEFINED PATCHES_OBJCOPY)
set(PATCHES_COMMAND "${PATCHES_COMMAND} OBJCOPY=${PATCHES_OBJCOPY}")
endif()
add_custom_target(PatchesBin add_custom_target(PatchesBin
COMMAND ${PATCHES_COMMAND} make COMMAND CC=${PATCHES_C_COMPILER} LD=${PATCHES_LD} OBJCOPY=${PATCHES_OBJCOPY} make
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/patches WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/patches
BYPRODUCTS ${CMAKE_SOURCE_DIR}/patches/patches.bin BYPRODUCTS ${CMAKE_SOURCE_DIR}/patches/patches.bin
VERBATIM
) )
elseif(DEFINED PATCHES_C_COMPILER AND DEFINED PATCHES_LD)
add_custom_target(PatchesBin
COMMAND CC=${PATCHES_C_COMPILER} LD=${PATCHES_LD} make
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/patches
BYPRODUCTS ${CMAKE_SOURCE_DIR}/patches/patches.bin
)
elseif(DEFINED PATCHES_C_COMPILER)
add_custom_target(PatchesBin
COMMAND CC=${PATCHES_C_COMPILER} make
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/patches
BYPRODUCTS ${CMAKE_SOURCE_DIR}/patches/patches.bin
)
else()
add_custom_target(PatchesBin
COMMAND make
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/patches
BYPRODUCTS ${CMAKE_SOURCE_DIR}/patches/patches.bin
)
endif()
# Generate patches_bin.c from patches.bin # Generate patches_bin.c from patches.bin
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/RecompiledPatches/patches_bin.c add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/RecompiledPatches/patches_bin.c