CMakeLists.txt: Configure for compat oldest libstdc++

CMakeLists.txt: Add -fno-stack-protector
ExecuteString: Fix parser
build.yml: Add paths-ignore README.md
This commit is contained in:
s1lentq 2021-03-16 23:35:52 +07:00
parent 2e8bd9e1eb
commit ce0bfa11ab
11 changed files with 37 additions and 28 deletions

View File

@ -3,6 +3,9 @@ name: C/C++ CI
on:
push:
branches: [master]
paths-ignore:
- '**.md'
pull_request:
types: [opened, reopened, synchronize]
release:

View File

@ -25,7 +25,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections")
if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector")
endif()
if (USE_INTEL_COMPILER)
@ -40,7 +40,7 @@ else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors.
# As new processors are deployed in the marketplace, the behavior of this option will change.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\
-fpermissive\
-fpermissive -fno-sized-deallocation\
-Wno-unknown-pragmas -Wno-invalid-offsetof\
-Wno-unused-variable -Wno-unused-result -Wno-unused-function -Wno-delete-non-virtual-dtor\
-Wno-write-strings -Wno-format\

View File

@ -16,15 +16,18 @@ elseif (USE_CLANG_COMPILER)
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
endif()
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions")
if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector")
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie -Wl,--no-export-dynamic")
if (USE_INTEL_COMPILER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
@ -38,7 +41,7 @@ else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors.
# As new processors are deployed in the marketplace, the behavior of this option will change.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\
-fpermissive\
-fpermissive -fno-sized-deallocation\
-Wno-unused-result -Wno-unknown-pragmas -Wno-write-strings")
endif()
@ -96,5 +99,5 @@ endif()
add_executable(hltv ${appversion.sh} ${HLTV_SRCS} ${COMMON_SRCS})
target_link_libraries(hltv dl)
set_target_properties(hltv PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON)
set_target_properties(hltv PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
add_dependencies(hltv appversion)

View File

@ -173,19 +173,19 @@ void System::ExecuteString(const char *commands)
unsigned int i;
for (i = 0; i < ARRAYSIZE(singleCmd); i++)
{
char c = *pszSource++;
*pszDest++ = c;
const char c = *pszSource++;
if (c == '"')
{
bInQuote = !bInQuote;
}
else if (c == ';' && !bInQuote)
else if ((c == ';' && !bInQuote) || !c)
{
// End of command and not in a quoted string
break;
}
*pszDest++ = c;
}
if (i >= ARRAYSIZE(singleCmd))

View File

@ -21,7 +21,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions")
if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector")
endif()
if (USE_INTEL_COMPILER)
@ -36,7 +36,7 @@ else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors.
# As new processors are deployed in the marketplace, the behavior of this option will change.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\
-fpermissive\
-fpermissive -fno-sized-deallocation\
-Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\
-Wno-sign-compare -Wno-write-strings -Wno-strict-aliasing")

View File

@ -21,7 +21,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions")
if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector")
endif()
if (USE_INTEL_COMPILER)
@ -36,7 +36,7 @@ else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors.
# As new processors are deployed in the marketplace, the behavior of this option will change.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\
-fpermissive\
-fpermissive -fno-sized-deallocation\
-Wno-unused-result -Wno-unknown-pragmas\
-Wno-sign-compare -Wno-write-strings -Wno-strict-aliasing")
endif()

View File

@ -21,7 +21,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions")
if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector")
endif()
if (USE_INTEL_COMPILER)
@ -36,7 +36,7 @@ else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors.
# As new processors are deployed in the marketplace, the behavior of this option will change.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\
-fpermissive\
-fpermissive -fno-sized-deallocation\
-Wno-unused-result -Wno-unknown-pragmas\
-Wno-write-strings -Wno-strict-aliasing")
endif()

View File

@ -21,7 +21,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions")
if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector")
endif()
if (USE_INTEL_COMPILER)
@ -36,7 +36,7 @@ else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors.
# As new processors are deployed in the marketplace, the behavior of this option will change.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\
-fpermissive\
-fpermissive -fno-sized-deallocation\
-Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\
-Wno-write-strings -Wno-strict-aliasing")

View File

@ -16,15 +16,18 @@ elseif (USE_CLANG_COMPILER)
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
endif()
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions")
if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector")
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie")
set(CMAKE_EXE_LINKER_FLAGS "-no-pie -Wl,--no-export-dynamic")
if (USE_INTEL_COMPILER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
@ -38,7 +41,7 @@ else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors.
# As new processors are deployed in the marketplace, the behavior of this option will change.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\
-fpermissive\
-fpermissive -fno-sized-deallocation\
-Wno-unused-result")
endif()
@ -92,4 +95,4 @@ add_definitions(
add_executable(hlds ${DEDICATED_SRCS} ${COMMON_SRCS})
target_link_libraries(hlds dl)
set_target_properties(hlds PROPERTIES OUTPUT_NAME hlds_linux PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON)
set_target_properties(hlds PROPERTIES OUTPUT_NAME hlds_linux PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")

View File

@ -572,19 +572,19 @@ void SystemWrapper::ExecuteString(const char *commands)
unsigned int i;
for (i = 0; i < ARRAYSIZE(singleCmd); i++)
{
char c = *pszSource++;
*pszDest++ = c;
const char c = *pszSource++;
if (c == '"')
{
bInQuote = !bInQuote;
}
else if (c == ';' && !bInQuote)
else if ((c == ';' && !bInQuote) || !c)
{
// End of command and not in a quoted string
break;
}
*pszDest++ = c;
}
if (i >= ARRAYSIZE(singleCmd))

View File

@ -28,7 +28,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions")
if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector")
endif()
if (USE_INTEL_COMPILER)
@ -38,7 +38,7 @@ else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors.
# As new processors are deployed in the marketplace, the behavior of this option will change.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\
-fpermissive\
-fpermissive -fno-sized-deallocation\
-Wno-unknown-pragmas -Wno-unused-result -Wno-unused-variable -Wno-unused-function\
-Wno-write-strings -Wno-sign-compare")