e-Paper icon indicating copy to clipboard operation
e-Paper copied to clipboard

Trying to use CMake

Open Moonnz opened this issue 3 years ago • 0 comments

Hello ! :)

I'm trying to use cmake to build a minimal main.cpp with the library, but i keep getting errors:

[ 50%] Linking CXX executable test
/usr/bin/ld: CMakeFiles/test.dir/src/main.cpp.o: in function `Handler(int)':
main.cpp:(.text+0x18): undefined reference to `DEV_Module_Exit()'
/usr/bin/ld: CMakeFiles/test.dir/src/main.cpp.o: in function `main':
main.cpp:(.text+0x3c): undefined reference to `EPD_2in7_test()'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/test.dir/build.make:117: test] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/test.dir/all] Error 2
gmake: *** [Makefile:103: all] Error 2

But the problematic reference DEV_Module_Exit and EPD_2in7_test are correctly declared in the file DEV_Config.h/o and EPD_2in7_test.h so...

Doesn't anyone ever find a way to use CMake with this library ?

Here the cmake file:

cmake_minimum_required(VERSION 3.13)

project(test C CXX)

set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 20)


add_executable(${PROJECT_NAME})

target_sources(${PROJECT_NAME} PRIVATE src/main.cpp)
target_include_directories(${PROJECT_NAME} PUBLIC lib/Config/ lib/e-Paper/ lib/Fonts/ lib/GUI/)

set(OBJS
        ${CMAKE_CURRENT_SOURCE_DIR}/bin/font8.o
        ${CMAKE_CURRENT_SOURCE_DIR}/bin/font16.o
        ${CMAKE_CURRENT_SOURCE_DIR}/bin/font20.o
        ${CMAKE_CURRENT_SOURCE_DIR}/bin/font24.o
        ${CMAKE_CURRENT_SOURCE_DIR}/bin/font12.o
        ${CMAKE_CURRENT_SOURCE_DIR}/bin/font12CN.o
        ${CMAKE_CURRENT_SOURCE_DIR}/bin/font24CN.o
        ${CMAKE_CURRENT_SOURCE_DIR}/bin/GUI_BMPfile.o
        ${CMAKE_CURRENT_SOURCE_DIR}/bin/GUI_Paint.o
        ${CMAKE_CURRENT_SOURCE_DIR}/bin/ImageData2.o
        ${CMAKE_CURRENT_SOURCE_DIR}/bin/ImageData.o
        ${CMAKE_CURRENT_SOURCE_DIR}/bin/dev_hardware_SPI.o
        ${CMAKE_CURRENT_SOURCE_DIR}/bin/RPI_sysfs_gpio.o
        ${CMAKE_CURRENT_SOURCE_DIR}/bin/DEV_Config.o
)

target_link_libraries(${PROJECT_NAME} ${OBJS} bcm2835)

Moonnz avatar Oct 10 '22 21:10 Moonnz