diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..91c5f80 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.0) + +# Have CMake find our pthreads library within our toolchain (required for this library) +set(CMAKE_THREAD_PREFER_PTHREAD TRUE) +find_package(Threads REQUIRED) + +# add all the *.c files as sources +FILE(GLOB SRC_FILES ${PROJECT_SOURCE_DIR}/wiringPiD/*.c + ${PROJECT_SOURCE_DIR}/wiringPi/*.{c,h} +) + +# make this output a shared library (with .so output) +add_library (wiringPi SHARED ${SRC_FILES}) + +# be sure to include the current source directory for header files +target_include_directories (wiringPi PUBLIC ${PROJECT_SOURCE_DIR}/wiringPi +) + +# add the following required libraries: +# Threads, Math, Crypt, and RealTime +target_link_libraries(wiringPi ${CMAKE_THREAD_LIBS_INIT} crypt m rt) diff --git a/rpi.cmake b/rpi.cmake new file mode 100644 index 0000000..f6f1b79 --- /dev/null +++ b/rpi.cmake @@ -0,0 +1,17 @@ +# Define our host system +SET(CMAKE_SYSTEM_NAME Linux) +SET(CMAKE_SYSTEM_VERSION 1) + +# Define the cross compiler location inside edi +SET(CMAKE_C_COMPILER /usr/bin/arm-linux-gnueabihf-gcc) +SET(CMAKE_CXX_COMPILER /usr/bin/arm-linux-gnueabihf-gcc) + +# Define edi sysroot +SET(CMAKE_FIND_ROOT_PATH /) + +# Use our definitions for compiler tools +SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +# Search for libraries and headers in the target directories only +SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +add_definitions(-Wall)