Update README and CMakeLists.txt
Add package name to examples
This commit is contained in:
@@ -1 +1,3 @@
|
||||
set(pkgName "kubernetes")
|
||||
|
||||
add_subdirectory(list_pod)
|
||||
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required (VERSION 2.6)
|
||||
cmake_minimum_required (VERSION 2.6...3.10.2)
|
||||
project (CGenerator)
|
||||
|
||||
cmake_policy(SET CMP0063 NEW)
|
||||
@@ -6,16 +6,21 @@ cmake_policy(SET CMP0063 NEW)
|
||||
set(CMAKE_C_VISIBILITY_PRESET default)
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET default)
|
||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN OFF)
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
|
||||
|
||||
find_package(OpenSSL)
|
||||
|
||||
if (OPENSSL_FOUND)
|
||||
message (STATUS "OPENSSL found")
|
||||
set (CMAKE_C_FLAGS "-DOPENSSL")
|
||||
|
||||
set(CMAKE_C_FLAGS "-DOPENSSL")
|
||||
if(CMAKE_VERSION VERSION_LESS 3.4)
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
include_directories(${OPENSSL_INCLUDE_DIRS})
|
||||
link_directories(${OPENSSL_LIBRARIES})
|
||||
endif()
|
||||
|
||||
message(STATUS "Using OpenSSL ${OPENSSL_VERSION}")
|
||||
else()
|
||||
message (STATUS "OpenSSL Not found.")
|
||||
@@ -32,22 +37,10 @@ else(CURL_FOUND)
|
||||
endif()
|
||||
|
||||
set(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/list.c
|
||||
src/apiKey.c
|
||||
src/apiClient.c
|
||||
src/binary.c
|
||||
src/generic.c
|
||||
external/cJSON.c
|
||||
model/object.c
|
||||
model/admissionregistration_v1_service_reference.c
|
||||
@@ -796,23 +789,10 @@ set(SRCS
|
||||
)
|
||||
|
||||
set(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/apiClient.h
|
||||
include/list.h
|
||||
include/binary.h
|
||||
include/keyValuePair.h
|
||||
include/generic.h
|
||||
external/cJSON.h
|
||||
model/object.h
|
||||
model/admissionregistration_v1_service_reference.h
|
||||
@@ -1560,10 +1540,18 @@ set(HDRS
|
||||
|
||||
)
|
||||
|
||||
# Add library with project file with projectname as library name
|
||||
add_library(${pkgName} SHARED ${SRCS} ${HDRS})
|
||||
include(PreTarget OPTIONAL)
|
||||
|
||||
# Add library with project file with project name as library name
|
||||
add_library(${pkgName} ${SRCS} ${HDRS})
|
||||
# Link dependent libraries
|
||||
if(NOT CMAKE_VERSION VERSION_LESS 3.4)
|
||||
target_link_libraries(${pkgName} OpenSSL::SSL OpenSSL::Crypto)
|
||||
endif()
|
||||
target_link_libraries(${pkgName} ${CURL_LIBRARIES} )
|
||||
|
||||
include(PostTarget OPTIONAL)
|
||||
|
||||
#install library to destination
|
||||
install(TARGETS ${pkgName} DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
@@ -1572,7 +1560,7 @@ set(SRCS "")
|
||||
set(HDRS "")
|
||||
|
||||
|
||||
## This section shows how to use the above compiled libary to compile the source files
|
||||
## This section shows how to use the above compiled library to compile the source files
|
||||
## set source files
|
||||
#set(SRCS
|
||||
# unit-tests/manual-AdmissionregistrationAPI.c
|
||||
@@ -1653,12 +1641,12 @@ set(HDRS "")
|
||||
|
||||
## loop over all files in SRCS variable
|
||||
#foreach(SOURCE_FILE ${SRCS})
|
||||
# # Get only the file name from the file as add_executable doesnot support executable with slash("/")
|
||||
# # Get only the file name from the file as add_executable does not support executable with slash("/")
|
||||
# get_filename_component(FILE_NAME_ONLY ${SOURCE_FILE} NAME_WE)
|
||||
# # Remove .c from the file name and set it as executable name
|
||||
# string( REPLACE ".c" "" EXECUTABLE_FILE ${FILE_NAME_ONLY})
|
||||
# # Add executable for every source file in SRCS
|
||||
# add_executable(unit-${EXECUTABLE_FILE} ${SOURCE_FILE})
|
||||
# # Link above created libary to executable and dependent libary curl
|
||||
# # Link above created library to executable and dependent library curl
|
||||
# target_link_libraries(unit-${EXECUTABLE_FILE} ${CURL_LIBRARIES} ${pkgName} )
|
||||
#endforeach(SOURCE_FILE ${SRCS})
|
||||
|
||||
@@ -39,7 +39,7 @@ This will compile the generated code and create a library in the build folder wh
|
||||
mkdir build
|
||||
cd build
|
||||
// To install library to specific location, use following commands
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/pathtolocaiton ..
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/pathtolocation ..
|
||||
// for normal install use following command
|
||||
cmake ..
|
||||
make
|
||||
@@ -49,14 +49,14 @@ sudo make install
|
||||
Considering the test/source code which uses the API is written in main.c(respective api include is written and all objects necessary are defined and created)
|
||||
|
||||
To compile main.c(considering the file is present in build folder) use following command
|
||||
-L - locaiton of the library(not required if cmake with normal installation is performed)
|
||||
-L - location of the library(not required if cmake with normal installation is performed)
|
||||
-l library name
|
||||
```bash
|
||||
gcc main.c -L. -lkubernetes -o main
|
||||
```
|
||||
Once compiled, you can run it with ``` ./main ```
|
||||
|
||||
Note: You don't need to specify includes for models and include folder seperately as they are path linked. You just have to import the api.h file in your code, the include linking will work.
|
||||
Note: You don't need to specify includes for models and include folder separately as they are path linked. You just have to import the api.h file in your code, the include linking will work.
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
|
||||
Reference in New Issue
Block a user