Vikash Posted October 17, 2023 Report Posted October 17, 2023 Hi, I am using uGFX v2.9, I am trying to use gdispPixmapCreate like below: // Create a pixmap and get a pointer to the bits pixmap = gdispPixmapCreate(PIXMAP_WIDTH, PIXMAP_HEIGHT); surface = gdispPixmapGetBits(pixmap); Getting error GDISPVMT_pixmap is undeclared, please suggest, do I need to enable some #define? Like I have set GDISP_NEED_PIXMAP to GFXON In file included from /ugfx/src/gdisp/gdisp_mk.c:23, from /ugfx/src/gfx_mk.c:18: /ugfx/src/gdisp/gdisp_pixmap.c: In function 'gdispPixmapCreate': gdisp_pixmap.c:83:35: error: 'GDISPVMT_pixmap' undeclared (first use in this function) 83 | g = (GDisplay *)gdriverRegister(&GDISPVMT_pixmap->d, p);
Joel Bodenmann Posted October 17, 2023 Report Posted October 17, 2023 You seem to be using the single-file-inclusion mechanism. Pretty much the only draw-back of using that mechanism is that multiple displays and pixmaps don't work as stated in the documentation: https://wiki.ugfx.io/index.php/Getting_Started#Single_File_Inclusion Quote Note: Some features such as multiple-display support and pixmaps are currently not supported when using the single-file-inclusion method. If you want to use pixmaps you can either directly use the Make or CMake files or manually add the µGFX source files to your existing build system.
Vikash Posted October 20, 2023 Author Report Posted October 20, 2023 Hi Joel, Thank you for your reply. In my Project CMakeLists.txt, /src/gfx_mk.c is already added. So yes it is Single-file-inclusion. Can you please suggest which file I need to include in CMakeLists.txt? Also do I need to remove /src/gfx_mk.c? If there is no such file which specific µGFX source files I need to include in my existing build system (CMakeLists.txt).
Vikash Posted October 20, 2023 Author Report Posted October 20, 2023 So far I have make changes in CMakeLists.txt as below: 1. Removed this gfx_mk.c from CMakeLists.txt 2. set(GFXLIB /path/to/ugfx/library) 3. add_custom_target(run_ugfx_makefile COMMAND ${CMAKE_MAKE_PROGRAM} -f ${CMAKE_CURRENT_SOURCE_DIR}/ugfx/gfx.mk WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ugfx ) 4. list(APPEND SOURCES ${GFXSRC}) 5. list(APPEND INCLUDE_DIRECTORIES ${GFXINC}) 6. add_dependencies(your_target run_ugfx_makefile)
Joel Bodenmann Posted October 20, 2023 Report Posted October 20, 2023 If you're using the current master branch of the v2 git repository you can use the built-in CMake integration. This way you can integrate the µGFX library into your CMake project the same way you'd integrate any other library shipping with a CMake find module. Add FindUgfx.cmake to CMAKE_MODULE_PATH: list(APPEND CMAKE_MODULE_PATH /path/to/ugfx/cmake) Include via find_package(): find_package( ugfx REQUIRED COMPONENTS drivers/gdisp/SSD1312 ) Link target: target_link_libraries( ${TARGET} PRIVATE ugfx ) Note that not all drivers have received the corresponding driver.cmake file yet which is why µGFX 2.10 has not been released yet. However, you can easily add them yourself (or you can let me know and I'll add it for you).
Joel Bodenmann Posted October 25, 2023 Report Posted October 25, 2023 @Vikash Did the CMake integration work out for you?
Vikash Posted October 26, 2023 Author Report Posted October 26, 2023 Hi @Joel Bodenmann Thanks for the suggestion, we are able to successfully integrate CMake and compile µGFX with the suggested steps. 🙂
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now