ESP-IDF component support

This commit is contained in:
Pascal Serrarens 2023-04-21 17:26:28 +02:00
parent f75ecf1112
commit 986d3fdb13
2 changed files with 34 additions and 28 deletions

View File

@ -1,37 +1,42 @@
cmake_minimum_required(VERSION 3.13) # CMake version check cmake_minimum_required(VERSION 3.13) # CMake version check
project(VectorAlgebra) # Create project "simple_example" #project(VectorAlgebra) # Create project "simple_example"
set(CMAKE_CXX_STANDARD 11) # Enable c++11 standard set(CMAKE_CXX_STANDARD 11) # Enable c++11 standard
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_compile_definitions(GTEST) #add_compile_definitions(GTEST)
include(FetchContent) #include(FetchContent)
FetchContent_Declare( #FetchContent_Declare(
googletest # googletest
URL https://github.com/google/googletest/archive/refs/heads/main.zip # URL https://github.com/google/googletest/archive/refs/heads/main.zip
) #)
# For Windows: Prevent overriding the parent project's compiler/linker settings # For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) #set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest) #FetchContent_MakeAvailable(googletest)
include_directories(include) #include_directories(include)
add_library(VectorAlgebra STATIC "src/FloatSingle.cpp" "src/Angle.cpp" "src/Vector2.cpp" "src/Vector3.cpp" "src/Quaternion.cpp" ) idf_component_register(
SRC_DIRS "src"
enable_testing() INCLUDE_DIRS "include"
add_executable(
VectorAlgebraTest
"test/Angle_test.cc"
"test/FloatSingle_test.cc"
"test/Vector2_test.cc"
"test/Vector3_test.cc"
"test/Quaternion_test.cc"
)
target_link_libraries(
VectorAlgebraTest
gtest_main
VectorAlgebra
) )
include(GoogleTest) #add_library(VectorAlgebra STATIC "src/FloatSingle.cpp" "src/Angle.cpp" "src/Vector2.cpp" "src/Vector3.cpp" "src/Quaternion.cpp" )
gtest_discover_tests(VectorAlgebraTest)
#enable_testing()
#add_executable(
# VectorAlgebraTest
# "test/Angle_test.cc"
# "test/FloatSingle_test.cc"
# "test/Vector2_test.cc"
# "test/Vector3_test.cc"
# "test/Quaternion_test.cc"
# )
#target_link_libraries(
# VectorAlgebraTest
# #gtest_main
# VectorAlgebra
#)
#include(GoogleTest)
#gtest_discover_tests(VectorAlgebraTest)

1
component.mk Normal file
View File

@ -0,0 +1 @@
COMPONENT_ADD_INCLUDEDIRS = include