summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkipcode66 <kipcode66@gmail.com>2021-10-31 17:42:10 -0400
committerkipcode66 <kipcode66@gmail.com>2021-10-31 17:42:10 -0400
commit8a748ba102033d190f7d1b603be553ed911deee6 (patch)
treefbb68e3b475211af3425803fb5b7a440867d4227
parent0f352ab2bf03747a897f6cfd16bf5ef7de55f6b0 (diff)
put rels in one foldercmake
-rw-r--r--src/modules/CMakeLists.txt15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt
index 2ba86b2..81cb382 100644
--- a/src/modules/CMakeLists.txt
+++ b/src/modules/CMakeLists.txt
@@ -39,6 +39,7 @@ function(tpgz_add_module module_name module_srcs)
link_libraries()
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${module_name}.elf
DEPENDS ${module_name}_elf_obj
+ BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/${module_name}.map
COMMAND sh -c "${CMAKE_LINKER} $<JOIN:$<TARGET_PROPERTY:${module_name}_elf_obj,LINK_FLAGS>, > $<JOIN:$<TARGET_PROPERTY:${module_name}_elf_obj,LINK_OPTIONS>, > --Map ${module_name}.map $<JOIN:$<TARGET_OBJECTS:${module_name}_elf_obj>, > $<JOIN:$<TARGET_PROPERTY:${module_name}_elf_obj,LINK_LIBRARIES>, > -o ${CMAKE_CURRENT_BINARY_DIR}/${module_name}.elf")
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${module_name}.rel
@@ -48,6 +49,7 @@ function(tpgz_add_module module_name module_srcs)
add_custom_target(${module_name}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${module_name}.rel)
add_dependencies(rels ${module_name})
+ set_property(TARGET rels APPEND PROPERTY "TPGZ_MODULES" ${CMAKE_CURRENT_BINARY_DIR}/${module_name}.rel)
endfunction()
include_directories(${CMAKE_SOURCE_DIR}/external/libtp_rel/include)
@@ -55,4 +57,15 @@ add_definitions(-D_PROJECT_NAME="${CMAKE_PROJECT_NAME}" -D_VERSION="${CMAKE_PROJ
add_compile_options(-fno-exceptions -fno-rtti -std=gnu++17 -nostdlib -ffreestanding -ffunction-sections -fdata-sections -g -Os -Wall -Werror -Wno-address-of-packed-member -r -e_prolog -u_prolog -u_epilog -u_unresolved -Wl,--gc-sections -nostdlib -g ${DEVKITPRO_MACHDEP}) # -T ${CMAKE_SOURCE_DIR}/external/libtp_rel/source/cxx.ld
add_link_options(-r -e _prolog -u _prolog -u _epilog -u _unresolved -g ${DEVKITPRO_MACHDEP})
-add_subdirectory(hello_world) \ No newline at end of file
+add_subdirectory(hello_world)
+
+
+get_target_property(TPGZ_RELS rels TPGZ_MODULES)
+foreach(rel ${TPGZ_RELS})
+ get_filename_component(rel_name ${rel} NAME)
+ add_custom_command(TARGET rels
+ POST_BUILD
+ BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/rels/${rel_name}
+ COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/rels
+ COMMAND cp ${rel} ${CMAKE_CURRENT_BINARY_DIR}/rels/${rel_name})
+endforeach()