Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake defines not passed hw.h #1

Open
lockencopp opened this issue Jun 23, 2022 · 5 comments
Open

CMake defines not passed hw.h #1

lockencopp opened this issue Jun 23, 2022 · 5 comments

Comments

@lockencopp
Copy link

Configuring Cmake defines for pins are not passed to hw.h, making it impossible to configure pins through this mechanism.

@lockencopp
Copy link
Author

Fixed by appending

target_compile_definitions(
  lib-st7735
  PUBLIC
  PIN_TFT_RST=${SPI_TFT_RST}
  PIN_TFT_DC=${SPI_TFT_DC}
  PIN_TFT_CS=${SPI_TFT_CS}
  )

to parent CMakeLists.txt

@bablokb
Copy link
Owner

bablokb commented Jun 24, 2022

Strange, but I will check. According to the CMake documentation everything I add with add_compile_definition is propagated to all targets. So your code would be redundant. And I use this library in various projects and I never encountered any problems.

@cedric-h
Copy link

can confirm. lost a day to this + forgetting to tie my backlight pin to high

target_compile_definitions(
  st7735
  PUBLIC
  PIN_TFT_RST=${SPI_TFT_RST}
  PIN_TFT_DC=${SPI_TFT_DC}
  PIN_TFT_CS=${SPI_TFT_CS}
)

stick it in your demo CMakeLists.txt

thanks for the library!

@bablokb
Copy link
Owner

bablokb commented Oct 17, 2022

Are you using the newest version and the new version of the demo?

BTW, to cite the c-make documentation: "The preprocessor definitions are added to the COMPILE_DEFINITIONS directory property for the current CMakeLists file. They are also added to the COMPILE_DEFINITIONS target property for each target in the current CMakeLists file."

@zdebel
Copy link

zdebel commented Dec 20, 2023

Oh for christ's sake, lost 30 minutes due to this. I am new to RP2040 so I'm not passing blame, thanks for the fix @cedric-h !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants