Using framework sample code in my own projects

Hello! Is it possible to use the framework (Log.hpp and Checks.hpp for example) in a project structure which I set up through the host compilation tutorial? I want to be able to do #include <framework/Checks.hpp> in my files like you have done in your samples.

Thanks in advance.

Hi,

For sure, our samples use the framework includes out of the box. You need to include the framework into your path and then it should work.

Fabian

When you say include into the path, what do you mean? The only way I have managed to do it is through copying the files into the project and doing #include “Checks.hpp” for example. But it hasn’t been working out very well.

Hi omid_volvo,

Have you managed to get project up and running?
Any further support needed?

Thanks

Hello, I still haven’t managed to build anything that uses the framework files. Which steps do I need to take to include them properly in my projects?

fatal error: framework/DriveWorksSample.hpp: No such file or directory

Which IDE are you using?

Fabian

Hi again! I managed to solve the issue with the help of an Nvidia guy here in Gothenburg, Sweden.

We solved it by copying the framework folder to the src folder where our project is and by changing the CMakeLists.txt in both the root and in the individual project.

We’re using the standard CMakeLists.txt from the tutorial with some additions, here is the part that is different from the standard one (this is the root CMakeLists.txt):

#-------------------------------------------------------------------------------
# Samples
#-------------------------------------------------------------------------------
if(CMAKE_CROSSCOMPILING)
  set(DRIVEWORKS_DATAPATH "../data")
else()
  set(DRIVEWORKS_DATAPATH "${CMAKE_CURRENT_LIST_DIR}/../data")
endif()
include_directories(${SDK_BINARY_DIR}/configured/samples)
configure_file(src/framework/DataPath.hpp.in
               ${SDK_BINARY_DIR}/configured/samples/framework/DataPath.hpp)

set(PROJECTS framework; some-project)
foreach(PROJECT ${PROJECTS})
    add_subdirectory(src/${PROJECT})
endforeach()

The individual project’s CMakeLists.txt looks as following:

project(some-project C CXX)

set(PUBLIC_DOCS README.md)

set(SOURCES main.cpp)

set(LIBRARIES
        dw_samples_framework
        ${Driveworks_LIBRARIES}
)

add_executable(${PROJECT_NAME} ${SOURCES})

target_link_libraries(${PROJECT_NAME} ${LIBRARIES})

sdk_add_sample(${PROJECT_NAME})

By doing this I could successfully build projects both for host and target while including framework files. By framework files I mean includes such as this:

#include <framework/Checks.hpp>

Thanks to everyone.