Add support for debug-build specific files

This commit is contained in:
Myles Busig 2024-03-12 00:40:02 -06:00
parent c7918a2b8b
commit 829220d5ca

View File

@ -10,9 +10,11 @@ message("Compiling MTL for ${CMAKE_SYSTEM_PROCESSOR}")
# major issue with globbing. May have a performance impact, but it should be # major issue with globbing. May have a performance impact, but it should be
# negligible compared to the time spent building. # negligible compared to the time spent building.
file(GLOB mtl_sources_common LIST_DIRECTORIES false CONFIGURE_DEPENDS src/*.cpp src/*.c src/*.s) file(GLOB mtl_sources_common LIST_DIRECTORIES false CONFIGURE_DEPENDS src/*.cpp src/*.c src/*.s)
file(GLOB mtl_sources_debug LIST_DIRECTORIES false CONFIGURE_DEPENDS src/debug/*.cpp src/debug/*.c src/debug/*.s)
file(GLOB mtl_sources_armv4t LIST_DIRECTORIES false CONFIGURE_DEPENDS src/armv4t/*.cpp src/armv4t/*.c src/armv4t/*.s) file(GLOB mtl_sources_armv4t LIST_DIRECTORIES false CONFIGURE_DEPENDS src/armv4t/*.cpp src/armv4t/*.c src/armv4t/*.s)
set(mtl_include_common "include") set(mtl_include_common "include")
set(mtl_include_debug "include/debug")
set(mtl_include_armv4t "include/armv4t") set(mtl_include_armv4t "include/armv4t")
add_library(${PROJECT_NAME} STATIC) add_library(${PROJECT_NAME} STATIC)
@ -20,6 +22,11 @@ add_library(${PROJECT_NAME} STATIC)
target_sources(${PROJECT_NAME} PRIVATE "${mtl_sources_common}") target_sources(${PROJECT_NAME} PRIVATE "${mtl_sources_common}")
target_include_directories(${PROJECT_NAME} PUBLIC "${mtl_include_common}") target_include_directories(${PROJECT_NAME} PUBLIC "${mtl_include_common}")
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
target_sources(${PROJECT_NAME} PRIVATE "${mtl_sources_debug}")
target_include_directories(${PROJECT_NAME} PUBLIC "${mtl_include_debug}")
endif()
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv4t") if (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv4t")
target_sources(${PROJECT_NAME} PRIVATE "${mtl_sources_armv4t}") target_sources(${PROJECT_NAME} PRIVATE "${mtl_sources_armv4t}")
target_include_directories(${PROJECT_NAME} PUBLIC "${mtl_include_armv4t}") target_include_directories(${PROJECT_NAME} PUBLIC "${mtl_include_armv4t}")