Revert "libuv: Remove GCCVER and add compilation options directly."

This reverts commit 13ce4707ff.
This commit is contained in:
GUIDINGLI 2024-10-11 21:39:23 +08:00
parent c4f3f05bfa
commit b7261a0270
2 changed files with 20 additions and 5 deletions

View file

@ -44,15 +44,23 @@ if(CONFIG_LIBUV)
endif()
endif()
if(NOT DEFINED GCCVER)
execute_process(COMMAND ${CMAKE_C_COMPILER} --version
OUTPUT_VARIABLE GCC_VERSION_OUTPUT)
string(REGEX MATCH "\\+\\+.* ([0-9]+)\\.[0-9]+" GCC_VERSION_REGEX
"${GCC_VERSION_OUTPUT}")
set(GCCVER ${CMAKE_MATCH_1})
endif()
# ############################################################################
# Flags
# ############################################################################
set(CFLAGS
-Wno-shadow -Wno-dangling-pointer
-DDEF_THREADPOOL_SIZE=CONFIG_LIBUV_THREADPOOL_SIZE
-DDEF_THREADPOOL_STACKSIZE=CONFIG_LIBUV_THREAD_STACKSIZE)
set(CFLAGS -Wno-shadow -DDEF_THREADPOOL_SIZE=CONFIG_LIBUV_THREADPOOL_SIZE
-DDEF_THREADPOOL_STACKSIZE=CONFIG_LIBUV_THREAD_STACKSIZE)
if(GCCVER EQUAL 12)
list(APPEND CFLAGS -Wno-dangling-pointer)
endif()
# ############################################################################
# Sources
# ############################################################################

View file

@ -49,10 +49,17 @@ CFLAGS += -I$(LIBUV_UNPACK)/src
CFLAGS += -I$(LIBUV_UNPACK)/src/unix
CFLAGS += -I$(LIBUV_UNPACK)/test
CFLAGS += -Wno-shadow
CFLAGS += -Wno-dangling-pointer
CFLAGS += -DDEF_THREADPOOL_SIZE=CONFIG_LIBUV_THREADPOOL_SIZE
CFLAGS += -DDEF_THREADPOOL_STACKSIZE=CONFIG_LIBUV_THREAD_STACKSIZE
ifeq ($(GCCVER),)
export GCCVER = $(shell $(CC) --version | grep gcc | sed -r 's/.* ([0-9]+\.[0-9]+).*/\1/' | cut -d'.' -f1)
endif
ifeq ($(GCCVER),12)
CFLAGS += -Wno-dangling-pointer
endif
VPATH += $(LIBUV_UNPACK)/src
VPATH += $(LIBUV_UNPACK)/src/unix
VPATH += $(LIBUV_UNPACK)/test