diff options
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/cmake/BuildPicoC.cmake | 38 | ||||
-rw-r--r-- | contrib/patches/picoc/CMakeLists.txt | 21 | ||||
-rw-r--r-- | contrib/patches/picoc/platform.h | 147 |
3 files changed, 206 insertions, 0 deletions
diff --git a/contrib/cmake/BuildPicoC.cmake b/contrib/cmake/BuildPicoC.cmake new file mode 100644 index 0000000..620f01f --- /dev/null +++ b/contrib/cmake/BuildPicoC.cmake @@ -0,0 +1,38 @@ +include(ExternalProject) + +if ("${CMAKE_GENERATOR}" STREQUAL "Xcode") + set(PICOC_LIBNAME "Debug/libpicoc.a") +elseif (WIN32) + set(PICOC_LIBNAME "picoc.lib") +elseif(UNIX) + set(PICOC_LIBNAME "libpicoc.a") +endif() + +externalproject_add(picoc + GIT_REPOSITORY https://github.com/zsaleeba/picoc.git + BUILD_IN_SOURCE 0 + PREFIX ${CMAKE_BINARY_DIR}/deps/picoc + UPDATE_COMMAND "" + PATCH_COMMAND + ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/contrib/patches/picoc/CMakeLists.txt" <SOURCE_DIR>/CMakeLists.txt && + ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/contrib/patches/picoc/platform.h" <SOURCE_DIR>/platform.h + CONFIGURE_COMMAND + ${CMAKE_COMMAND} + -G ${CMAKE_GENERATOR} + -DCMAKE_BUILD_TYPE=Release + ${CMAKE_PARAM_TOOLCHAIN} + ${CMAKE_PARAM_ANDROID_ABI} + ${CMAKE_PARAM_API_LEVEL} + ${CMAKE_PARAM_SHARED} + -DCMAKE_VERBOSE_MAKEFILE=OFF + -DBUILD_SHARED_LIBS=OFF + <SOURCE_DIR> + INSTALL_COMMAND "" +) + +set(PICOC_INCLUDE_DIR ${CMAKE_BINARY_DIR}/deps/picoc/src/picoc) +set(PICOC_LIBRARY ${CMAKE_BINARY_DIR}/deps/picoc/src/picoc-build/${PICOC_LIBNAME}) + +set(PICOC_BUILT ON) + + diff --git a/contrib/patches/picoc/CMakeLists.txt b/contrib/patches/picoc/CMakeLists.txt new file mode 100644 index 0000000..92cc2c7 --- /dev/null +++ b/contrib/patches/picoc/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 2.8.4) +project(picoc) + +# include_directories(${PROJECT_SOURCE_DIR}/include) + +file(GLOB PICOC_FILES + ${PROJECT_SOURCE_DIR}/*.h + ${PROJECT_SOURCE_DIR}/*.c + ${PROJECT_SOURCE_DIR}/cstdlib/*.h + ${PROJECT_SOURCE_DIR}/cstdlib/*.c) + + if (UNIX) + add_definitions("-DUNIX_HOST") + list (APPEND PICOC_FILES ${PROJECT_SOURCE_DIR}/platform/library_unix.c) + list (APPEND PICOC_FILES ${PROJECT_SOURCE_DIR}/platform/platform_unix.c) + + endif() + +add_library(picoc ${PICOC_FILES}) + +# set_target_properties(uriparser PROPERTIES PREFIX "") diff --git a/contrib/patches/picoc/platform.h b/contrib/patches/picoc/platform.h new file mode 100644 index 0000000..25d6dc4 --- /dev/null +++ b/contrib/patches/picoc/platform.h @@ -0,0 +1,147 @@ +/* all platform-specific includes and defines go in this file */ +#ifndef PLATFORM_H +#define PLATFORM_H + +/* configurable options */ +/* select your host type (or do it in the Makefile): + * #define UNIX_HOST + * #define FLYINGFOX_HOST + * #define SURVEYOR_HOST + * #define SRV1_UNIX_HOST + * #define UMON_HOST + * #define WIN32 (predefined on MSVC) + */ + +#define LARGE_INT_POWER_OF_TEN 1000000000 /* the largest power of ten which fits in an int on this architecture */ +#if defined(__hppa__) || defined(__sparc__) +#define ALIGN_TYPE double /* the default data type to use for alignment */ +#else +#define ALIGN_TYPE void * /* the default data type to use for alignment */ +#endif + +#define GLOBAL_TABLE_SIZE 97 /* global variable table */ +#define STRING_TABLE_SIZE 97 /* shared string table size */ +#define STRING_LITERAL_TABLE_SIZE 97 /* string literal table size */ +#define RESERVED_WORD_TABLE_SIZE 97 /* reserved word table size */ +#define PARAMETER_MAX 16 /* maximum number of parameters to a function */ +#define LINEBUFFER_MAX 256 /* maximum number of characters on a line */ +#define LOCAL_TABLE_SIZE 11 /* size of local variable table (can expand) */ +#define STRUCT_TABLE_SIZE 11 /* size of struct/union member table (can expand) */ + +#define INTERACTIVE_PROMPT_START "starting picoc " PICOC_VERSION "\n" +#define INTERACTIVE_PROMPT_STATEMENT "picoc> " +#define INTERACTIVE_PROMPT_LINE " > " + +/* host platform includes */ +#ifdef UNIX_HOST +# define USE_MALLOC_STACK /* stack is allocated using malloc() */ +# define USE_MALLOC_HEAP /* heap is allocated using malloc() */ +# include <stdio.h> +# include <stdlib.h> +# include <ctype.h> +# include <string.h> +# include <assert.h> +# include <sys/types.h> +# include <sys/stat.h> +# include <unistd.h> +# include <stdarg.h> +# include <setjmp.h> +# ifndef NO_FP +# include <math.h> +# define PICOC_MATH_LIBRARY +// # define USE_READLINE +# undef BIG_ENDIAN +# if defined(__powerpc__) || defined(__hppa__) || defined(__sparc__) +# define BIG_ENDIAN +# endif +# endif + +extern jmp_buf ExitBuf; + +#else +# ifdef WIN32 +# define USE_MALLOC_STACK /* stack is allocated using malloc() */ +# define USE_MALLOC_HEAP /* heap is allocated using malloc() */ +# include <stdio.h> +# include <stdlib.h> +# include <ctype.h> +# include <string.h> +# include <assert.h> +# include <sys/types.h> +# include <sys/stat.h> +# include <stdarg.h> +# include <setjmp.h> +# include <math.h> +# define PICOC_MATH_LIBRARY +# undef BIG_ENDIAN + +extern jmp_buf ExitBuf; + +# else +# ifdef FLYINGFOX_HOST +# define HEAP_SIZE (16*1024) /* space for the heap and the stack */ +# define NO_HASH_INCLUDE +# include <stdlib.h> +# include <ctype.h> +# include <string.h> +# include <sys/types.h> +# include <stdarg.h> +# include <setjmp.h> +# include <math.h> +# define assert(x) +# define BUILTIN_MINI_STDLIB +# undef BIG_ENDIAN + +# else +# ifdef SURVEYOR_HOST +# define HEAP_SIZE C_HEAPSIZE +# define NO_FP +# define NO_CTYPE +# define NO_HASH_INCLUDE +# define NO_MODULUS +# include <cdefBF537.h> +# include "../string.h" +# include "../print.h" +# include "../srv.h" +# include "../setjmp.h" +# include "../stdarg.h" +# include "../colors.h" +# include "../neural.h" +# include "../gps.h" +# include "../i2c.h" +# include "../jpeg.h" +# include "../malloc.h" +# include "../xmodem.h" +# define assert(x) +# undef BIG_ENDIAN +# define NO_CALLOC +# define NO_REALLOC +# define BROKEN_FLOAT_CASTS +# define BUILTIN_MINI_STDLIB +# else +# ifdef UMON_HOST +# define HEAP_SIZE (128*1024) /* space for the heap and the stack */ +# define NO_FP +# define BUILTIN_MINI_STDLIB +# include <stdlib.h> +# include <string.h> +# include <ctype.h> +# include <sys/types.h> +# include <stdarg.h> +# include <math.h> +# include "monlib.h" +# define assert(x) +# define malloc mon_malloc +# define calloc(a,b) mon_malloc(a*b) +# define realloc mon_realloc +# define free mon_free +# endif +# endif +# endif + +extern int ExitBuf[]; + +# endif +#endif + +#endif /* PLATFORM_H */ |