Skip to content

Commit

Permalink
Change to support BSD sed
Browse files Browse the repository at this point in the history
Signed-off-by: Alwin Joshy <joshyalwin@gmail.com>
  • Loading branch information
alwin-joshy committed Sep 11, 2023
1 parent dba244d commit 980c14a
Showing 1 changed file with 75 additions and 37 deletions.
112 changes: 75 additions & 37 deletions libpicotcp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ if(LibPicotcp)
" -I$<JOIN:$<TARGET_PROPERTY:muslc,INTERFACE_INCLUDE_DIRECTORIES>, -I>"
)

if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
list(APPEND compile_options "${CMAKE_C_COMPILE_OPTIONS_TARGET}${CMAKE_C_COMPILER_TARGET}")
set(C_COMPILER clang)
else()
set(C_COMPILER ${CROSS_COMPILER_PREFIX}gcc)
endif()

if (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(perf_flags "\"PERF=1\" \"DEBUG=0\"")
endif()
# generate a build.sh script to avoid nasty escape issues, we then invoke this in ExternalProject_Add
Expand All @@ -74,41 +74,79 @@ if(LibPicotcp)

# build picotcp using its very own build system
include(ExternalProject)
ExternalProject_Add(
picotcp_external
SOURCE_DIR
"picotcp_external"
DOWNLOAD_COMMAND
rsync
-qur
--exclude='.git'
${PICOTCP_PATH}
<SOURCE_DIR>
UPDATE_COMMAND
""
PATCH_COMMAND
sed
-i
"s/(CROSS_COMPILE)gcc/(C_COMPILER)/g"
picotcp/Makefile
CONFIGURE_COMMAND
""
BUILD_COMMAND
cd
<SOURCE_DIR>/picotcp/
&&
sh
build.sh
BUILD_IN_SOURCE
1
INSTALL_COMMAND
""
EXCLUDE_FROM_ALL
BUILD_BYPRODUCTS
"<SOURCE_DIR>/picotcp/build/lib/libpicotcp.a"
DEPENDS
get_muslc
)
if(CMAKE_HOST_APPLE)
ExternalProject_Add(
picotcp_external
SOURCE_DIR
"picotcp_external"
DOWNLOAD_COMMAND
rsync
-qur
--exclude='.git'
${PICOTCP_PATH}
<SOURCE_DIR>
UPDATE_COMMAND
""
PATCH_COMMAND
sed
-i ''
"s/(CROSS_COMPILE)gcc/(C_COMPILER)/g"
picotcp/Makefile
CONFIGURE_COMMAND
""
BUILD_COMMAND
cd
<SOURCE_DIR>/picotcp/
&&
sh
build.sh
BUILD_IN_SOURCE
1
INSTALL_COMMAND
""
EXCLUDE_FROM_ALL
BUILD_BYPRODUCTS
"<SOURCE_DIR>/picotcp/build/lib/libpicotcp.a"
DEPENDS
get_muslc
)
else()
ExternalProject_Add(
picotcp_external
SOURCE_DIR
"picotcp_external"
DOWNLOAD_COMMAND
rsync
-qur
--exclude='.git'
${PICOTCP_PATH}
<SOURCE_DIR>
UPDATE_COMMAND
""
PATCH_COMMAND
sed
-i
"s/(CROSS_COMPILE)gcc/(C_COMPILER)/g"
picotcp/Makefile
CONFIGURE_COMMAND
""
BUILD_COMMAND
cd
<SOURCE_DIR>/picotcp/
&&
sh
build.sh
BUILD_IN_SOURCE
1
INSTALL_COMMAND
""
EXCLUDE_FROM_ALL
BUILD_BYPRODUCTS
"<SOURCE_DIR>/picotcp/build/lib/libpicotcp.a"
DEPENDS
get_muslc
)
endif()

file(
GLOB
Expand Down

0 comments on commit 980c14a

Please sign in to comment.