Comments (5)
It is not true - when you modify project in TouchGFX designer and generate, it does generate new sources, however it does not update my CMakeLists.txt file. I solved this "problem" in my case, by manually adding TouchGFX sources to the project.
A new CMakeLists.txt
file is added in the TouchGFX directory (it could be way smaller since I used some if statements to check if top level or not - for other reasons in my app):
cmake_minimum_required(VERSION 3.22)
# Debug message
message("Entering ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt")
#
# Setup project if this is top-level
#
if (PROJECT_IS_TOP_LEVEL)
project(TouchGFX-simulator)
set(EXECUTABLE ${CMAKE_PROJECT_NAME})
enable_language(C CXX ASM)
endif()
#
# Setup all necessary include directories
#
set(touchgfx_include_DIRS
${CMAKE_CURRENT_LIST_DIR}/Middlewares/ST/touchgfx/framework/include
${CMAKE_CURRENT_LIST_DIR}/TouchGFX/generated/fonts/include
${CMAKE_CURRENT_LIST_DIR}/TouchGFX/generated/gui_generated/include
${CMAKE_CURRENT_LIST_DIR}/TouchGFX/generated/images/include
${CMAKE_CURRENT_LIST_DIR}/TouchGFX/generated/texts/include
${CMAKE_CURRENT_LIST_DIR}/TouchGFX/generated/videos/include
${CMAKE_CURRENT_LIST_DIR}/TouchGFX/gui/include
${CMAKE_CURRENT_LIST_DIR}/TouchGFX/App
${CMAKE_CURRENT_LIST_DIR}/TouchGFX/target/generated
${CMAKE_CURRENT_LIST_DIR}/TouchGFX/target
${CMAKE_CURRENT_LIST_DIR}/TouchGFX/simulator/
)
#
# Scan for all necessary source files to be part of the build
#
file(GLOB_RECURSE graphics_core_generated_SRCS
TouchGFX/App/*.cpp
TouchGFX/App/*.c
TouchGFX/generated/*.cpp
TouchGFX/gui/*.cpp
TouchGFX/gui/*.c
TouchGFX/target/*.cpp
TouchGFX/simulator/*.cpp
)
#
# Remove simulator files it this is not top-level project
#
if (NOT PROJECT_IS_TOP_LEVEL)
list(FILTER graphics_core_generated_SRCS EXCLUDE REGEX ".*/simulator/.*")
endif()
message("graphics source files: ${graphics_core_generated_SRCS}")
#
# Set executable when project is top-level
#
if (PROJECT_IS_TOP_LEVEL)
# Add executable and
add_executable(${EXECUTABLE})
target_sources(${EXECUTABLE}
${graphics_core_generated_SRCS})
target_include_directories(${EXECUTABLE} PRIVATE
${touchgfx_include_DIRS})
target_compile_definitions(${EXECUTABLE} PRIVATE
WIN32
NDEBUG
_CONSOLE
)
else()
# Register core library for the system
# This is not top-level library
add_library(touchgfx INTERFACE)
target_sources(touchgfx PUBLIC ${graphics_core_generated_SRCS})
target_include_directories(touchgfx INTERFACE ${touchgfx_include_DIRS})
endif()
# Debug message
message("Exiting ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt")
And then top level CmakeLists includes it as subdirectory
# Add external libraries
add_subdirectory("../relative/path/to/new/cmakelists" touchgfx)
target_link_libraries(${PROJECT_NAME} touchgfx)
Each time I update TouchGFX project, I go back to top level CMake file and re-run build to add new files to build - using GLOB.
from stm32-cube-cmake-vscode.
Isn't TouchGFX in charge to run these commands even before you come to CMake?
from stm32-cube-cmake-vscode.
I wonder the same answer that MaJerle has asked. This website also might help: https://visualgdb.com/tutorials/arm/import/
from stm32-cube-cmake-vscode.
No, I am certain TouchGFX does not run these commands.
Using an existing project, I opened TouchGFX designer (4.18), and modified some text "HELLO WORLD" > "HELLO SAILOR".
Then clicked "Generate Code". Below is the log:
Generate Code
Generate
Done
Generate Assets
make -f simulator/gcc/Makefile assets -j8
Done
Post Generate
touchgfx update_project --project-file=simulator/msvs/Application.vcxproj
Done
Post Generate Target
touchgfx update_project --project-file=../TestProj.ioc --platform=m4
Done
Done
It is running commands from the default makefile generated when the project was created. The only file changed is TouchGFX/assets/texts/texts.xml
Running CMake Clean Rebuild without the above solution still produces a build. Running this build does not change the text. The text shown is "HELLO WORLD".
If the above solution is added to the CMakeLists.txt
and the project rebuilt, many more files in TouchGFX/generated
are modified, and the build now shows the new text.
I'm sure a similar example can be demonstrated for Images.
from stm32-cube-cmake-vscode.
Thanks for sharing this.
from stm32-cube-cmake-vscode.
Related Issues (12)
- STM
- STM32 Dual core support? HOT 3
- I found a missing startup-file script on the sample code HOT 1
- How to link ARM Math libraries HOT 6
- Include error bits/c++config.h HOT 2
- Linux: Compiler and options getting concatenated
- STM32 Cube vscode not supported in Windows 11 HOT 13
- CMakeLists.txt with Internal Variables Fails HOT 5
- No Cortex Registers view and Disassembly View HOT 2
- What license is this project under? HOT 2
- Advice against the use of cmake-kits, please use cmake's native CMakePresets.json instead HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stm32-cube-cmake-vscode.