Basic libmad build

This commit is contained in:
jacqueline
2022-11-17 20:18:01 +11:00
parent c252132f39
commit 42c387807f
5 changed files with 24 additions and 2 deletions
+27
View File
@@ -0,0 +1,27 @@
# For more information about build system see
# https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Build only the subset of components that we actually depend on.
set(COMPONENTS "")
# External dependencies
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{PROJ_PATH}/lib/result")
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{PROJ_PATH}/lib/lvgl")
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{PROJ_PATH}/lib/catch2")
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
# Additional warnings used when compiling our components.
# Unable to be used due to issues in ESP-IDF includes are: -Wpedantic
# -Wuseless-cast -Wconversion -Wold-style-cast -Wsign-conversion -Wcast-align
set(EXTRA_WARNINGS "-Wshadow" "-Wnon-virtual-dtor" "-Wunused"
"-Woverloaded-virtual" "-Wmisleading-indentation" "-Wduplicated-cond"
"-Wduplicated-branches" "-Wlogical-op" "-Wnull-dereference"
"-Wdouble-promotion" "-Wformat=2" "-Wimplicit-fallthrough")
# Extra build flags that should apply to the entire build. This should mostly
# just be used to setting flags that our external dependencies requires.
# Otherwise, prefer adding per-component build flags to keep things neat.
idf_build_set_property(COMPILE_OPTIONS "-DLV_CONF_INCLUDE_SIMPLE" APPEND)
+1
View File
@@ -0,0 +1 @@
include($ENV{PROJ_PATH}/tools/cmake/libmad.cmake)
+19
View File
@@ -0,0 +1,19 @@
set(LIBMAD_SRC "$ENV{PROJ_PATH}/lib/libmad")
set(LIBMAD_BIN "${CMAKE_CURRENT_BINARY_DIR}/libmad")
externalproject_add(libmad_build
SOURCE_DIR "${LIBMAD_SRC}"
PREFIX "${LIBMAD_BIN}"
CONFIGURE_COMMAND ${LIBMAD_SRC}/configure CC=${CMAKE_C_COMPILER} --srcdir=${LIBMAD_SRC} --prefix=${LIBMAD_BIN} --host=xtensa-elf --disable-debugging --disable-shared
BUILD_COMMAND "make"
INSTALL_COMMAND "make install"
BUILD_BYPRODUCTS "${LIBMAD_BIN}/libmad.a"
)
add_library(libmad STATIC IMPORTED GLOBAL)
add_dependencies(libmad libmad_build)
set_target_properties(libmad PROPERTIES IMPORTED_LOCATION
"${LIBMAD_BIN}/libmad.a")
set_target_properties(libmad PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${LIBMAD_BIN}")