fix build/c_cpp_project_framework/examples/demo1

This commit is contained in:
dianjixz
2022-06-06 23:35:23 +08:00
parent 54b2729975
commit 59f2010043
7 changed files with 1 additions and 128 deletions

View File

@@ -1,70 +0,0 @@
# Config enable component3 or not in Kconfig
set(MODULE_DIR_C "../../../../gear-lib/libbase64")
if(CONFIG_LIBBASE64_ENABLED)
################# Add include #################
# list(APPEND ADD_INCLUDE "include")
list(APPEND ADD_INCLUDE "${MODULE_DIR_C}/../libposix")
list(APPEND ADD_INCLUDE "${MODULE_DIR_C}")
# list(APPEND ADD_PRIVATE_INCLUDE "include_private")
###############################################
############## Add source files ###############
list(APPEND ADD_SRCS "${MODULE_DIR_C}/libbase64.c"
)
# aux_source_directory(src ADD_SRCS) # collect all source file in src dir, will set var ADD_SRCS
# append_srcs_dir(ADD_SRCS "src") # append source file in src dir to var ADD_SRCS
# list(REMOVE_ITEM COMPONENT_SRCS "src/test.c")
# set(ADD_ASM_SRCS "src/asm.S")
# list(APPEND ADD_SRCS ${ADD_ASM_SRCS})
# SET_PROPERTY(SOURCE ${ADD_ASM_SRCS} PROPERTY LANGUAGE C) # set .S ASM file as C language
# SET_SOURCE_FILES_PROPERTIES(${ADD_ASM_SRCS} PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp -D BBBBB")
###############################################
###### Add required/dependent components ######
# list(APPEND ADD_REQUIREMENTS component1)
###############################################
###### Add link search path for requirements/libs ######
# list(APPEND ADD_LINK_SEARCH_PATH "${CONFIG_TOOLCHAIN_PATH}/lib")
# list(APPEND ADD_REQUIREMENTS pthread m) # add system libs, pthread and math lib for example here
# list(APPEND ADD_REQUIREMENTS pthread media-io thread uvc pulse xcb xcb-shm xcb-randr xcb-xinerama)
###############################################
############ Add static libs ##################
# list(APPEND ADD_STATIC_LIB "lib/libtest.a")
###############################################
############ Add dynamic libs ##################
# list(APPEND ADD_DYNAMIC_LIB "lib/arch/v831/libmaix_nn.so"
# "lib/arch/v831/libmaix_cam.so"
# )
###############################################
#### Add compile option for this component ####
#### Just for this component, won't affect other
#### modules, including component that depend
#### on this component
# list(APPEND ADD_DEFINITIONS_PRIVATE -DAAAAA=1)
#### Add compile option for this component
#### and components denpend on this component
# list(APPEND ADD_DEFINITIONS -DAAAAA222=1
# -DAAAAA333=1)
###############################################
############ Add static libs ##################
#### Update parent's variables like CMAKE_C_LINK_FLAGS
# set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,--start-group libmaix/libtest.a -ltest2 -Wl,--end-group" PARENT_SCOPE)
###############################################
# register component, DYNAMIC or SHARED flags will make component compiled to dynamic(shared) lib
# if(CONFIG_COMPONENT3_DYNAMIC)
# register_component(DYNAMIC)
# else()
# register_component()
# endif()
register_component()
endif()

View File

@@ -1,3 +0,0 @@
config LIBBASE64_ENABLED
bool "Enable libbase64"
default n

View File

@@ -2,6 +2,5 @@
CONFIG_LIBPOSIX_ENABLED=y
CONFIG_LIBBASE64_ENABLED=y
CONFIG_LIBCOLLECTIONS_ENABLED=y
CONFIG_LIBLOG_ENABLED=y

View File

@@ -16,7 +16,7 @@ append_srcs_dir(ADD_SRCS "src") # append source file in src dir to var ADD
###############################################
###### Add required/dependent components ######
list(APPEND ADD_REQUIREMENTS libposix libbase64 libcollections liblog)
list(APPEND ADD_REQUIREMENTS libposix libcollections liblog)
# if(CONFIG_COMPONENT2_ENABLED)
# list(APPEND ADD_REQUIREMENTS component2)
# endif()

View File

@@ -3,7 +3,6 @@
void foo();
void test_test_libbase64();
int test_libcollections();
int test_liblog();

View File

@@ -22,7 +22,6 @@
int main()
{
foo();
test_test_libbase64();
test_libcollections();
test_liblog();

View File

@@ -1,51 +0,0 @@
/******************************************************************************
* Copyright (C) 2014-2020 dianjixz <18637716021@163.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
******************************************************************************/
#include "libbase64.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "test.h"
void test_test_libbase64()
{
char target[100] = {0};
char target2[100] = {0};
char source[]="hello world";
int ret_bytes=0;
printf("start base64_encode\n");
memset(target, 0, sizeof(target));
memset(target2, 0, sizeof(target2));
ret_bytes = base64_encode(target, source, strlen(source));
printf("src size: %zu , return byte: %d , target:%s\n", strlen(source), ret_bytes, target);
ret_bytes = base64_decode(target2, target, ret_bytes);
target[ret_bytes]='\0';
printf("return byte: %d , target2: %s \n", ret_bytes, target2);
}
// int main(int argc, char **argv)
// {
// test_test_libbase64();
// return 0;
// }