diff --git a/libpicotcp/CMakeLists.txt b/libpicotcp/CMakeLists.txt index 1671b1acb..3434a7c7e 100644 --- a/libpicotcp/CMakeLists.txt +++ b/libpicotcp/CMakeLists.txt @@ -45,14 +45,14 @@ if(LibPicotcp) " -I$, -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 @@ -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} - - UPDATE_COMMAND - "" - PATCH_COMMAND - sed - -i - "s/(CROSS_COMPILE)gcc/(C_COMPILER)/g" - picotcp/Makefile - CONFIGURE_COMMAND - "" - BUILD_COMMAND - cd - /picotcp/ - && - sh - build.sh - BUILD_IN_SOURCE - 1 - INSTALL_COMMAND - "" - EXCLUDE_FROM_ALL - BUILD_BYPRODUCTS - "/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} + + UPDATE_COMMAND + "" + PATCH_COMMAND + sed + -i '' + "s/(CROSS_COMPILE)gcc/(C_COMPILER)/g" + picotcp/Makefile + CONFIGURE_COMMAND + "" + BUILD_COMMAND + cd + /picotcp/ + && + sh + build.sh + BUILD_IN_SOURCE + 1 + INSTALL_COMMAND + "" + EXCLUDE_FROM_ALL + BUILD_BYPRODUCTS + "/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} + + UPDATE_COMMAND + "" + PATCH_COMMAND + sed + -i + "s/(CROSS_COMPILE)gcc/(C_COMPILER)/g" + picotcp/Makefile + CONFIGURE_COMMAND + "" + BUILD_COMMAND + cd + /picotcp/ + && + sh + build.sh + BUILD_IN_SOURCE + 1 + INSTALL_COMMAND + "" + EXCLUDE_FROM_ALL + BUILD_BYPRODUCTS + "/picotcp/build/lib/libpicotcp.a" + DEPENDS + get_muslc + ) + endif() file( GLOB