Browse Source

Add CMake support

pull/110/head
Alligator Descartes 3 years ago
parent
commit
80b4249c96
5 changed files with 104 additions and 0 deletions
  1. +1
    -0
      .gitignore
  2. +26
    -0
      CMakeLists.txt
  3. +25
    -0
      devLib/CMakeLists.txt
  4. +27
    -0
      gpio/CMakeLists.txt
  5. +25
    -0
      wiringPi/CMakeLists.txt

+ 1
- 0
.gitignore View File

@@ -5,3 +5,4 @@ lib*.so.*
debian-template/wiringPi
debian-template/wiringpi-*.deb
gpio/gpio
build2

+ 26
- 0
CMakeLists.txt View File

@@ -0,0 +1,26 @@
#
# Copyright (c)2021- Alligator Descartes <http://www.hermitretro.com>
#
# This file is part of WiringPi
#
# WiringPi is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# WiringPi is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with WiringPi. If not, see <https://www.gnu.org/licenses/>.

cmake_minimum_required (VERSION 2.8)

project (WiringPi)

add_subdirectory(${PROJECT_SOURCE_DIR}/devLib/)
add_subdirectory(${PROJECT_SOURCE_DIR}/wiringPi/)
add_subdirectory(${PROJECT_SOURCE_DIR}/gpio/)


+ 25
- 0
devLib/CMakeLists.txt View File

@@ -0,0 +1,25 @@
#
# Copyright (c)2021- Alligator Descartes <http://www.hermitretro.com>
#
# This file is part of WiringPi
#
# WiringPi is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# WiringPi is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with WiringPi. If not, see <https://www.gnu.org/licenses/>.

include_directories(${PROJECT_SOURCE_DIR}/wiringPi)

add_compile_options(-D_FILE_OFFSET_BITS=64 -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast)

file(GLOB_RECURSE SOURCES "*.c")

add_library(devLib STATIC ${SOURCES})

+ 27
- 0
gpio/CMakeLists.txt View File

@@ -0,0 +1,27 @@
#
# Copyright (c)2021- Alligator Descartes <http://www.hermitretro.com>
#
# This file is part of WiringPi
#
# WiringPi is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# WiringPi is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with WiringPi. If not, see <https://www.gnu.org/licenses/>.

include_directories(${PROJECT_SOURCE_DIR}/wiringPi)

add_compile_options(-D_FILE_OFFSET_BITS=64 -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast)

file(GLOB_RECURSE SOURCES "*.c")

link_directories(${PROJECT_SOURCE_DIR}/wiringPi ${PROJECT_SOURCE_DIR}/devLib)
add_executable(gpio ${SOURCES})
target_link_libraries(gpio wiringPi devLib m rt pthread crypt)

+ 25
- 0
wiringPi/CMakeLists.txt View File

@@ -0,0 +1,25 @@
#
# Copyright (c)2021- Alligator Descartes <http://www.hermitretro.com>
#
# This file is part of WiringPi
#
# WiringPi is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# WiringPi is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with WiringPi. If not, see <https://www.gnu.org/licenses/>.

include_directories(${PROJECT_SOURCE_DIR}/wiringPi)

add_compile_options(-D_FILE_OFFSET_BITS=64 -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast)

file(GLOB_RECURSE SOURCES "*.c")

add_library(wiringPi STATIC ${SOURCES})

Loading…
Cancel
Save