Skip to content

Commit

Permalink
Added support for building the project from Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
sysprogs committed Sep 5, 2022
1 parent e76e690 commit f35300b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
build
*.user
CMakeLists.txt.old
pico-sdk
20 changes: 17 additions & 3 deletions PicoHTTPServer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,19 @@ endif()
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

if (CMAKE_HOST_WIN32)
set(SIMPLE_FS_BUILDER_EXE ${CMAKE_CURRENT_SOURCE_DIR}/../tools/SimpleFSBuilder/SimpleFSBuilder.exe)
else()
set(SIMPLE_FS_BUILDER_EXE ${CMAKE_CURRENT_SOURCE_DIR}/../tools/SimpleFSBuilder/build/SimpleFSBuilder)
endif()

if (NOT EXISTS ${SIMPLE_FS_BUILDER_EXE})
message(FATAL_ERROR "Missing ${SIMPLE_FS_BUILDER_EXE}. Please build it before building this project.")
endif()

function(add_resource_folder target name path)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${name}.fs ${CMAKE_CURRENT_BINARY_DIR}/__rerun_${name}.fs
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../tools/SimpleFSBuilder/SimpleFSBuilder
COMMAND ${SIMPLE_FS_BUILDER_EXE}
ARGS ${path} ${CMAKE_CURRENT_BINARY_DIR}/${name}.fs
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating ${name}.fs")
Expand Down Expand Up @@ -61,6 +70,11 @@ target_link_libraries(PicoHTTPServer
pico_cyw43_arch_lwip_sys_freertos
pico_stdlib
pico_lwip_iperf
FreeRTOS-Kernel-Heap4
Profiler)
FreeRTOS-Kernel-Heap4)

if (TARGET Profiler)
target_link_libraries(PicoHTTPServer
Profiler)
endif()

pico_add_extra_outputs(PicoHTTPServer)
13 changes: 13 additions & 0 deletions build-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
mkdir -p tools/SimpleFSBuilder/build
mkdir -p tools/PicoHTTPServer/build
cmake -S tools/SimpleFSBuilder -B tools/SimpleFSBuilder/build
make -C tools/SimpleFSBuilder/build || exit 1

test -d pico-sdk || git clone --recursive https://github.com/raspberrypi/pico-sdk
test -d pico-sdk/FreeRTOS || git clone --recursive https://github.com/FreeRTOS/FreeRTOS-Kernel pico-sdk/FreeRTOS
grep -e ip4_secondary_ip_address pico-sdk/lib/lwip/src/core/ipv4/ip4.c || patch -p1 -d pico-sdk/lib/lwip < lwip_patch/lwip.patch || (echo "Failed to apply patch" && exit 1)


cmake -S PicoHTTPServer -B PicoHTTPServer/build -DPICO_SDK_PATH=`pwd`/pico-sdk -DPICO_GCC_TRIPLE=arm-none-eabi -DPICO_BOARD=pico_w -DWIFI_SSID="PicoHTTP" -DWIFI_PASSWORD=""
make -C PicoHTTPServer/build || exit 1
1 change: 1 addition & 0 deletions tools/SimpleFSBuilder/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
cmake_minimum_required(VERSION 2.7)
project(SimpleFSBuilder)
add_executable(SimpleFSBuilder SimpleFSBuilder.cpp)
set_property(TARGET SimpleFSBuilder PROPERTY CXX_STANDARD 17)
target_link_libraries(SimpleFSBuilder -static -static-libgcc -static-libstdc++)
1 change: 1 addition & 0 deletions tools/SimpleFSBuilder/SimpleFSBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <memory.h>
#include <string.h>
#include <map>
#include <vector>
#include "SimpleFS.h"

using namespace std;
Expand Down

0 comments on commit f35300b

Please sign in to comment.