From 6e2a181e4a392202ff312a064dfe7ee0e9f6ec38 Mon Sep 17 00:00:00 2001 From: BlakeFreer Date: Wed, 3 Apr 2024 22:24:58 -0400 Subject: [PATCH] updates cmakes to create bindings target in top-level --- firmware/CMakeLists.txt | 10 ++++++---- firmware/Makefile | 7 ++++--- firmware/README.md | 3 --- .../DemoMapper/platforms/windows/CMakeLists.txt | 2 -- .../DemoProject/platforms/stm32f767/CMakeLists.txt | 2 -- .../DemoProject/platforms/windows/CMakeLists.txt | 2 -- .../DemoProjectRTOS/platforms/stm32f767/CMakeLists.txt | 1 - .../FrontController/platforms/stm32f767/CMakeLists.txt | 2 -- .../FrontController/platforms/windows/CMakeLists.txt | 2 -- .../projects/TMS/platforms/stm32f767/CMakeLists.txt | 2 -- firmware/projects/TMS/platforms/windows/CMakeLists.txt | 2 -- 11 files changed, 10 insertions(+), 25 deletions(-) diff --git a/firmware/CMakeLists.txt b/firmware/CMakeLists.txt index e53cd9ea3..916f1f1ad 100644 --- a/firmware/CMakeLists.txt +++ b/firmware/CMakeLists.txt @@ -54,21 +54,23 @@ set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTOR set(CMAKE_CXX_EXTENSIONS ON) project("${PROJECT}-${PLATFORM}") +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CMAKE_C_USE_RESPONSE_FILE_FOR_INCLUDES OFF) # this doesn't seem to do anything yet add_executable(main) +add_library(bindings) -add_subdirectory(${DIR_PROJECT}) # provides "main" (executable) -add_subdirectory(${DIR_PLATFORM}) # provides "bindings" (library) +add_subdirectory(${DIR_PROJECT}) # modifies "main" (executable) +add_subdirectory(${DIR_PLATFORM}) # modifies "bindings" (library) target_include_directories(main PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} - ${DIR_PLATFORM} # provides the platform-specific bindings header ) target_include_directories(bindings PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} # provides app.h + ${CMAKE_CURRENT_SOURCE_DIR} ) target_link_libraries(main diff --git a/firmware/Makefile b/firmware/Makefile index 722dc53d0..a2e23a99b 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -8,7 +8,10 @@ GENERATOR = -G"Unix Makefiles" COMPILE_COMMANDS_DEST = $(BUILD)/compile_commands.json -build: FORCE +build: config + cmake --build $(BUILD_DIR) + +config: FORCE cmake -B $(BUILD_DIR) -S. $(GENERATOR) -DPROJECT=$(PROJECT) -DPLATFORM=$(PLATFORM) $(COMPILE_COMMANDS_FLAGS) @echo Copying compile_commands.json to $(BUILD) for clangd. @@ -16,8 +19,6 @@ build: FORCE @# Ensure the .clangd file exists touch .clangd - cmake --build $(BUILD_DIR) - clean: FORCE rm -rf $(BUILD_DIR) rm -f $(COMPILE_COMMANDS_DEST) diff --git a/firmware/README.md b/firmware/README.md index 1f4f921d6..ae4427b53 100644 --- a/firmware/README.md +++ b/firmware/README.md @@ -42,9 +42,6 @@ The following dependecies must be installed __and added to your PATH variable.__ * On windows, I had to use the following configuration to help __clangd__ find system header files. ```yaml - If: - PathMatch: .*/windows/.* - CompileFlags: Add: --target=x86_64-w64-mingw64 ``` diff --git a/firmware/projects/DemoMapper/platforms/windows/CMakeLists.txt b/firmware/projects/DemoMapper/platforms/windows/CMakeLists.txt index 05439bb59..737cc3e31 100644 --- a/firmware/projects/DemoMapper/platforms/windows/CMakeLists.txt +++ b/firmware/projects/DemoMapper/platforms/windows/CMakeLists.txt @@ -1,5 +1,3 @@ -add_library(bindings) - target_sources(bindings PRIVATE bindings.cc diff --git a/firmware/projects/DemoProject/platforms/stm32f767/CMakeLists.txt b/firmware/projects/DemoProject/platforms/stm32f767/CMakeLists.txt index 57e0fc2fd..e7e7c1978 100644 --- a/firmware/projects/DemoProject/platforms/stm32f767/CMakeLists.txt +++ b/firmware/projects/DemoProject/platforms/stm32f767/CMakeLists.txt @@ -1,8 +1,6 @@ # Blake Freer # January 8, 2024 -add_library(bindings) - target_sources(bindings PUBLIC bindings.cc diff --git a/firmware/projects/DemoProject/platforms/windows/CMakeLists.txt b/firmware/projects/DemoProject/platforms/windows/CMakeLists.txt index 05439bb59..737cc3e31 100644 --- a/firmware/projects/DemoProject/platforms/windows/CMakeLists.txt +++ b/firmware/projects/DemoProject/platforms/windows/CMakeLists.txt @@ -1,5 +1,3 @@ -add_library(bindings) - target_sources(bindings PRIVATE bindings.cc diff --git a/firmware/projects/DemoProjectRTOS/platforms/stm32f767/CMakeLists.txt b/firmware/projects/DemoProjectRTOS/platforms/stm32f767/CMakeLists.txt index 43e6dc005..223896fd4 100644 --- a/firmware/projects/DemoProjectRTOS/platforms/stm32f767/CMakeLists.txt +++ b/firmware/projects/DemoProjectRTOS/platforms/stm32f767/CMakeLists.txt @@ -1,7 +1,6 @@ # Blake Freer # January 8, 2024 -add_library(bindings) add_library(os) target_sources(bindings diff --git a/firmware/projects/FrontController/platforms/stm32f767/CMakeLists.txt b/firmware/projects/FrontController/platforms/stm32f767/CMakeLists.txt index 57e0fc2fd..e7e7c1978 100644 --- a/firmware/projects/FrontController/platforms/stm32f767/CMakeLists.txt +++ b/firmware/projects/FrontController/platforms/stm32f767/CMakeLists.txt @@ -1,8 +1,6 @@ # Blake Freer # January 8, 2024 -add_library(bindings) - target_sources(bindings PUBLIC bindings.cc diff --git a/firmware/projects/FrontController/platforms/windows/CMakeLists.txt b/firmware/projects/FrontController/platforms/windows/CMakeLists.txt index 05439bb59..737cc3e31 100644 --- a/firmware/projects/FrontController/platforms/windows/CMakeLists.txt +++ b/firmware/projects/FrontController/platforms/windows/CMakeLists.txt @@ -1,5 +1,3 @@ -add_library(bindings) - target_sources(bindings PRIVATE bindings.cc diff --git a/firmware/projects/TMS/platforms/stm32f767/CMakeLists.txt b/firmware/projects/TMS/platforms/stm32f767/CMakeLists.txt index 57e0fc2fd..e7e7c1978 100644 --- a/firmware/projects/TMS/platforms/stm32f767/CMakeLists.txt +++ b/firmware/projects/TMS/platforms/stm32f767/CMakeLists.txt @@ -1,8 +1,6 @@ # Blake Freer # January 8, 2024 -add_library(bindings) - target_sources(bindings PUBLIC bindings.cc diff --git a/firmware/projects/TMS/platforms/windows/CMakeLists.txt b/firmware/projects/TMS/platforms/windows/CMakeLists.txt index 05439bb59..737cc3e31 100644 --- a/firmware/projects/TMS/platforms/windows/CMakeLists.txt +++ b/firmware/projects/TMS/platforms/windows/CMakeLists.txt @@ -1,5 +1,3 @@ -add_library(bindings) - target_sources(bindings PRIVATE bindings.cc