mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-24 12:37:57 +03:00
workflows/build.yml: add unittests for linux
CMakeLists.txt minor refactoring
This commit is contained in:
parent
7cfea77b93
commit
7bd3d73b79
57
.github/workflows/build.yml
vendored
57
.github/workflows/build.yml
vendored
@ -34,6 +34,7 @@ jobs:
|
||||
with:
|
||||
nuget-api-key: ${{ secrets.NuGetAPIKey }}
|
||||
nuget-version: '5.x'
|
||||
|
||||
- run: nuget restore '${{ env.solution }}'
|
||||
|
||||
- name: Setup MSBuild
|
||||
@ -41,12 +42,7 @@ jobs:
|
||||
with:
|
||||
vs-version: '16.8'
|
||||
|
||||
- name: Build ReHLDS
|
||||
run: |
|
||||
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildRelease }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false
|
||||
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildReleasePlay }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false
|
||||
|
||||
- name: Build and Testing
|
||||
- name: Build and Run unittests
|
||||
run: |
|
||||
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildTest }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false
|
||||
.\"msvc\Test Fixes\swds.exe"
|
||||
@ -55,6 +51,11 @@ jobs:
|
||||
{[Environment]::Exit(1)}
|
||||
shell: "pwsh"
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildRelease }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false
|
||||
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildReleasePlay }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false
|
||||
|
||||
- name: Move files
|
||||
run: |
|
||||
mkdir publish\debug
|
||||
@ -112,17 +113,17 @@ jobs:
|
||||
mv $GITHUB_WORKSPACE/tests/swds.dll .
|
||||
|
||||
descs=(
|
||||
"CS: Multiplayer"
|
||||
"Half-Life: Physics singleplayer"
|
||||
"Half-Life: Multiplayer on crossfire map"
|
||||
"Half-Life: Shooting with several weapons"
|
||||
"CS: Multiplayer"
|
||||
)
|
||||
|
||||
demos=(
|
||||
"cstrike-muliplayer-1"
|
||||
"rehlds-phys-single1"
|
||||
"crossfire-1-multiplayer-1"
|
||||
"shooting-hl-1"
|
||||
"cstrike-muliplayer-1"
|
||||
)
|
||||
|
||||
retVal=0
|
||||
@ -168,6 +169,30 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Build and Run unittests
|
||||
run: |
|
||||
rm -rf build && CC=icc CXX=icpc cmake -DCMAKE_BUILD_TYPE=Unittests -B build && cmake --build build -j8
|
||||
retVal=0
|
||||
export LD_LIBRARY_PATH="rehlds/lib/linux32:$LD_LIBRARY_PATH"
|
||||
./build/rehlds/engine_i486 2> /dev/null > result.log || retVal=$?
|
||||
while read line; do
|
||||
if [[ ${line} == *"Warning in test"* ]] ; then
|
||||
echo -e "\e[2;38m$line"
|
||||
elif [[ ${line} == *"Failure in test"* ]] ; then
|
||||
echo -e "\e[1;31m$line"
|
||||
else
|
||||
echo -e "\e[0;33m$line"
|
||||
fi
|
||||
done <<< $(cat result.log)
|
||||
|
||||
if [ $retVal -ne 0 ] && [ $retVal -ne 3 ]; then
|
||||
echo -e "\e[30;41mExit code: $retVal\e[0m"
|
||||
exit 1 # Unittest failed
|
||||
else
|
||||
echo -e "\e[30;43mExit code: $retVal\e[0m"
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Build using Intel C++ Compiler
|
||||
run: |
|
||||
rm -rf build && CC=icc CXX=icpc cmake -B build && cmake --build build -j8
|
||||
@ -244,14 +269,14 @@ jobs:
|
||||
- name: Reading appversion.h
|
||||
run: |
|
||||
if [ -e appversion.h ]; then
|
||||
APP_VERSION=$(cat appversion.h | grep -wi '#define APP_VERSION_STRD' | sed -e 's/#define APP_VERSION_STRD[ \t\r\n\v\f]\+\(.*\)/\1/i' -e 's/\r//g')
|
||||
if [ $? -ne 0 ]; then
|
||||
APP_VERSION=""
|
||||
else
|
||||
# Remove quotes
|
||||
APP_VERSION=$(echo $APP_VERSION | xargs)
|
||||
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
|
||||
fi
|
||||
APP_VERSION=$(cat appversion.h | grep -wi '#define APP_VERSION_STRD' | sed -e 's/#define APP_VERSION_STRD[ \t\r\n\v\f]\+\(.*\)/\1/i' -e 's/\r//g')
|
||||
if [ $? -ne 0 ]; then
|
||||
APP_VERSION=""
|
||||
else
|
||||
# Remove quotes
|
||||
APP_VERSION=$(echo $APP_VERSION | xargs)
|
||||
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
|
||||
fi
|
||||
fi
|
||||
rm -f appversion.h
|
||||
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,6 +3,7 @@
|
||||
*.bat
|
||||
*.log
|
||||
*.lnk
|
||||
*.aps
|
||||
**/msvc/Debug*
|
||||
**/msvc/Release*
|
||||
**/msvc/Tests
|
||||
|
@ -10,6 +10,9 @@ add_custom_target(appversion DEPENDS
|
||||
)
|
||||
|
||||
add_subdirectory(rehlds)
|
||||
add_subdirectory(rehlds/dedicated)
|
||||
add_subdirectory(rehlds/filesystem)
|
||||
add_subdirectory(rehlds/HLTV)
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE MATCHES Unittests)
|
||||
add_subdirectory(rehlds/dedicated)
|
||||
add_subdirectory(rehlds/filesystem)
|
||||
add_subdirectory(rehlds/HLTV)
|
||||
endif()
|
||||
|
25
dep/cppunitlite/CMakeLists.txt
Normal file
25
dep/cppunitlite/CMakeLists.txt
Normal file
@ -0,0 +1,25 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(cppunitlite CXX)
|
||||
|
||||
add_library(cppunitlite STATIC)
|
||||
|
||||
target_sources(cppunitlite PRIVATE
|
||||
src/Test.cpp
|
||||
src/TestResult.cpp
|
||||
src/TestRegistry.cpp
|
||||
src/Assertions.cpp
|
||||
src/MainAdapter.cpp
|
||||
)
|
||||
|
||||
target_include_directories(cppunitlite PRIVATE
|
||||
"${PROJECT_SOURCE_DIR}/src"
|
||||
"${PROJECT_SOURCE_DIR}/include"
|
||||
)
|
||||
|
||||
target_compile_definitions(cppunitlite PRIVATE
|
||||
_GLIBCXX_USE_CXX11_ABI=0
|
||||
)
|
||||
|
||||
target_compile_options(cppunitlite PRIVATE
|
||||
-m32
|
||||
)
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
class GradleAdapter {
|
||||
class MainAdapter {
|
||||
public:
|
||||
int writeAllTestsInfoToFile(const char* fname);
|
||||
int runTest(const char* groupName, const char* testName);
|
@ -13,7 +13,7 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\cppunitlite\Assertions.h" />
|
||||
<ClInclude Include="..\include\cppunitlite\Failure.h" />
|
||||
<ClInclude Include="..\include\cppunitlite\GradleAdapter.h" />
|
||||
<ClInclude Include="..\include\cppunitlite\MainAdapter.h" />
|
||||
<ClInclude Include="..\include\cppunitlite\Test.h" />
|
||||
<ClInclude Include="..\include\cppunitlite\TestHarness.h" />
|
||||
<ClInclude Include="..\include\cppunitlite\TestRegistry.h" />
|
||||
@ -21,7 +21,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\Assertions.cpp" />
|
||||
<ClCompile Include="..\src\GradleAdapter.cpp" />
|
||||
<ClCompile Include="..\src\MainAdapter.cpp" />
|
||||
<ClCompile Include="..\src\Test.cpp" />
|
||||
<ClCompile Include="..\src\TestRegistry.cpp" />
|
||||
<ClCompile Include="..\src\TestResult.cpp" />
|
||||
|
@ -27,7 +27,7 @@
|
||||
<ClInclude Include="..\include\cppunitlite\TestResult.h">
|
||||
<Filter>include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\cppunitlite\GradleAdapter.h">
|
||||
<ClInclude Include="..\include\cppunitlite\MainAdapter.h">
|
||||
<Filter>include</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
@ -44,7 +44,7 @@
|
||||
<ClCompile Include="..\src\TestResult.cpp">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\GradleAdapter.cpp">
|
||||
<ClCompile Include="..\src\MainAdapter.cpp">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
@ -2,11 +2,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "cppunitlite/GradleAdapter.h"
|
||||
#include "cppunitlite/MainAdapter.h"
|
||||
#include "cppunitlite/Test.h"
|
||||
#include "cppunitlite/TestRegistry.h"
|
||||
|
||||
int GradleAdapter::writeAllTestsInfoToFile(const char* fname) {
|
||||
int MainAdapter::writeAllTestsInfoToFile(const char* fname) {
|
||||
FILE* outFile = fopen(fname, "w");
|
||||
if (outFile == NULL) {
|
||||
return 1;
|
||||
@ -33,7 +33,7 @@ int GradleAdapter::writeAllTestsInfoToFile(const char* fname) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GradleAdapter::runTest(const char* groupName, const char* testName) {
|
||||
int MainAdapter::runTest(const char* groupName, const char* testName) {
|
||||
Test* curTest = TestRegistry::getFirstTest();
|
||||
while (curTest != NULL) {
|
||||
if (!strcmp(groupName, curTest->getGroup()) && !strcmp(testName, curTest->getName())) {
|
||||
@ -61,7 +61,7 @@ int GradleAdapter::runTest(const char* groupName, const char* testName) {
|
||||
}
|
||||
}
|
||||
|
||||
int GradleAdapter::runGroup(const char* groupName) {
|
||||
int MainAdapter::runGroup(const char* groupName) {
|
||||
Test* curTest = TestRegistry::getFirstTest();
|
||||
int ranTests = 0;
|
||||
int warnTest = 0;
|
||||
@ -101,7 +101,7 @@ int GradleAdapter::runGroup(const char* groupName) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GradleAdapter::runAllTests() {
|
||||
int MainAdapter::runAllTests() {
|
||||
Test* curTest = TestRegistry::getFirstTest();
|
||||
int ranTests = 0;
|
||||
int warnTest = 0;
|
||||
@ -131,7 +131,7 @@ int GradleAdapter::runAllTests() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GradleAdapter::testsEntryPoint(int argc, char* argv[]) {
|
||||
int MainAdapter::testsEntryPoint(int argc, char* argv[]) {
|
||||
if (argc < 2 || !strcmp(argv[1], "-all")) {
|
||||
return runAllTests();
|
||||
}
|
@ -5,6 +5,7 @@
|
||||
#include "cppunitlite/Failure.h"
|
||||
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
@ -30,6 +31,7 @@ void Test::setNext(Test *test)
|
||||
void Test::run(TestResult &result) {
|
||||
try {
|
||||
runInternal();
|
||||
std::cout << "Test::run() > " << group_ << "::" << name_ << " Passed" << std::endl;
|
||||
} catch (TestFailException &e) {
|
||||
result.addFailure(Failure(e, name_));
|
||||
} catch (std::exception &e) {
|
||||
|
@ -25,39 +25,45 @@ option(USE_STATIC_LIBSTDC "Enables static linking libstdc++." OFF)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-rtti -fno-exceptions")
|
||||
# Avoid -rdynamic -fPIC options
|
||||
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
||||
|
||||
set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE")
|
||||
set(LINK_FLAGS "-m32")
|
||||
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-rtti -fno-exceptions")
|
||||
|
||||
# Remove noxref code and data
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -ffunction-sections -fdata-sections")
|
||||
|
||||
if (DEBUG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector")
|
||||
endif()
|
||||
|
||||
# Check Intel C++ compiler
|
||||
if ($ENV{CXX} MATCHES "icpc")
|
||||
if ("$ENV{CXX}" MATCHES "icpc")
|
||||
# -fp-model=precise
|
||||
# ICC uses -fp-model fast=1 by default for more aggressive optimizations on floating-point calculations
|
||||
# https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/floating-point-options/fp-model-fp.html#fp-model-fp_GUID-99936BBA-1508-4E9F-AC09-FA98613CE2F5
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} \
|
||||
-fp-model=precise\
|
||||
-fasm-blocks\
|
||||
-Qoption,cpp,--treat_func_as_string_literal_cpp")
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions")
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -static-intel -no-intel-extensions")
|
||||
|
||||
if (NOT DEBUG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ipo")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo")
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -ipo")
|
||||
endif()
|
||||
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} \
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} \
|
||||
-mtune=generic -msse3\
|
||||
-fpermissive -fno-sized-deallocation\
|
||||
-Wno-unknown-pragmas -Wno-invalid-offsetof\
|
||||
@ -66,31 +72,26 @@ else()
|
||||
-Wno-sign-compare -Wno-strict-aliasing -Wno-ignored-attributes")
|
||||
|
||||
# Check if not Clang compiler
|
||||
if (NOT $ENV{CXX} MATCHES "clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-plt -Wno-unused-but-set-variable")
|
||||
if (NOT "$ENV{CXX}" MATCHES "clang")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -fno-plt -Wno-unused-but-set-variable")
|
||||
|
||||
# GCC >= 8.3
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation -Wno-class-memaccess")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-stringop-truncation -Wno-format-truncation -Wno-class-memaccess")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# GCC >= 8.3
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -fcf-protection=none")
|
||||
endif()
|
||||
|
||||
if (NOT DEBUG)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} \
|
||||
set(LINK_FLAGS "${LINK_FLAGS} \
|
||||
-Wl,-gc-sections -Wl,--version-script=\"${PROJECT_SOURCE_DIR}/../version_script.lds\"")
|
||||
endif()
|
||||
|
||||
if (USE_STATIC_LIBSTDC)
|
||||
add_definitions(-DBUILD_STATIC_LIBSTDC)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++")
|
||||
endif()
|
||||
|
||||
set(PROJECT_SRC_DIR
|
||||
"${PROJECT_SOURCE_DIR}"
|
||||
"${PROJECT_SOURCE_DIR}/engine"
|
||||
@ -98,12 +99,17 @@ set(PROJECT_SRC_DIR
|
||||
"${PROJECT_SOURCE_DIR}/pm_shared"
|
||||
"${PROJECT_SOURCE_DIR}/rehlds"
|
||||
"${PROJECT_SOURCE_DIR}/testsuite"
|
||||
"${PROJECT_SOURCE_DIR}/unittests"
|
||||
)
|
||||
|
||||
set(PROJECT_BZIP2_DIR
|
||||
"${PROJECT_SOURCE_DIR}/../dep/bzip2/include"
|
||||
)
|
||||
|
||||
set(PROJECT_CPPUNITLITE_DIR
|
||||
"${PROJECT_SOURCE_DIR}/../dep/cppunitlite/include"
|
||||
)
|
||||
|
||||
set(PROJECT_PUBLIC_DIR
|
||||
"${PROJECT_SOURCE_DIR}/public"
|
||||
"${PROJECT_SOURCE_DIR}/public/rehlds"
|
||||
@ -179,6 +185,21 @@ set(ENGINE_SRCS
|
||||
rehlds/rehlds_security.cpp
|
||||
)
|
||||
|
||||
set(UNITTESTS_SRCS
|
||||
unittests/common_tests.cpp
|
||||
unittests/crc32c_tests.cpp
|
||||
unittests/delta_tests.cpp
|
||||
unittests/info_tests.cpp
|
||||
unittests/mathlib_tests.cpp
|
||||
unittests/rehlds_tests_shared.cpp
|
||||
unittests/rehlds_tests_shared.h
|
||||
unittests/security_tests.cpp
|
||||
unittests/struct_offsets_tests.cpp
|
||||
unittests/TestRunner.cpp
|
||||
unittests/tmessage_tests.cpp
|
||||
unittests/unicode_tests.cpp
|
||||
)
|
||||
|
||||
set(COMMON_SRCS
|
||||
"common/BaseSystemModule.cpp"
|
||||
"common/ObjectList.cpp"
|
||||
@ -192,56 +213,91 @@ set(PUBLIC_SRCS
|
||||
"public/utlbuffer.cpp"
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${PROJECT_SRC_DIR}
|
||||
${PROJECT_BZIP2_DIR}
|
||||
${PROJECT_PUBLIC_DIR}
|
||||
)
|
||||
if (CMAKE_BUILD_TYPE MATCHES Unittests)
|
||||
if (NOT TARGET cppunitlite)
|
||||
add_subdirectory(../dep/cppunitlite cppunitlite)
|
||||
endif()
|
||||
|
||||
add_definitions(
|
||||
-DSWDS
|
||||
-DREHLDS_JIT
|
||||
-DREHLDS_SSE
|
||||
-DREHLDS_FIXES
|
||||
-DREHLDS_CHECKS
|
||||
-DREHLDS_API
|
||||
-DREHLDS_SELF
|
||||
-DREHLDS_OPT_PEDANTIC
|
||||
-DHAVE_OPT_STRTOOLS
|
||||
-DUSE_BREAKPAD_HANDLER
|
||||
-D_LINUX
|
||||
-DLINUX
|
||||
-D_GLIBCXX_USE_CXX11_ABI=0
|
||||
-U_FORTIFY_SOURCE
|
||||
-D_stricmp=strcasecmp
|
||||
-D_strnicmp=strncasecmp
|
||||
-D_strdup=strdup
|
||||
-D_unlink=unlink
|
||||
-D_vsnprintf=vsnprintf
|
||||
-D_vsnwprintf=vswprintf
|
||||
)
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} \
|
||||
-Wl,-rpath,'$ORIGIN/.' \
|
||||
-L${PROJECT_SOURCE_DIR}/lib/linux32")
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -no-pie -Wl,--no-export-dynamic")
|
||||
add_executable(engine ${appversion.sh})
|
||||
target_link_libraries(engine PRIVATE cppunitlite)
|
||||
else()
|
||||
add_library(engine SHARED ${appversion.sh})
|
||||
endif()
|
||||
|
||||
if (NOT TARGET bzip2)
|
||||
add_subdirectory(../dep/bzip2 lib)
|
||||
add_subdirectory(../dep/bzip2 bzip2)
|
||||
endif()
|
||||
|
||||
if (NOT TARGET appversion)
|
||||
add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/version/appversion.sh" "${PROJECT_SOURCE_DIR}/..")
|
||||
endif()
|
||||
|
||||
add_library(engine SHARED ${appversion.sh} ${ENGINE_SRCS} ${COMMON_SRCS} ${PUBLIC_SRCS})
|
||||
add_dependencies(engine appversion)
|
||||
|
||||
set_target_properties(engine PROPERTIES
|
||||
LIBRARY_OUTPUT_NAME engine_i486
|
||||
PREFIX ""
|
||||
COMPILE_FLAGS "-m32"
|
||||
LINK_FLAGS "-m32"
|
||||
POSITION_INDEPENDENT_CODE OFF
|
||||
target_include_directories(engine PRIVATE
|
||||
${PROJECT_SRC_DIR}
|
||||
${PROJECT_BZIP2_DIR}
|
||||
${PROJECT_CPPUNITLITE_DIR}
|
||||
${PROJECT_PUBLIC_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(engine dl rt m aelf32 bzip2 steam_api)
|
||||
target_compile_definitions(engine PRIVATE
|
||||
SWDS
|
||||
REHLDS_JIT
|
||||
REHLDS_SSE
|
||||
REHLDS_FIXES
|
||||
REHLDS_CHECKS
|
||||
REHLDS_API
|
||||
REHLDS_SELF
|
||||
REHLDS_OPT_PEDANTIC
|
||||
HAVE_OPT_STRTOOLS
|
||||
USE_BREAKPAD_HANDLER
|
||||
_LINUX
|
||||
LINUX
|
||||
_GLIBCXX_USE_CXX11_ABI=0
|
||||
_stricmp=strcasecmp
|
||||
_strnicmp=strncasecmp
|
||||
_strdup=strdup
|
||||
_unlink=unlink
|
||||
_vsnprintf=vsnprintf
|
||||
_vsnwprintf=vswprintf
|
||||
|
||||
$<$<CONFIG:Unittests>:
|
||||
REHLDS_UNIT_TESTS REHLDS_SSE REHLDS_JIT>
|
||||
)
|
||||
|
||||
target_sources(engine PRIVATE
|
||||
${ENGINE_SRCS}
|
||||
${COMMON_SRCS}
|
||||
${PUBLIC_SRCS}
|
||||
|
||||
$<$<CONFIG:Unittests>:
|
||||
${UNITTESTS_SRCS}>
|
||||
)
|
||||
|
||||
target_link_libraries(engine PRIVATE
|
||||
dl
|
||||
rt
|
||||
m
|
||||
aelf32
|
||||
bzip2
|
||||
steam_api
|
||||
)
|
||||
|
||||
if (USE_STATIC_LIBSTDC)
|
||||
target_compile_definitions(engine PRIVATE BUILD_STATIC_LIBSTDC)
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -static-libgcc -static-libstdc++")
|
||||
endif()
|
||||
|
||||
set(LINK_FLAGS "${LINK_FLAGS} \
|
||||
-Wl,-rpath,'$ORIGIN/.' \
|
||||
-L${PROJECT_SOURCE_DIR}/lib/linux32")
|
||||
|
||||
set_target_properties(engine PROPERTIES
|
||||
OUTPUT_NAME engine_i486
|
||||
PREFIX ""
|
||||
COMPILE_FLAGS ${COMPILE_FLAGS}
|
||||
LINK_FLAGS ${LINK_FLAGS}
|
||||
POSITION_INDEPENDENT_CODE OFF
|
||||
)
|
||||
|
@ -6,45 +6,48 @@ option(DEBUG "Build with debug information." OFF)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
||||
# Avoid -rdynamic -fPIC options
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions")
|
||||
set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE")
|
||||
set(LINK_FLAGS "-m32")
|
||||
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions")
|
||||
|
||||
if (DEBUG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector")
|
||||
endif()
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie -Wl,--no-export-dynamic")
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -no-pie -Wl,--no-export-dynamic")
|
||||
|
||||
# Check Intel C++ compiler
|
||||
if ($ENV{CXX} MATCHES "icpc")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-intel -no-intel-extensions")
|
||||
if ("$ENV{CXX}" MATCHES "icpc")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -static-intel -no-intel-extensions")
|
||||
|
||||
if (NOT DEBUG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo")
|
||||
set(LINK_FLAGS "${COMPILE_FLAGS} -ipo")
|
||||
endif()
|
||||
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} \
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} \
|
||||
-mtune=generic -msse3 -flto\
|
||||
-fpermissive -fno-sized-deallocation\
|
||||
-Wno-unused-result -Wno-unknown-pragmas -Wno-write-strings")
|
||||
|
||||
# Check if not Clang compiler AND GCC >= 8.3
|
||||
if (NOT $ENV{CXX} MATCHES "clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation")
|
||||
if (NOT "$ENV{CXX}" MATCHES "clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-stringop-truncation -Wno-format-truncation")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# GCC >= 8.3
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -fcf-protection=none")
|
||||
endif()
|
||||
|
||||
set(PROJECT_SRC_DIR
|
||||
@ -77,37 +80,44 @@ set(COMMON_SRCS
|
||||
"../../engine/mem.cpp"
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${PROJECT_SRC_DIR}
|
||||
${PROJECT_PUBLIC_DIR}
|
||||
)
|
||||
|
||||
add_definitions(
|
||||
-DLAUNCHER_FIXES
|
||||
-D_CONSOLE
|
||||
-D_LINUX
|
||||
-DLINUX
|
||||
-D_GLIBCXX_USE_CXX11_ABI=0
|
||||
-U_FORTIFY_SOURCE
|
||||
-D_stricmp=strcasecmp
|
||||
-D_strnicmp=strncasecmp
|
||||
-D_strdup=strdup
|
||||
-D_vsnprintf=vsnprintf
|
||||
-D_snprintf=snprintf
|
||||
)
|
||||
|
||||
if (NOT TARGET appversion)
|
||||
add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/../../version/appversion.sh" "${PROJECT_SOURCE_DIR}/../../..")
|
||||
endif()
|
||||
|
||||
add_executable(hltv ${appversion.sh} ${HLTV_SRCS} ${COMMON_SRCS})
|
||||
add_executable(hltv ${appversion.sh})
|
||||
add_dependencies(hltv appversion)
|
||||
|
||||
target_link_libraries(hltv dl)
|
||||
target_include_directories(hltv PRIVATE
|
||||
${PROJECT_SRC_DIR}
|
||||
${PROJECT_PUBLIC_DIR}
|
||||
)
|
||||
|
||||
target_compile_definitions(hltv PRIVATE
|
||||
LAUNCHER_FIXES
|
||||
_CONSOLE
|
||||
_LINUX
|
||||
LINUX
|
||||
_GLIBCXX_USE_CXX11_ABI=0
|
||||
_stricmp=strcasecmp
|
||||
_strnicmp=strncasecmp
|
||||
_strdup=strdup
|
||||
_vsnprintf=vsnprintf
|
||||
_snprintf=snprintf
|
||||
)
|
||||
|
||||
target_sources(hltv PRIVATE
|
||||
${HLTV_SRCS}
|
||||
${COMMON_SRCS}
|
||||
)
|
||||
|
||||
target_link_libraries(hltv PRIVATE
|
||||
dl
|
||||
)
|
||||
|
||||
set_target_properties(hltv PROPERTIES
|
||||
LIBRARY_OUTPUT_NAME hltv
|
||||
OUTPUT_NAME hltv
|
||||
PREFIX ""
|
||||
COMPILE_FLAGS "-m32"
|
||||
LINK_FLAGS "-m32"
|
||||
COMPILE_FLAGS ${COMPILE_FLAGS}
|
||||
LINK_FLAGS ${LINK_FLAGS}
|
||||
POSITION_INDEPENDENT_CODE OFF
|
||||
)
|
||||
|
@ -5,47 +5,52 @@ option(DEBUG "Build with debug information." OFF)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Avoid -fPIC option
|
||||
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions")
|
||||
set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE")
|
||||
set(LINK_FLAGS "-m32")
|
||||
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions")
|
||||
|
||||
if (DEBUG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector")
|
||||
endif()
|
||||
|
||||
# Check Intel C++ compiler
|
||||
if ($ENV{CXX} MATCHES "icpc")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions")
|
||||
if ("$ENV{CXX}" MATCHES "icpc")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -static-intel -no-intel-extensions")
|
||||
|
||||
if (NOT DEBUG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ipo")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo")
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -ipo")
|
||||
endif()
|
||||
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\
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -mtune=generic -msse3 -flto\
|
||||
-fpermissive -fno-sized-deallocation\
|
||||
-Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\
|
||||
-Wno-sign-compare -Wno-write-strings -Wno-strict-aliasing")
|
||||
|
||||
# Check Clang compiler
|
||||
if ($ENV{CXX} MATCHES "clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field")
|
||||
if ("$ENV{CXX}" MATCHES "clang")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-unused-private-field")
|
||||
else()
|
||||
# GCC >= 8.3
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-stringop-truncation -Wno-format-truncation")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# GCC >= 8.3
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -fcf-protection=none")
|
||||
endif()
|
||||
|
||||
set(PROJECT_SRC_DIR
|
||||
@ -96,36 +101,46 @@ set(COMMON_SRCS
|
||||
"../../engine/mem.cpp"
|
||||
)
|
||||
|
||||
include_directories(
|
||||
add_library(core SHARED)
|
||||
|
||||
target_include_directories(core PRIVATE
|
||||
${PROJECT_SRC_DIR}
|
||||
${PROJECT_BZIP2_DIR}
|
||||
${PROJECT_PUBLIC_DIR}
|
||||
)
|
||||
|
||||
add_definitions(
|
||||
-DHLTV
|
||||
-DHLTV_FIXES
|
||||
-D_LINUX
|
||||
-DLINUX
|
||||
-D_GLIBCXX_USE_CXX11_ABI=0
|
||||
-U_FORTIFY_SOURCE
|
||||
-D_stricmp=strcasecmp
|
||||
-D_strnicmp=strncasecmp
|
||||
-D_strdup=strdup
|
||||
-D_vsnprintf=vsnprintf
|
||||
-D_snprintf=snprintf
|
||||
target_compile_definitions(core PRIVATE
|
||||
HLTV
|
||||
HLTV_FIXES
|
||||
_LINUX
|
||||
LINUX
|
||||
_GLIBCXX_USE_CXX11_ABI=0
|
||||
_stricmp=strcasecmp
|
||||
_strnicmp=strncasecmp
|
||||
_strdup=strdup
|
||||
_vsnprintf=vsnprintf
|
||||
_snprintf=snprintf
|
||||
)
|
||||
|
||||
target_sources(core PRIVATE
|
||||
${CORE_SRCS}
|
||||
${COMMON_SRCS}
|
||||
)
|
||||
|
||||
target_link_libraries(core PRIVATE
|
||||
dl
|
||||
m
|
||||
bzip2
|
||||
)
|
||||
|
||||
if (NOT TARGET bzip2)
|
||||
add_subdirectory(../../../dep/bzip2 lib)
|
||||
endif()
|
||||
|
||||
add_library(core SHARED ${CORE_SRCS} ${COMMON_SRCS})
|
||||
target_link_libraries(core dl m bzip2)
|
||||
set_target_properties(core PROPERTIES
|
||||
LIBRARY_OUTPUT_NAME core
|
||||
OUTPUT_NAME core
|
||||
PREFIX ""
|
||||
COMPILE_FLAGS "-m32"
|
||||
LINK_FLAGS "-m32"
|
||||
COMPILE_FLAGS ${COMPILE_FLAGS}
|
||||
LINK_FLAGS ${LINK_FLAGS}
|
||||
POSITION_INDEPENDENT_CODE OFF
|
||||
)
|
||||
|
@ -5,29 +5,34 @@ option(DEBUG "Build with debug information." OFF)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Avoid -fPIC option
|
||||
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions")
|
||||
set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE")
|
||||
set(LINK_FLAGS "-m32")
|
||||
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions")
|
||||
|
||||
if (DEBUG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector")
|
||||
endif()
|
||||
|
||||
# Check Intel C++ compiler
|
||||
if ($ENV{CXX} MATCHES "icpc")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions")
|
||||
if ("$ENV{CXX}" MATCHES "icpc")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -static-intel -no-intel-extensions")
|
||||
|
||||
if (NOT DEBUG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ipo")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo")
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -ipo")
|
||||
endif()
|
||||
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} \
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} \
|
||||
-mtune=generic -msse3 -flto\
|
||||
-fpermissive -fno-sized-deallocation\
|
||||
-Wno-unused-result -Wno-unknown-pragmas\
|
||||
@ -36,7 +41,7 @@ endif()
|
||||
|
||||
# GCC >= 8.3
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -fcf-protection=none")
|
||||
endif()
|
||||
|
||||
set(PROJECT_SRC_DIR
|
||||
@ -71,31 +76,40 @@ set(COMMON_SRCS
|
||||
"../../engine/mem.cpp"
|
||||
)
|
||||
|
||||
include_directories(
|
||||
add_library(demoplayer SHARED)
|
||||
|
||||
target_include_directories(demoplayer PRIVATE
|
||||
${PROJECT_SRC_DIR}
|
||||
${PROJECT_PUBLIC_DIR}
|
||||
)
|
||||
|
||||
add_definitions(
|
||||
-DHLTV
|
||||
-DHLTV_FIXES
|
||||
-D_LINUX
|
||||
-DLINUX
|
||||
-D_GLIBCXX_USE_CXX11_ABI=0
|
||||
-U_FORTIFY_SOURCE
|
||||
-D_stricmp=strcasecmp
|
||||
-D_strnicmp=strncasecmp
|
||||
-D_strdup=strdup
|
||||
-D_vsnprintf=vsnprintf
|
||||
-D_snprintf=snprintf
|
||||
target_compile_definitions(demoplayer PRIVATE
|
||||
HLTV
|
||||
HLTV_FIXES
|
||||
_LINUX
|
||||
LINUX
|
||||
_GLIBCXX_USE_CXX11_ABI=0
|
||||
_stricmp=strcasecmp
|
||||
_strnicmp=strncasecmp
|
||||
_strdup=strdup
|
||||
_vsnprintf=vsnprintf
|
||||
_snprintf=snprintf
|
||||
)
|
||||
|
||||
target_sources(demoplayer PRIVATE
|
||||
${DEMOPLAYER_SRCS}
|
||||
${COMMON_SRCS}
|
||||
)
|
||||
|
||||
target_link_libraries(demoplayer PRIVATE
|
||||
dl
|
||||
m
|
||||
)
|
||||
|
||||
add_library(demoplayer SHARED ${DEMOPLAYER_SRCS} ${COMMON_SRCS})
|
||||
target_link_libraries(demoplayer dl m)
|
||||
set_target_properties(demoplayer PROPERTIES
|
||||
LIBRARY_OUTPUT_NAME demoplayer
|
||||
OUTPUT_NAME demoplayer
|
||||
PREFIX ""
|
||||
COMPILE_FLAGS "-m32"
|
||||
LINK_FLAGS "-m32"
|
||||
COMPILE_FLAGS ${COMPILE_FLAGS}
|
||||
LINK_FLAGS ${LINK_FLAGS}
|
||||
POSITION_INDEPENDENT_CODE OFF
|
||||
)
|
||||
|
@ -5,29 +5,34 @@ option(DEBUG "Build with debug information." OFF)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Avoid -fPIC option
|
||||
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions")
|
||||
set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE")
|
||||
set(LINK_FLAGS "-m32")
|
||||
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions")
|
||||
|
||||
if (DEBUG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector")
|
||||
endif()
|
||||
|
||||
# Check Intel C++ compiler
|
||||
if ($ENV{CXX} MATCHES "icpc")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions")
|
||||
if ("$ENV{CXX}" MATCHES "icpc")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -static-intel -no-intel-extensions")
|
||||
|
||||
if (NOT DEBUG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ipo")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo")
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -ipo")
|
||||
endif()
|
||||
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} \
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} \
|
||||
-mtune=generic -msse3 -flto\
|
||||
-fpermissive -fno-sized-deallocation\
|
||||
-Wno-unused-result -Wno-unknown-pragmas\
|
||||
@ -36,7 +41,7 @@ endif()
|
||||
|
||||
# GCC >= 8.3
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -fcf-protection=none")
|
||||
endif()
|
||||
|
||||
set(PROJECT_SRC_DIR
|
||||
@ -72,36 +77,45 @@ set(COMMON_SRCS
|
||||
"../../engine/mem.cpp"
|
||||
)
|
||||
|
||||
include_directories(
|
||||
add_library(director SHARED)
|
||||
|
||||
target_include_directories(director PRIVATE
|
||||
${PROJECT_SRC_DIR}
|
||||
${PROJECT_PUBLIC_DIR}
|
||||
)
|
||||
|
||||
add_definitions(
|
||||
-DHLTV
|
||||
-DHLTV_FIXES
|
||||
-DDIRECTOR_MODULE
|
||||
-D_LINUX
|
||||
-DLINUX
|
||||
-D_GLIBCXX_USE_CXX11_ABI=0
|
||||
-U_FORTIFY_SOURCE
|
||||
-D_stricmp=strcasecmp
|
||||
-D_strnicmp=strncasecmp
|
||||
-D_strdup=strdup
|
||||
-D_vsnprintf=vsnprintf
|
||||
-D_snprintf=snprintf
|
||||
target_compile_definitions(director PRIVATE
|
||||
HLTV
|
||||
HLTV_FIXES
|
||||
DIRECTOR_MODULE
|
||||
_LINUX
|
||||
LINUX
|
||||
_GLIBCXX_USE_CXX11_ABI=0
|
||||
_stricmp=strcasecmp
|
||||
_strnicmp=strncasecmp
|
||||
_strdup=strdup
|
||||
_vsnprintf=vsnprintf
|
||||
_snprintf=snprintf
|
||||
)
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} \
|
||||
target_sources(director PRIVATE
|
||||
${DIRECTOR_SRCS}
|
||||
${COMMON_SRCS}
|
||||
)
|
||||
|
||||
target_link_libraries(director PRIVATE
|
||||
dl
|
||||
m
|
||||
)
|
||||
|
||||
set(LINK_FLAGS "${LINK_FLAGS} \
|
||||
-Wl,-rpath,'$ORIGIN/.' \
|
||||
-L${PROJECT_SOURCE_DIR}/../../lib/linux32")
|
||||
|
||||
add_library(director SHARED ${DIRECTOR_SRCS} ${COMMON_SRCS})
|
||||
target_link_libraries(director dl m)
|
||||
set_target_properties(director PROPERTIES
|
||||
LIBRARY_OUTPUT_NAME director
|
||||
OUTPUT_NAME director
|
||||
PREFIX ""
|
||||
COMPILE_FLAGS "-m32"
|
||||
LINK_FLAGS "-m32"
|
||||
COMPILE_FLAGS ${COMPILE_FLAGS}
|
||||
LINK_FLAGS ${LINK_FLAGS}
|
||||
POSITION_INDEPENDENT_CODE OFF
|
||||
)
|
||||
|
@ -5,50 +5,55 @@ option(DEBUG "Build with debug information." OFF)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Avoid -fPIC option
|
||||
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions")
|
||||
set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE")
|
||||
set(LINK_FLAGS "-m32")
|
||||
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions")
|
||||
|
||||
if (DEBUG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector")
|
||||
endif()
|
||||
|
||||
# Check Intel C++ compiler
|
||||
if ($ENV{CXX} MATCHES "icpc")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions")
|
||||
if ("$ENV{CXX}" MATCHES "icpc")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -static-intel -no-intel-extensions")
|
||||
|
||||
if (NOT DEBUG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ipo")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo")
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -ipo")
|
||||
endif()
|
||||
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} \
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} \
|
||||
-mtune=generic -msse3 -flto\
|
||||
-fpermissive -fno-sized-deallocation\
|
||||
-Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\
|
||||
-Wno-write-strings -Wno-strict-aliasing")
|
||||
|
||||
# Check Clang compiler
|
||||
if ($ENV{CXX} MATCHES "clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field")
|
||||
if ("$ENV{CXX}" MATCHES "clang")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-unused-private-field")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-plt")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -fno-plt")
|
||||
|
||||
# GCC >= 8.3
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-stringop-truncation -Wno-format-truncation")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# GCC >= 8.3
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -fcf-protection=none")
|
||||
endif()
|
||||
|
||||
set(PROJECT_SRC_DIR
|
||||
@ -102,40 +107,51 @@ set(COMMON_SRCS
|
||||
"../../engine/mem.cpp"
|
||||
)
|
||||
|
||||
include_directories(
|
||||
add_library(proxy SHARED)
|
||||
|
||||
target_include_directories(proxy PRIVATE
|
||||
${PROJECT_SRC_DIR}
|
||||
${PROJECT_BZIP2_DIR}
|
||||
${PROJECT_PUBLIC_DIR}
|
||||
)
|
||||
|
||||
add_definitions(
|
||||
-DHLTV
|
||||
-DHLTV_FIXES
|
||||
-D_LINUX
|
||||
-DLINUX
|
||||
-D_GLIBCXX_USE_CXX11_ABI=0
|
||||
-U_FORTIFY_SOURCE
|
||||
-D_stricmp=strcasecmp
|
||||
-D_strnicmp=strncasecmp
|
||||
-D_strdup=strdup
|
||||
-D_vsnprintf=vsnprintf
|
||||
-D_snprintf=snprintf
|
||||
target_compile_definitions(proxy PRIVATE
|
||||
HLTV
|
||||
HLTV_FIXES
|
||||
_LINUX
|
||||
LINUX
|
||||
_GLIBCXX_USE_CXX11_ABI=0
|
||||
_stricmp=strcasecmp
|
||||
_strnicmp=strncasecmp
|
||||
_strdup=strdup
|
||||
_vsnprintf=vsnprintf
|
||||
_snprintf=snprintf
|
||||
)
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} \
|
||||
-Wl,-rpath,'$ORIGIN/.' \
|
||||
-L${PROJECT_SOURCE_DIR}/../../lib/linux32")
|
||||
target_sources(proxy PRIVATE
|
||||
${PROXY_SRCS}
|
||||
${COMMON_SRCS}
|
||||
)
|
||||
|
||||
target_link_libraries(proxy PRIVATE
|
||||
dl
|
||||
m
|
||||
bzip2
|
||||
steam_api
|
||||
)
|
||||
|
||||
if (NOT TARGET bzip2)
|
||||
add_subdirectory(../../../dep/bzip2 lib)
|
||||
endif()
|
||||
|
||||
add_library(proxy SHARED ${PROXY_SRCS} ${COMMON_SRCS})
|
||||
target_link_libraries(proxy dl m bzip2 steam_api)
|
||||
set(LINK_FLAGS "${LINK_FLAGS} \
|
||||
-Wl,-rpath,'$ORIGIN/.' \
|
||||
-L${PROJECT_SOURCE_DIR}/../../lib/linux32")
|
||||
|
||||
set_target_properties(proxy PROPERTIES
|
||||
LIBRARY_OUTPUT_NAME proxy
|
||||
OUTPUT_NAME proxy
|
||||
PREFIX ""
|
||||
COMPILE_FLAGS "-m32"
|
||||
LINK_FLAGS "-m32"
|
||||
COMPILE_FLAGS ${COMPILE_FLAGS}
|
||||
LINK_FLAGS ${LINK_FLAGS}
|
||||
POSITION_INDEPENDENT_CODE OFF
|
||||
)
|
||||
|
@ -6,45 +6,48 @@ option(DEBUG "Build with debug information." OFF)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
||||
# Avoid -rdynamic -fPIC options
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions")
|
||||
set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE")
|
||||
set(LINK_FLAGS "-m32")
|
||||
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions")
|
||||
|
||||
if (DEBUG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector")
|
||||
endif()
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-no-pie -Wl,--no-export-dynamic")
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -no-pie -Wl,--no-export-dynamic")
|
||||
|
||||
# Check Intel C++ compiler
|
||||
if ($ENV{CXX} MATCHES "icpc")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-intel -no-intel-extensions")
|
||||
if ("$ENV{CXX}" MATCHES "icpc")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -static-intel -no-intel-extensions")
|
||||
|
||||
if (NOT DEBUG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo")
|
||||
set(LINK_FLAGS "${COMPILE_FLAGS} -ipo")
|
||||
endif()
|
||||
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} \
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} \
|
||||
-mtune=generic -msse3\
|
||||
-fpermissive -fno-sized-deallocation\
|
||||
-Wno-unused-result")
|
||||
|
||||
# Check if not Clang compiler AND GCC >= 8.3
|
||||
if (NOT $ENV{CXX} MATCHES "clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation")
|
||||
if (NOT "$ENV{CXX}" MATCHES "clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-stringop-truncation -Wno-format-truncation")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# GCC >= 8.3
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -fcf-protection=none")
|
||||
endif()
|
||||
|
||||
set(PROJECT_SRC_DIR
|
||||
@ -78,36 +81,43 @@ set(COMMON_SRCS
|
||||
"../engine/mem.cpp"
|
||||
)
|
||||
|
||||
include_directories(
|
||||
if (NOT TARGET appversion)
|
||||
add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/../version/appversion.sh" "${PROJECT_SOURCE_DIR}/../..")
|
||||
endif()
|
||||
|
||||
add_executable(hlds ${appversion.sh})
|
||||
add_dependencies(hlds appversion)
|
||||
|
||||
target_include_directories(hlds PRIVATE
|
||||
${PROJECT_SRC_DIR}
|
||||
${PROJECT_PUBLIC_DIR}
|
||||
)
|
||||
|
||||
add_definitions(
|
||||
-DLAUNCHER_FIXES
|
||||
-D_CONSOLE
|
||||
-D_LINUX
|
||||
-DLINUX
|
||||
-D_GLIBCXX_USE_CXX11_ABI=0
|
||||
-U_FORTIFY_SOURCE
|
||||
-D_stricmp=strcasecmp
|
||||
-D_strnicmp=strncasecmp
|
||||
-D_strdup=strdup
|
||||
-D_vsnprintf=vsnprintf
|
||||
target_compile_definitions(hlds PRIVATE
|
||||
LAUNCHER_FIXES
|
||||
_CONSOLE
|
||||
_LINUX
|
||||
LINUX
|
||||
_GLIBCXX_USE_CXX11_ABI=0
|
||||
_stricmp=strcasecmp
|
||||
_strnicmp=strncasecmp
|
||||
_strdup=strdup
|
||||
_vsnprintf=vsnprintf
|
||||
)
|
||||
|
||||
if (NOT TARGET appversion)
|
||||
add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/../../version/appversion.sh" "${PROJECT_SOURCE_DIR}/../..")
|
||||
endif()
|
||||
target_sources(hlds PRIVATE
|
||||
${DEDICATED_SRCS}
|
||||
${COMMON_SRCS}
|
||||
)
|
||||
|
||||
add_executable(hlds ${DEDICATED_SRCS} ${COMMON_SRCS})
|
||||
add_dependencies(hlds appversion)
|
||||
target_link_libraries(hlds PRIVATE
|
||||
dl
|
||||
)
|
||||
|
||||
target_link_libraries(hlds dl)
|
||||
set_target_properties(hlds PROPERTIES
|
||||
OUTPUT_NAME hlds_linux
|
||||
PREFIX ""
|
||||
COMPILE_FLAGS "-m32"
|
||||
LINK_FLAGS "-m32"
|
||||
COMPILE_FLAGS ${COMPILE_FLAGS}
|
||||
LINK_FLAGS ${LINK_FLAGS}
|
||||
POSITION_INDEPENDENT_CODE OFF
|
||||
)
|
||||
|
@ -5,32 +5,37 @@ option(DEBUG "Build with debug information." OFF)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Avoid -fPIC option
|
||||
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions")
|
||||
set(COMPILE_FLAGS "-m32 -U_FORTIFY_SOURCE")
|
||||
set(LINK_FLAGS "-m32")
|
||||
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall -fno-exceptions")
|
||||
|
||||
if (DEBUG)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector")
|
||||
endif()
|
||||
|
||||
# Check Intel C++ compiler
|
||||
if ($ENV{CXX} MATCHES "icpc")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions")
|
||||
if ("$ENV{CXX}" MATCHES "icpc")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -static-intel -no-intel-extensions")
|
||||
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} \
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} \
|
||||
-mtune=generic -msse3\
|
||||
-fpermissive -fno-sized-deallocation\
|
||||
-Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-result -Wno-unused-function\
|
||||
-Wno-write-strings -Wno-sign-compare")
|
||||
|
||||
# Check if not Clang compiler AND GCC >= 8.3
|
||||
if (NOT $ENV{CXX} MATCHES "clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-class-memaccess")
|
||||
if (NOT "$ENV{CXX}" MATCHES "clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-stringop-truncation -Wno-class-memaccess")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -43,12 +48,12 @@ set(WRAP_FUNCS_LIST
|
||||
)
|
||||
|
||||
foreach(f ${WRAP_FUNCS_LIST})
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-wrap,${f}")
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -Wl,-wrap,${f}")
|
||||
endforeach()
|
||||
|
||||
# GCC >= 8.3
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcf-protection=none")
|
||||
set(COMPILE_FLAGS "${COMPILE_FLAGS} -fcf-protection=none")
|
||||
endif()
|
||||
|
||||
set(PROJECT_SRC_DIR
|
||||
@ -71,32 +76,37 @@ set(FILESYSTEM_STDIO_SRCS
|
||||
"src/public_amalgamation.cpp"
|
||||
)
|
||||
|
||||
include_directories(
|
||||
add_library(filesystem_stdio SHARED ${FILESYSTEM_STDIO_SRCS})
|
||||
|
||||
target_include_directories(filesystem_stdio PRIVATE
|
||||
${PROJECT_SRC_DIR}
|
||||
${PROJECT_PUBLIC_DIR}
|
||||
)
|
||||
|
||||
add_definitions(
|
||||
-D_LINUX
|
||||
-DLINUX
|
||||
-D_GLIBCXX_USE_CXX11_ABI=0
|
||||
-U_FORTIFY_SOURCE
|
||||
-D_strdup=strdup
|
||||
-D_stricmp=strcasecmp
|
||||
-D_strnicmp=strncasecmp
|
||||
-D_vsnprintf=vsnprintf
|
||||
-D_snprintf=snprintf
|
||||
-D_unlink=unlink
|
||||
target_compile_definitions(filesystem_stdio PRIVATE
|
||||
_LINUX
|
||||
LINUX
|
||||
_GLIBCXX_USE_CXX11_ABI=0
|
||||
_strdup=strdup
|
||||
_stricmp=strcasecmp
|
||||
_strnicmp=strncasecmp
|
||||
_vsnprintf=vsnprintf
|
||||
_snprintf=snprintf
|
||||
_unlink=unlink
|
||||
)
|
||||
|
||||
add_library(filesystem_stdio SHARED ${FILESYSTEM_STDIO_SRCS})
|
||||
target_sources(filesystem_stdio PRIVATE
|
||||
${FILESYSTEM_STDIO_SRCS}
|
||||
)
|
||||
|
||||
target_link_libraries(filesystem_stdio PRIVATE
|
||||
dl
|
||||
)
|
||||
|
||||
set_target_properties(filesystem_stdio PROPERTIES
|
||||
LIBRARY_OUTPUT_NAME filesystem_stdio
|
||||
OUTPUT_NAME filesystem_stdio
|
||||
PREFIX ""
|
||||
COMPILE_FLAGS "-m32"
|
||||
LINK_FLAGS "-m32"
|
||||
COMPILE_FLAGS ${COMPILE_FLAGS}
|
||||
LINK_FLAGS ${LINK_FLAGS}
|
||||
POSITION_INDEPENDENT_CODE OFF
|
||||
)
|
||||
|
||||
target_link_libraries(filesystem_stdio dl)
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "precompiled.h"
|
||||
#include "rehlds_tests_shared.h"
|
||||
#include "cppunitlite/GradleAdapter.h"
|
||||
#include "cppunitlite/MainAdapter.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
printf("TestRunner: main()\n");
|
||||
|
||||
GradleAdapter a;
|
||||
MainAdapter a;
|
||||
return a.testsEntryPoint(argc, argv);
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ NOINLINE void _GetBitmaskAndBytecount(delta_t* delta, int* bits, int* bytecount,
|
||||
|
||||
NOINLINE delta_t* _CreateTestDeltaDesc() {
|
||||
static delta_description_t _fields[32];
|
||||
delta_test_struct_t d; d; // "use" d variable
|
||||
delta_test_struct_t d = {}; UNUSED(d);
|
||||
|
||||
_InitDeltaField(&_fields[0], 0x00, DT_BYTE, "b_00", offsetof(delta_test_struct_t, b_00), 1, 8, 1.0f, 1.0f);
|
||||
_InitDeltaField(&_fields[1], 0x01, DT_BYTE, "b_01", offsetof(delta_test_struct_t, b_01), 1, 8, 1.0f, 1.0f);
|
||||
|
Loading…
x
Reference in New Issue
Block a user