Bernardo A. Rodrigues 4 years ago
parent
commit
a852ef82e5
2 changed files with 38 additions and 0 deletions
  1. +21
    -0
      CMakeLists.txt
  2. +17
    -0
      rpi.cmake

+ 21
- 0
CMakeLists.txt View File

@@ -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)

+ 17
- 0
rpi.cmake View File

@@ -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)

Loading…
Cancel
Save