-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update cmake project to generate example executables
- Loading branch information
Showing
6 changed files
with
87 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
*.a | ||
/C++/Build | ||
build/ | ||
C++/.idea/ | ||
C++/cmake-build-release/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
cmake_minimum_required(VERSION 2.8.3) | ||
project(navio2_cpp) | ||
|
||
set (CMAKE_CXX_STANDARD 14) | ||
|
||
add_subdirectory(Navio) | ||
|
||
include_directories(Examples) | ||
|
||
set(EXMPL_SRCS | ||
AccelGyroMag.cpp | ||
ADC.cpp | ||
AHRS.cpp | ||
Barometer.cpp | ||
LED.cpp | ||
RCInput.cpp | ||
Servo.cpp | ||
threaded_baro.cpp) | ||
|
||
foreach( testsourcefile ${EXMPL_SRCS} ) | ||
# I used a simple string replace, to cut off .cpp. | ||
string( REPLACE ".cpp" "" testname ${testsourcefile} ) | ||
add_executable( ${testname} Examples/${testsourcefile} ) | ||
# Make sure YourLib is linked to each app | ||
target_link_libraries( ${testname} navio pigpio pthread ) | ||
endforeach( testsourcefile ${EXMPL_SRCS} ) | ||
|
||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,60 @@ | ||
cmake_minimum_required(VERSION 2.8.3) | ||
project(navio) | ||
add_definitions(-std=c++11) | ||
|
||
set(CMAKE_CXX_STANDARD 14) | ||
|
||
include_directories( | ||
Common | ||
Navio+ | ||
Navio2 | ||
Common | ||
Navio+ | ||
Navio2 | ||
pigpio | ||
) | ||
|
||
|
||
set(DEFAULT_BUILD_TYPE "Release") | ||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||
message(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.") | ||
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING "Choose the type of build." FORCE) | ||
# Set the possible values of build type for cmake-gui | ||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") | ||
endif() | ||
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) | ||
message(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.") | ||
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING "Choose the type of build." FORCE) | ||
# Set the possible values of build type for cmake-gui | ||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") | ||
endif () | ||
|
||
include(GNUInstallDirs) | ||
|
||
add_subdirectory(pigpio) | ||
|
||
set(SOURCE_FILES | ||
Common/I2Cdev.cpp | ||
Common/MPU9250.cpp | ||
Common/MS5611.cpp | ||
Common/Ublox.cpp | ||
Common/Util.cpp | ||
Common/gpio.cpp | ||
Navio2/ADC_Navio2.cpp | ||
Navio2/LSM9DS1.cpp | ||
Navio2/Led_Navio2.cpp | ||
Navio2/PWM.cpp | ||
Navio2/RCInput_Navio2.cpp | ||
Navio2/RCOutput_Navio2.cpp | ||
Navio2/RGBled.cpp | ||
) | ||
Common/I2Cdev.cpp | ||
Common/MPU9250.cpp | ||
Common/MS5611.cpp | ||
Common/Ublox.cpp | ||
Common/Util.cpp | ||
Common/gpio.cpp | ||
Navio2/ADC_Navio2.cpp | ||
Navio2/LSM9DS1.cpp | ||
Navio2/Led_Navio2.cpp | ||
Navio2/PWM.cpp | ||
Navio2/RCInput_Navio2.cpp | ||
Navio2/RCOutput_Navio2.cpp | ||
Navio2/RGBled.cpp | ||
Navio+/ADC_Navio.cpp | ||
Navio+/ADS1115.cpp | ||
Navio+/Led_Navio.cpp | ||
Navio+/MB85RC256.cpp | ||
Navio+/PCA9685.cpp | ||
Navio+/RCInput_Navio.cpp | ||
Navio+/RCOutput_Navio.cpp | ||
) | ||
|
||
add_library(navio SHARED ${SOURCE_FILES}) | ||
target_include_directories(navio PUBLIC .) | ||
target_include_directories(navio PUBLIC . Navio+ Navio2 Common pigpio) | ||
|
||
# set_target_properties(navio PROPERTIES PUBLIC_HEADER ${HEADER_FILES}) | ||
install(TARGETS navio | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
install(DIRECTORY "${CMAKE_SOURCE_DIR}/" # source directory | ||
DESTINATION "include" # target directory | ||
FILES_MATCHING # install only matched files | ||
PATTERN "*.h" # select header files | ||
) | ||
#install(TARGETS navio | ||
# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
#install(DIRECTORY "${CMAKE_SOURCE_DIR}/" # source directory | ||
# DESTINATION "include" # target directory | ||
# FILES_MATCHING # install only matched files | ||
# PATTERN "*.h" # select header files | ||
#) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters