Add partial examples building scripts

Add pre and post CMake building scripts
This commit is contained in:
Ahmed Yarub Hani Al Nuaimi
2021-08-29 21:00:43 -03:00
parent 3cb0df0685
commit 739e921c77
5 changed files with 50 additions and 3 deletions

1
examples/CMakeLists.txt Normal file
View File

@@ -0,0 +1 @@
add_subdirectory(list_pod)

View File

@@ -0,0 +1,8 @@
add_executable(list_pod main.c)
target_link_libraries(list_pod PRIVATE ${pkgName})
target_include_directories(list_pod PRIVATE
${CMAKE_SOURCE_DIR}/config
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/api
)

View File

@@ -1,9 +1,7 @@
#include <kube_config.h>
#include <apiClient.h>
#include <CoreV1API.h>
#include <malloc.h>
#include <stdio.h>
#include <errno.h>
void list_pod(apiClient_t * apiClient)
{
@@ -35,7 +33,7 @@ void list_pod(apiClient_t * apiClient)
}
}
int main(int argc, char *argv[])
int main()
{
char *basePath = NULL;
sslConfig_t *sslConfig = NULL;

View File

@@ -0,0 +1,9 @@
target_link_libraries(${pkgName} yaml websockets)
set_target_properties(${pkgName} PROPERTIES LINKER_LANGUAGE C)
option(BUILD_EXAMPLES "Build examples" OFF)
if(BUILD_EXAMPLES)
message("Include examples")
add_subdirectory(../examples examples)
endif()

View File

@@ -0,0 +1,31 @@
list(APPEND SRCS
config/kube_config_model.c
config/kube_config_yaml.c
config/kube_config_util.c
config/kube_config.c
config/incluster_config.c
config/exec_provider.c
config/authn_plugin/authn_plugin_util.c
config/authn_plugin/authn_plugin.c
watch/watch_util.c
websocket/wsclient.c
websocket/kube_exec.c
src/generic.c)
list(APPEND HDRS
config/kube_config_common.h
config/kube_config_model.h
config/kube_config_yaml.h
config/kube_config_util.h
config/kube_config.h
config/incluster_config.h
config/exec_provider.h
config/authn_plugin/authn_plugin_util.h
config/authn_plugin/authn_plugin.h
watch/watch_util.h
websocket/wsclient.h
websocket/kube_exec.h
include/generic.h)
find_package(libwebsockets REQUIRED)
find_package(yaml CONFIG REQUIRED)