Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4878

General • Re: A Snek port for a Pico ?

$
0
0
@scruss - While digging for anything I could find about Snek I came across "snek 1.10 is the only one that comes with examples - compiling 1.10 is at the "hahaha no" stage" which I believe may be attributed to your own good self ?

If it's still failing - as 'make' is for me - you can try pasting the following "CMakeLists.txt" into the 'snek/ports/posix' directory, then -

Code:

cd snek/ports/posixnano CMakeLists.txtmkdir buildcd buildcmake ..make./snek-posix-cmake
That works for me on Pi 4B 1GB Bookworm 32-bit. No idea why when Keith's 'MakeFile' doesn't. Maybe I have missed something out ?

Code:

# .-------------------------------------------------------------------------.# |     This is the 'CMakeLists.txt' used for building the posix port of    |# |     Snek using CMake                                                    |# `-------------------------------------------------------------------------'set(PROJECT snek-posix-cmake)set(VERSION "1.10 - Hippy's Posix CMake Build")# .-------------------------------------------------------------------------.# |     This is going to be a default host GCC build                        |# `-------------------------------------------------------------------------'cmake_minimum_required(VERSION 3.12)project(${PROJECT} C CXX ASM)# .-------------------------------------------------------------------------.# |     Define source code locations                                        |# |-------------------------------------------------------------------------|# |                                                                         |# |     The code for Snek is at                 ~/.../snek                  |# |     The code for the posiz port is at       ~/.../snek/ports/posix      |# |                                                                         |# |     From the posix port directory, which holds this 'CMakeList.txt',    |# |     has the './build' directory within it -                             |# |                                                                         |# |     PORT is ~/.../snek/ports/posix          .                           |# |     SNEK is ~/.../snek/ports/posix/../..    ../..                       |# |                                                                         |# `-------------------------------------------------------------------------'set(PORT ${CMAKE_CURRENT_SOURCE_DIR}      )set(SNEK ${CMAKE_CURRENT_SOURCE_DIR}/../..)# .-------------------------------------------------------------------------.# |     Buid the posix port using specific port code and main Snek code     |# `-------------------------------------------------------------------------'add_executable(${PROJECT}    ${PORT}/snek-main.c    ${PORT}/snek-posix.c    ${PORT}/snek-curses.c    ${SNEK}/snek-builtin.c    ${SNEK}/snek-code.c    ${SNEK}/snek-error.c    ${SNEK}/snek-exec.c    ${SNEK}/snek-frame.c    ${SNEK}/snek-func.c    ${SNEK}/snek-input.c    ${SNEK}/snek-lex.c    ${SNEK}/snek-list.c    ${SNEK}/snek-math.c    ${SNEK}/snek-memory.c    ${SNEK}/snek-name.c    ${SNEK}/snek-parse.c    ${SNEK}/snek-poly.c    ${SNEK}/snek-print.c    ${SNEK}/snek-random.c               # New in 1.10    ${SNEK}/snek-string.c)# .-------------------------------------------------------------------------.# |     Specify the include directories we need                             |# `-------------------------------------------------------------------------'target_include_directories(${PROJECT} PUBLIC    ${PORT}    ${SNEK})# .-------------------------------------------------------------------------.# |     Specify compiler options                                            |# `-------------------------------------------------------------------------'target_compile_options(${PROJECT} PRIVATE### Cofiguration    -DSNEK_VERSION="${VERSION}"    -DSNEK_MEM_INCLUDE_NAME    -D_DEFAULT_SOURCE    -DUSE_READLINE    -Wall -Werror    -Wextra    -Wimplicit    -Wshadow    -O3    -g    -externs)# .-------------------------------------------------------------------------.# |     We need these libraries                                             |# `-------------------------------------------------------------------------'target_link_libraries(${PROJECT} readline m)# .-------------------------------------------------------------------------.# |     Build the grammer files - Needs 'lola' installed                    |# `-------------------------------------------------------------------------'add_custom_command(    OUTPUT            ${PORT}/snek-gram.h    DEPENDS            ${SNEK}/snek-gram.ll    COMMAND lola -DSNEK_SLICE -DSNEK_DICT         -o ${PORT}/snek-gram.h            ${SNEK}/snek-gram.ll)add_custom_target(GRAMMAR    DEPENDS ${PORT}/snek-gram.h            ${SNEK}/snek-gram.ll)add_dependencies(${PROJECT} GRAMMAR)# .-------------------------------------------------------------------------.# |     Build the built-ins                                                 |# `-------------------------------------------------------------------------'add_custom_command(    OUTPUT            ${PORT}/snek-builtin.h    DEPENDS            ${PORT}/snek-posix.builtin            #            ${SNEK}/snek-base.builtin            ${SNEK}/snek-input.builtin            ${SNEK}/snek-keyword.builtin            ${SNEK}/snek-math.builtin            ${SNEK}/snek-random.builtin    COMMAND python3 ${SNEK}/snek-builtin.py         -o ${PORT}/snek-builtin.h            #            ${PORT}/snek-posix.builtin            #            ${SNEK}/snek-base.builtin            ${SNEK}/snek-input.builtin            ${SNEK}/snek-keyword.builtin            ${SNEK}/snek-math.builtin            ${SNEK}/snek-random.builtin)add_custom_target(BUILTIN    DEPENDS ${PORT}/snek-builtin.h            #            ${PORT}/snek-posix.builtin            #            ${SNEK}/snek-base.builtin            ${SNEK}/snek-input.builtin            ${SNEK}/snek-keyword.builtin            ${SNEK}/snek-math.builtin            ${SNEK}/snek-random.builtin)add_dependencies(${PROJECT} BUILTIN)# .-------------------------------------------------------------------------.# |     End of 'CMakeLists.txt' for the posix port of Snek                  |# `-------------------------------------------------------------------------'
If you need 'lola' to build the grammar stuff -

Code:

cd snekgit clone https://github.com/keith-packard/lola.gitcd lolamakesudo make install

Statistics: Posted by hippy — Tue Dec 17, 2024 1:01 am



Viewing all articles
Browse latest Browse all 4878

Trending Articles