|
|
|
|
|
by isopede
833 days ago
|
|
I tried it a few months ago, back in November. I looked through what I did and in the end, to bring in pw_result, I had to define a failure handler, pull in three separate cmake files for various definitions, define an ASSERT action (because a result type requires an ASSERT fail, apparently?), and set a backend and a handler for pw_assert. At some point I remember it complaining left and right about not having the right I/O methods for printing, etc. I just wanted to try the result type, and for some reason I needed to define I/O mechanisms for my platform. Is this the correct procedure? I have no idea, because the cmake documentation had (has?) _zero_ examples. If they existed, I couldn't find them. I eventually got it to compile with the following snippet, but I can hardly believe that this is the "intended" way to do it. FetchContent_Populate(pigweed)
include(${pigweed_SOURCE_DIR}/pw_build/pigweed.cmake)
include(${pigweed_SOURCE_DIR}/pw_assert/backend.cmake)
include(${pigweed_SOURCE_DIR}/pw_assert_basic/backend.cmake)
add_compile_definitions(PW_ASSERT_BASIC_ACTION=PW_ASSERT_BASIC_ACTION_LOOP)
pw_set_backend(pw_assert.check pw_assert_basic.check_backend)
pw_set_backend(pw_assert.assert pw_assert_basic.basic_handler)
add_subdirectory(${pigweed_SOURCE_DIR} ${pigweed_SOURCE_DIR})
|
|
I'm off for the night but will follow up here next week
We can also continue discussion on the Discord https://discord.gg/M9NSeTA