forked from eclipse-iceoryx/iceoryx2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[eclipse-iceoryx#210] Initial cmake integration with example
- Loading branch information
1 parent
4fc24f8
commit 3abba6b
Showing
8 changed files
with
75 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
cmake_minimum_required(VERSION 3.28) | ||
project(iceoryx2) | ||
|
||
#TODO build iceoryx2 | ||
#TODO how to handle feature flags | ||
|
||
add_subdirectory(iceoryx2-lang) | ||
|
||
#TODO add flags | ||
# if(EXAMPLES) | ||
add_subdirectory(examples/c) | ||
# endif() |
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,4 @@ | ||
cmake_minimum_required(VERSION 3.28) | ||
project(examples_c) | ||
|
||
add_subdirectory(discovery) |
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,8 @@ | ||
cmake_minimum_required(VERSION 3.28) | ||
project(example_c_discovery) | ||
|
||
find_package(iceoryx2_lang_c REQUIRED) | ||
|
||
add_executable(example_c_discovery src/main.c) | ||
|
||
target_link_libraries(example_c_discovery iceoryx2_lang_c) |
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,6 @@ | ||
|
||
#include "iox2/iceoryx2.h" | ||
|
||
int main(void) { | ||
zero_copy_service_list(); | ||
} |
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,8 @@ | ||
cmake_minimum_required(VERSION 3.28) | ||
project(iceoryx2-lang) | ||
|
||
add_subdirectory(c) | ||
|
||
if(BUILD_TESTING) | ||
add_subdirectory(tests/tbd) | ||
endif() |
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,25 @@ | ||
cmake_minimum_required(VERSION 3.28) | ||
project(iceoryx2_lang_c) | ||
|
||
# TODO remove once generation works as expected ... have a look at iceoryx-rs | ||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/iceoryx2.h" | ||
"${CMAKE_BINARY_DIR}/generated/include/iox2/iceoryx2.h" @ONLY) | ||
|
||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") | ||
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".so") | ||
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".dll") | ||
|
||
find_library(ICEORYX2_LANG_C_LIB ${PROJECT_NAME} HINTS ${iceoryx2_SOURCE_DIR}/target/release) | ||
|
||
add_library(${PROJECT_NAME} INTERFACE) | ||
|
||
target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_BINARY_DIR}/generated/include) | ||
|
||
target_link_libraries(${PROJECT_NAME} INTERFACE ${ICEORYX2_LANG_C_LIB}) | ||
|
||
########## find_package in source tree ########## | ||
set(${PROJECT_NAME}_DIR ${PROJECT_SOURCE_DIR}/cmake | ||
CACHE FILEPATH | ||
"${PROJECT_NAME}Config.cmake to make find_package(${PROJECT_NAME}) work in source tree!" | ||
FORCE | ||
) |
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,5 @@ | ||
@PACKAGE_INIT@ | ||
|
||
# TODO check if this is correct | ||
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]") | ||
check_required_components("@PROJECT_NAME@") |
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,7 @@ | ||
if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FOUND_PRINTED) | ||
message(STATUS "The package '${CMAKE_FIND_PACKAGE_NAME}' is used in source code version.") | ||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND_PRINTED true CACHE INTERNAL "") | ||
endif() | ||
|
||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) | ||
|