mtl/CMakeLists.txt
Myles Busig 45cdce1135 Remove armv4t specific include directory from build
Directory was removed in a previous commit.
2024-03-25 17:18:31 -06:00

35 lines
1.3 KiB
CMake

cmake_minimum_required(VERSION 3.5)
project(mtl LANGUAGES CXX C ASM)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
message("Compiling MTL for ${CMAKE_SYSTEM_PROCESSOR}")
# CONFIGURE_DEPENDS option was added in CMake v3.12. This option allows the
# build system to automatically re-run CMake if the glob changes, solving the
# major issue with globbing. May have a performance impact, but it should be
# 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_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)
set(mtl_include_common "include")
set(mtl_include_debug "include/debug")
add_library(${PROJECT_NAME} STATIC)
target_sources(${PROJECT_NAME} PRIVATE "${mtl_sources_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")
target_sources(${PROJECT_NAME} PRIVATE "${mtl_sources_armv4t}")
endif()
# TODO: Support installing library