2
0
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:
s1lentq 2021-04-12 03:39:09 +07:00
parent 7cfea77b93
commit 7bd3d73b79
21 changed files with 527 additions and 326 deletions

View File

@ -34,6 +34,7 @@ jobs:
with: with:
nuget-api-key: ${{ secrets.NuGetAPIKey }} nuget-api-key: ${{ secrets.NuGetAPIKey }}
nuget-version: '5.x' nuget-version: '5.x'
- run: nuget restore '${{ env.solution }}' - run: nuget restore '${{ env.solution }}'
- name: Setup MSBuild - name: Setup MSBuild
@ -41,12 +42,7 @@ jobs:
with: with:
vs-version: '16.8' vs-version: '16.8'
- name: Build ReHLDS - name: Build and Run unittests
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
run: | run: |
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildTest }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false 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" .\"msvc\Test Fixes\swds.exe"
@ -55,6 +51,11 @@ jobs:
{[Environment]::Exit(1)} {[Environment]::Exit(1)}
shell: "pwsh" 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 - name: Move files
run: | run: |
mkdir publish\debug mkdir publish\debug
@ -112,17 +113,17 @@ jobs:
mv $GITHUB_WORKSPACE/tests/swds.dll . mv $GITHUB_WORKSPACE/tests/swds.dll .
descs=( descs=(
"CS: Multiplayer"
"Half-Life: Physics singleplayer" "Half-Life: Physics singleplayer"
"Half-Life: Multiplayer on crossfire map" "Half-Life: Multiplayer on crossfire map"
"Half-Life: Shooting with several weapons" "Half-Life: Shooting with several weapons"
"CS: Multiplayer"
) )
demos=( demos=(
"cstrike-muliplayer-1"
"rehlds-phys-single1" "rehlds-phys-single1"
"crossfire-1-multiplayer-1" "crossfire-1-multiplayer-1"
"shooting-hl-1" "shooting-hl-1"
"cstrike-muliplayer-1"
) )
retVal=0 retVal=0
@ -168,6 +169,30 @@ jobs:
with: with:
fetch-depth: 0 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 - name: Build using Intel C++ Compiler
run: | run: |
rm -rf build && CC=icc CXX=icpc cmake -B build && cmake --build build -j8 rm -rf build && CC=icc CXX=icpc cmake -B build && cmake --build build -j8

1
.gitignore vendored
View File

@ -3,6 +3,7 @@
*.bat *.bat
*.log *.log
*.lnk *.lnk
*.aps
**/msvc/Debug* **/msvc/Debug*
**/msvc/Release* **/msvc/Release*
**/msvc/Tests **/msvc/Tests

View File

@ -10,6 +10,9 @@ add_custom_target(appversion DEPENDS
) )
add_subdirectory(rehlds) add_subdirectory(rehlds)
add_subdirectory(rehlds/dedicated)
add_subdirectory(rehlds/filesystem) if (NOT CMAKE_BUILD_TYPE MATCHES Unittests)
add_subdirectory(rehlds/HLTV) add_subdirectory(rehlds/dedicated)
add_subdirectory(rehlds/filesystem)
add_subdirectory(rehlds/HLTV)
endif()

View 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
)

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
class GradleAdapter { class MainAdapter {
public: public:
int writeAllTestsInfoToFile(const char* fname); int writeAllTestsInfoToFile(const char* fname);
int runTest(const char* groupName, const char* testName); int runTest(const char* groupName, const char* testName);

View File

@ -13,7 +13,7 @@
<ItemGroup> <ItemGroup>
<ClInclude Include="..\include\cppunitlite\Assertions.h" /> <ClInclude Include="..\include\cppunitlite\Assertions.h" />
<ClInclude Include="..\include\cppunitlite\Failure.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\Test.h" />
<ClInclude Include="..\include\cppunitlite\TestHarness.h" /> <ClInclude Include="..\include\cppunitlite\TestHarness.h" />
<ClInclude Include="..\include\cppunitlite\TestRegistry.h" /> <ClInclude Include="..\include\cppunitlite\TestRegistry.h" />
@ -21,7 +21,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\src\Assertions.cpp" /> <ClCompile Include="..\src\Assertions.cpp" />
<ClCompile Include="..\src\GradleAdapter.cpp" /> <ClCompile Include="..\src\MainAdapter.cpp" />
<ClCompile Include="..\src\Test.cpp" /> <ClCompile Include="..\src\Test.cpp" />
<ClCompile Include="..\src\TestRegistry.cpp" /> <ClCompile Include="..\src\TestRegistry.cpp" />
<ClCompile Include="..\src\TestResult.cpp" /> <ClCompile Include="..\src\TestResult.cpp" />

View File

@ -27,7 +27,7 @@
<ClInclude Include="..\include\cppunitlite\TestResult.h"> <ClInclude Include="..\include\cppunitlite\TestResult.h">
<Filter>include</Filter> <Filter>include</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\include\cppunitlite\GradleAdapter.h"> <ClInclude Include="..\include\cppunitlite\MainAdapter.h">
<Filter>include</Filter> <Filter>include</Filter>
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>
@ -44,7 +44,7 @@
<ClCompile Include="..\src\TestResult.cpp"> <ClCompile Include="..\src\TestResult.cpp">
<Filter>src</Filter> <Filter>src</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\src\GradleAdapter.cpp"> <ClCompile Include="..\src\MainAdapter.cpp">
<Filter>src</Filter> <Filter>src</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>

View File

@ -2,11 +2,11 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "cppunitlite/GradleAdapter.h" #include "cppunitlite/MainAdapter.h"
#include "cppunitlite/Test.h" #include "cppunitlite/Test.h"
#include "cppunitlite/TestRegistry.h" #include "cppunitlite/TestRegistry.h"
int GradleAdapter::writeAllTestsInfoToFile(const char* fname) { int MainAdapter::writeAllTestsInfoToFile(const char* fname) {
FILE* outFile = fopen(fname, "w"); FILE* outFile = fopen(fname, "w");
if (outFile == NULL) { if (outFile == NULL) {
return 1; return 1;
@ -33,7 +33,7 @@ int GradleAdapter::writeAllTestsInfoToFile(const char* fname) {
return 0; return 0;
} }
int GradleAdapter::runTest(const char* groupName, const char* testName) { int MainAdapter::runTest(const char* groupName, const char* testName) {
Test* curTest = TestRegistry::getFirstTest(); Test* curTest = TestRegistry::getFirstTest();
while (curTest != NULL) { while (curTest != NULL) {
if (!strcmp(groupName, curTest->getGroup()) && !strcmp(testName, curTest->getName())) { 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(); Test* curTest = TestRegistry::getFirstTest();
int ranTests = 0; int ranTests = 0;
int warnTest = 0; int warnTest = 0;
@ -101,7 +101,7 @@ int GradleAdapter::runGroup(const char* groupName) {
return 0; return 0;
} }
int GradleAdapter::runAllTests() { int MainAdapter::runAllTests() {
Test* curTest = TestRegistry::getFirstTest(); Test* curTest = TestRegistry::getFirstTest();
int ranTests = 0; int ranTests = 0;
int warnTest = 0; int warnTest = 0;
@ -131,7 +131,7 @@ int GradleAdapter::runAllTests() {
return 0; return 0;
} }
int GradleAdapter::testsEntryPoint(int argc, char* argv[]) { int MainAdapter::testsEntryPoint(int argc, char* argv[]) {
if (argc < 2 || !strcmp(argv[1], "-all")) { if (argc < 2 || !strcmp(argv[1], "-all")) {
return runAllTests(); return runAllTests();
} }

View File

@ -5,6 +5,7 @@
#include "cppunitlite/Failure.h" #include "cppunitlite/Failure.h"
#include <exception> #include <exception>
#include <iostream>
#include <sstream> #include <sstream>
@ -30,6 +31,7 @@ void Test::setNext(Test *test)
void Test::run(TestResult &result) { void Test::run(TestResult &result) {
try { try {
runInternal(); runInternal();
std::cout << "Test::run() > " << group_ << "::" << name_ << " Passed" << std::endl;
} catch (TestFailException &e) { } catch (TestFailException &e) {
result.addFailure(Failure(e, name_)); result.addFailure(Failure(e, name_));
} catch (std::exception &e) { } catch (std::exception &e) {

View File

@ -25,39 +25,45 @@ option(USE_STATIC_LIBSTDC "Enables static linking libstdc++." OFF)
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON) 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 # 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) if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
else() else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector")
endif() endif()
# Check Intel C++ compiler # Check Intel C++ compiler
if ($ENV{CXX} MATCHES "icpc") if ("$ENV{CXX}" MATCHES "icpc")
# -fp-model=precise # -fp-model=precise
# ICC uses -fp-model fast=1 by default for more aggressive optimizations on floating-point calculations # 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 # 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\ -fp-model=precise\
-fasm-blocks\ -fasm-blocks\
-Qoption,cpp,--treat_func_as_string_literal_cpp") -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) if (NOT DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ipo") set(LINK_FLAGS "${LINK_FLAGS} -ipo")
endif() endif()
else() else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors. # 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. # 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\ -mtune=generic -msse3\
-fpermissive -fno-sized-deallocation\ -fpermissive -fno-sized-deallocation\
-Wno-unknown-pragmas -Wno-invalid-offsetof\ -Wno-unknown-pragmas -Wno-invalid-offsetof\
@ -66,31 +72,26 @@ else()
-Wno-sign-compare -Wno-strict-aliasing -Wno-ignored-attributes") -Wno-sign-compare -Wno-strict-aliasing -Wno-ignored-attributes")
# Check if not Clang compiler # Check if not Clang compiler
if (NOT $ENV{CXX} MATCHES "clang") if (NOT "$ENV{CXX}" MATCHES "clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-plt -Wno-unused-but-set-variable") set(COMPILE_FLAGS "${COMPILE_FLAGS} -fno-plt -Wno-unused-but-set-variable")
# GCC >= 8.3 # GCC >= 8.3
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) 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() endif()
endif() endif()
# GCC >= 8.3 # GCC >= 8.3
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) 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() endif()
if (NOT DEBUG) 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\"") -Wl,-gc-sections -Wl,--version-script=\"${PROJECT_SOURCE_DIR}/../version_script.lds\"")
endif() 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 set(PROJECT_SRC_DIR
"${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}"
"${PROJECT_SOURCE_DIR}/engine" "${PROJECT_SOURCE_DIR}/engine"
@ -98,12 +99,17 @@ set(PROJECT_SRC_DIR
"${PROJECT_SOURCE_DIR}/pm_shared" "${PROJECT_SOURCE_DIR}/pm_shared"
"${PROJECT_SOURCE_DIR}/rehlds" "${PROJECT_SOURCE_DIR}/rehlds"
"${PROJECT_SOURCE_DIR}/testsuite" "${PROJECT_SOURCE_DIR}/testsuite"
"${PROJECT_SOURCE_DIR}/unittests"
) )
set(PROJECT_BZIP2_DIR set(PROJECT_BZIP2_DIR
"${PROJECT_SOURCE_DIR}/../dep/bzip2/include" "${PROJECT_SOURCE_DIR}/../dep/bzip2/include"
) )
set(PROJECT_CPPUNITLITE_DIR
"${PROJECT_SOURCE_DIR}/../dep/cppunitlite/include"
)
set(PROJECT_PUBLIC_DIR set(PROJECT_PUBLIC_DIR
"${PROJECT_SOURCE_DIR}/public" "${PROJECT_SOURCE_DIR}/public"
"${PROJECT_SOURCE_DIR}/public/rehlds" "${PROJECT_SOURCE_DIR}/public/rehlds"
@ -179,6 +185,21 @@ set(ENGINE_SRCS
rehlds/rehlds_security.cpp 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 set(COMMON_SRCS
"common/BaseSystemModule.cpp" "common/BaseSystemModule.cpp"
"common/ObjectList.cpp" "common/ObjectList.cpp"
@ -192,56 +213,91 @@ set(PUBLIC_SRCS
"public/utlbuffer.cpp" "public/utlbuffer.cpp"
) )
include_directories( if (CMAKE_BUILD_TYPE MATCHES Unittests)
${PROJECT_SRC_DIR} if (NOT TARGET cppunitlite)
${PROJECT_BZIP2_DIR} add_subdirectory(../dep/cppunitlite cppunitlite)
${PROJECT_PUBLIC_DIR} endif()
)
add_definitions( set(LINK_FLAGS "${LINK_FLAGS} -no-pie -Wl,--no-export-dynamic")
-DSWDS add_executable(engine ${appversion.sh})
-DREHLDS_JIT target_link_libraries(engine PRIVATE cppunitlite)
-DREHLDS_SSE else()
-DREHLDS_FIXES add_library(engine SHARED ${appversion.sh})
-DREHLDS_CHECKS endif()
-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")
if (NOT TARGET bzip2) if (NOT TARGET bzip2)
add_subdirectory(../dep/bzip2 lib) add_subdirectory(../dep/bzip2 bzip2)
endif() endif()
if (NOT TARGET appversion) if (NOT TARGET appversion)
add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/version/appversion.sh" "${PROJECT_SOURCE_DIR}/..") add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/version/appversion.sh" "${PROJECT_SOURCE_DIR}/..")
endif() endif()
add_library(engine SHARED ${appversion.sh} ${ENGINE_SRCS} ${COMMON_SRCS} ${PUBLIC_SRCS})
add_dependencies(engine appversion) add_dependencies(engine appversion)
set_target_properties(engine PROPERTIES target_include_directories(engine PRIVATE
LIBRARY_OUTPUT_NAME engine_i486 ${PROJECT_SRC_DIR}
PREFIX "" ${PROJECT_BZIP2_DIR}
COMPILE_FLAGS "-m32" ${PROJECT_CPPUNITLITE_DIR}
LINK_FLAGS "-m32" ${PROJECT_PUBLIC_DIR}
POSITION_INDEPENDENT_CODE OFF
) )
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
)

View File

@ -6,45 +6,48 @@ option(DEBUG "Build with debug information." OFF)
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON) 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_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) if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
else() else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector")
endif() 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 # Check Intel C++ compiler
if ($ENV{CXX} MATCHES "icpc") if ("$ENV{CXX}" MATCHES "icpc")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") set(COMPILE_FLAGS "${COMPILE_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-intel -no-intel-extensions") set(LINK_FLAGS "${LINK_FLAGS} -static-intel -no-intel-extensions")
if (NOT DEBUG) if (NOT DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo") set(LINK_FLAGS "${COMPILE_FLAGS} -ipo")
endif() endif()
else() else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors. # 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. # 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\ -mtune=generic -msse3 -flto\
-fpermissive -fno-sized-deallocation\ -fpermissive -fno-sized-deallocation\
-Wno-unused-result -Wno-unknown-pragmas -Wno-write-strings") -Wno-unused-result -Wno-unknown-pragmas -Wno-write-strings")
# Check if not Clang compiler AND GCC >= 8.3 # 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) 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") set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-stringop-truncation -Wno-format-truncation")
endif() endif()
endif() endif()
# GCC >= 8.3 # GCC >= 8.3
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) 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() endif()
set(PROJECT_SRC_DIR set(PROJECT_SRC_DIR
@ -77,37 +80,44 @@ set(COMMON_SRCS
"../../engine/mem.cpp" "../../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) if (NOT TARGET appversion)
add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/../../version/appversion.sh" "${PROJECT_SOURCE_DIR}/../../..") add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/../../version/appversion.sh" "${PROJECT_SOURCE_DIR}/../../..")
endif() endif()
add_executable(hltv ${appversion.sh} ${HLTV_SRCS} ${COMMON_SRCS}) add_executable(hltv ${appversion.sh})
add_dependencies(hltv appversion) 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 set_target_properties(hltv PROPERTIES
LIBRARY_OUTPUT_NAME hltv OUTPUT_NAME hltv
PREFIX "" PREFIX ""
COMPILE_FLAGS "-m32" COMPILE_FLAGS ${COMPILE_FLAGS}
LINK_FLAGS "-m32" LINK_FLAGS ${LINK_FLAGS}
POSITION_INDEPENDENT_CODE OFF POSITION_INDEPENDENT_CODE OFF
) )

View File

@ -5,47 +5,52 @@ option(DEBUG "Build with debug information." OFF)
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Avoid -fPIC option
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") 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) if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
else() else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector")
endif() endif()
# Check Intel C++ compiler # Check Intel C++ compiler
if ($ENV{CXX} MATCHES "icpc") if ("$ENV{CXX}" MATCHES "icpc")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") set(COMPILE_FLAGS "${COMPILE_FLAGS} -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) if (NOT DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ipo") set(LINK_FLAGS "${LINK_FLAGS} -ipo")
endif() endif()
else() else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors. # 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. # 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\ -fpermissive -fno-sized-deallocation\
-Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\ -Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\
-Wno-sign-compare -Wno-write-strings -Wno-strict-aliasing") -Wno-sign-compare -Wno-write-strings -Wno-strict-aliasing")
# Check Clang compiler # Check Clang compiler
if ($ENV{CXX} MATCHES "clang") if ("$ENV{CXX}" MATCHES "clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field") set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-unused-private-field")
else() else()
# GCC >= 8.3 # GCC >= 8.3
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) 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() endif()
endif() endif()
# GCC >= 8.3 # GCC >= 8.3
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) 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() endif()
set(PROJECT_SRC_DIR set(PROJECT_SRC_DIR
@ -96,36 +101,46 @@ set(COMMON_SRCS
"../../engine/mem.cpp" "../../engine/mem.cpp"
) )
include_directories( add_library(core SHARED)
target_include_directories(core PRIVATE
${PROJECT_SRC_DIR} ${PROJECT_SRC_DIR}
${PROJECT_BZIP2_DIR} ${PROJECT_BZIP2_DIR}
${PROJECT_PUBLIC_DIR} ${PROJECT_PUBLIC_DIR}
) )
add_definitions( target_compile_definitions(core PRIVATE
-DHLTV HLTV
-DHLTV_FIXES HLTV_FIXES
-D_LINUX _LINUX
-DLINUX LINUX
-D_GLIBCXX_USE_CXX11_ABI=0 _GLIBCXX_USE_CXX11_ABI=0
-U_FORTIFY_SOURCE _stricmp=strcasecmp
-D_stricmp=strcasecmp _strnicmp=strncasecmp
-D_strnicmp=strncasecmp _strdup=strdup
-D_strdup=strdup _vsnprintf=vsnprintf
-D_vsnprintf=vsnprintf _snprintf=snprintf
-D_snprintf=snprintf )
target_sources(core PRIVATE
${CORE_SRCS}
${COMMON_SRCS}
)
target_link_libraries(core PRIVATE
dl
m
bzip2
) )
if (NOT TARGET bzip2) if (NOT TARGET bzip2)
add_subdirectory(../../../dep/bzip2 lib) add_subdirectory(../../../dep/bzip2 lib)
endif() endif()
add_library(core SHARED ${CORE_SRCS} ${COMMON_SRCS})
target_link_libraries(core dl m bzip2)
set_target_properties(core PROPERTIES set_target_properties(core PROPERTIES
LIBRARY_OUTPUT_NAME core OUTPUT_NAME core
PREFIX "" PREFIX ""
COMPILE_FLAGS "-m32" COMPILE_FLAGS ${COMPILE_FLAGS}
LINK_FLAGS "-m32" LINK_FLAGS ${LINK_FLAGS}
POSITION_INDEPENDENT_CODE OFF POSITION_INDEPENDENT_CODE OFF
) )

View File

@ -5,29 +5,34 @@ option(DEBUG "Build with debug information." OFF)
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Avoid -fPIC option
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") 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) if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
else() else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector")
endif() endif()
# Check Intel C++ compiler # Check Intel C++ compiler
if ($ENV{CXX} MATCHES "icpc") if ("$ENV{CXX}" MATCHES "icpc")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") set(COMPILE_FLAGS "${COMPILE_FLAGS} -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) if (NOT DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ipo") set(LINK_FLAGS "${LINK_FLAGS} -ipo")
endif() endif()
else() else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors. # 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. # 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\ -mtune=generic -msse3 -flto\
-fpermissive -fno-sized-deallocation\ -fpermissive -fno-sized-deallocation\
-Wno-unused-result -Wno-unknown-pragmas\ -Wno-unused-result -Wno-unknown-pragmas\
@ -36,7 +41,7 @@ endif()
# GCC >= 8.3 # GCC >= 8.3
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) 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() endif()
set(PROJECT_SRC_DIR set(PROJECT_SRC_DIR
@ -71,31 +76,40 @@ set(COMMON_SRCS
"../../engine/mem.cpp" "../../engine/mem.cpp"
) )
include_directories( add_library(demoplayer SHARED)
target_include_directories(demoplayer PRIVATE
${PROJECT_SRC_DIR} ${PROJECT_SRC_DIR}
${PROJECT_PUBLIC_DIR} ${PROJECT_PUBLIC_DIR}
) )
add_definitions( target_compile_definitions(demoplayer PRIVATE
-DHLTV HLTV
-DHLTV_FIXES HLTV_FIXES
-D_LINUX _LINUX
-DLINUX LINUX
-D_GLIBCXX_USE_CXX11_ABI=0 _GLIBCXX_USE_CXX11_ABI=0
-U_FORTIFY_SOURCE _stricmp=strcasecmp
-D_stricmp=strcasecmp _strnicmp=strncasecmp
-D_strnicmp=strncasecmp _strdup=strdup
-D_strdup=strdup _vsnprintf=vsnprintf
-D_vsnprintf=vsnprintf _snprintf=snprintf
-D_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 set_target_properties(demoplayer PROPERTIES
LIBRARY_OUTPUT_NAME demoplayer OUTPUT_NAME demoplayer
PREFIX "" PREFIX ""
COMPILE_FLAGS "-m32" COMPILE_FLAGS ${COMPILE_FLAGS}
LINK_FLAGS "-m32" LINK_FLAGS ${LINK_FLAGS}
POSITION_INDEPENDENT_CODE OFF POSITION_INDEPENDENT_CODE OFF
) )

View File

@ -5,29 +5,34 @@ option(DEBUG "Build with debug information." OFF)
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Avoid -fPIC option
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") 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) if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
else() else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector")
endif() endif()
# Check Intel C++ compiler # Check Intel C++ compiler
if ($ENV{CXX} MATCHES "icpc") if ("$ENV{CXX}" MATCHES "icpc")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") set(COMPILE_FLAGS "${COMPILE_FLAGS} -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) if (NOT DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ipo") set(LINK_FLAGS "${LINK_FLAGS} -ipo")
endif() endif()
else() else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors. # 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. # 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\ -mtune=generic -msse3 -flto\
-fpermissive -fno-sized-deallocation\ -fpermissive -fno-sized-deallocation\
-Wno-unused-result -Wno-unknown-pragmas\ -Wno-unused-result -Wno-unknown-pragmas\
@ -36,7 +41,7 @@ endif()
# GCC >= 8.3 # GCC >= 8.3
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) 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() endif()
set(PROJECT_SRC_DIR set(PROJECT_SRC_DIR
@ -72,36 +77,45 @@ set(COMMON_SRCS
"../../engine/mem.cpp" "../../engine/mem.cpp"
) )
include_directories( add_library(director SHARED)
target_include_directories(director PRIVATE
${PROJECT_SRC_DIR} ${PROJECT_SRC_DIR}
${PROJECT_PUBLIC_DIR} ${PROJECT_PUBLIC_DIR}
) )
add_definitions( target_compile_definitions(director PRIVATE
-DHLTV HLTV
-DHLTV_FIXES HLTV_FIXES
-DDIRECTOR_MODULE DIRECTOR_MODULE
-D_LINUX _LINUX
-DLINUX LINUX
-D_GLIBCXX_USE_CXX11_ABI=0 _GLIBCXX_USE_CXX11_ABI=0
-U_FORTIFY_SOURCE _stricmp=strcasecmp
-D_stricmp=strcasecmp _strnicmp=strncasecmp
-D_strnicmp=strncasecmp _strdup=strdup
-D_strdup=strdup _vsnprintf=vsnprintf
-D_vsnprintf=vsnprintf _snprintf=snprintf
-D_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/.' \ -Wl,-rpath,'$ORIGIN/.' \
-L${PROJECT_SOURCE_DIR}/../../lib/linux32") -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 set_target_properties(director PROPERTIES
LIBRARY_OUTPUT_NAME director OUTPUT_NAME director
PREFIX "" PREFIX ""
COMPILE_FLAGS "-m32" COMPILE_FLAGS ${COMPILE_FLAGS}
LINK_FLAGS "-m32" LINK_FLAGS ${LINK_FLAGS}
POSITION_INDEPENDENT_CODE OFF POSITION_INDEPENDENT_CODE OFF
) )

View File

@ -5,50 +5,55 @@ option(DEBUG "Build with debug information." OFF)
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Avoid -fPIC option
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") 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) if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
else() else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector")
endif() endif()
# Check Intel C++ compiler # Check Intel C++ compiler
if ($ENV{CXX} MATCHES "icpc") if ("$ENV{CXX}" MATCHES "icpc")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") set(COMPILE_FLAGS "${COMPILE_FLAGS} -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) if (NOT DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ipo") set(LINK_FLAGS "${LINK_FLAGS} -ipo")
endif() endif()
else() else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors. # 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. # 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\ -mtune=generic -msse3 -flto\
-fpermissive -fno-sized-deallocation\ -fpermissive -fno-sized-deallocation\
-Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\ -Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\
-Wno-write-strings -Wno-strict-aliasing") -Wno-write-strings -Wno-strict-aliasing")
# Check Clang compiler # Check Clang compiler
if ($ENV{CXX} MATCHES "clang") if ("$ENV{CXX}" MATCHES "clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field") set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-unused-private-field")
else() else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-plt") set(COMPILE_FLAGS "${COMPILE_FLAGS} -fno-plt")
# GCC >= 8.3 # GCC >= 8.3
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) 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() endif()
endif() endif()
# GCC >= 8.3 # GCC >= 8.3
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) 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() endif()
set(PROJECT_SRC_DIR set(PROJECT_SRC_DIR
@ -102,40 +107,51 @@ set(COMMON_SRCS
"../../engine/mem.cpp" "../../engine/mem.cpp"
) )
include_directories( add_library(proxy SHARED)
target_include_directories(proxy PRIVATE
${PROJECT_SRC_DIR} ${PROJECT_SRC_DIR}
${PROJECT_BZIP2_DIR} ${PROJECT_BZIP2_DIR}
${PROJECT_PUBLIC_DIR} ${PROJECT_PUBLIC_DIR}
) )
add_definitions( target_compile_definitions(proxy PRIVATE
-DHLTV HLTV
-DHLTV_FIXES HLTV_FIXES
-D_LINUX _LINUX
-DLINUX LINUX
-D_GLIBCXX_USE_CXX11_ABI=0 _GLIBCXX_USE_CXX11_ABI=0
-U_FORTIFY_SOURCE _stricmp=strcasecmp
-D_stricmp=strcasecmp _strnicmp=strncasecmp
-D_strnicmp=strncasecmp _strdup=strdup
-D_strdup=strdup _vsnprintf=vsnprintf
-D_vsnprintf=vsnprintf _snprintf=snprintf
-D_snprintf=snprintf
) )
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} \ target_sources(proxy PRIVATE
-Wl,-rpath,'$ORIGIN/.' \ ${PROXY_SRCS}
-L${PROJECT_SOURCE_DIR}/../../lib/linux32") ${COMMON_SRCS}
)
target_link_libraries(proxy PRIVATE
dl
m
bzip2
steam_api
)
if (NOT TARGET bzip2) if (NOT TARGET bzip2)
add_subdirectory(../../../dep/bzip2 lib) add_subdirectory(../../../dep/bzip2 lib)
endif() endif()
add_library(proxy SHARED ${PROXY_SRCS} ${COMMON_SRCS}) set(LINK_FLAGS "${LINK_FLAGS} \
target_link_libraries(proxy dl m bzip2 steam_api) -Wl,-rpath,'$ORIGIN/.' \
-L${PROJECT_SOURCE_DIR}/../../lib/linux32")
set_target_properties(proxy PROPERTIES set_target_properties(proxy PROPERTIES
LIBRARY_OUTPUT_NAME proxy OUTPUT_NAME proxy
PREFIX "" PREFIX ""
COMPILE_FLAGS "-m32" COMPILE_FLAGS ${COMPILE_FLAGS}
LINK_FLAGS "-m32" LINK_FLAGS ${LINK_FLAGS}
POSITION_INDEPENDENT_CODE OFF POSITION_INDEPENDENT_CODE OFF
) )

View File

@ -6,45 +6,48 @@ option(DEBUG "Build with debug information." OFF)
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON) 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_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) if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
else() else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector")
endif() 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 # Check Intel C++ compiler
if ($ENV{CXX} MATCHES "icpc") if ("$ENV{CXX}" MATCHES "icpc")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") set(COMPILE_FLAGS "${COMPILE_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-intel -no-intel-extensions") set(LINK_FLAGS "${LINK_FLAGS} -static-intel -no-intel-extensions")
if (NOT DEBUG) if (NOT DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo") set(COMPILE_FLAGS "${COMPILE_FLAGS} -ipo")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo") set(LINK_FLAGS "${COMPILE_FLAGS} -ipo")
endif() endif()
else() else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors. # 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. # 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\ -mtune=generic -msse3\
-fpermissive -fno-sized-deallocation\ -fpermissive -fno-sized-deallocation\
-Wno-unused-result") -Wno-unused-result")
# Check if not Clang compiler AND GCC >= 8.3 # 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) 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") set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-stringop-truncation -Wno-format-truncation")
endif() endif()
endif() endif()
# GCC >= 8.3 # GCC >= 8.3
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) 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() endif()
set(PROJECT_SRC_DIR set(PROJECT_SRC_DIR
@ -78,36 +81,43 @@ set(COMMON_SRCS
"../engine/mem.cpp" "../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_SRC_DIR}
${PROJECT_PUBLIC_DIR} ${PROJECT_PUBLIC_DIR}
) )
add_definitions( target_compile_definitions(hlds PRIVATE
-DLAUNCHER_FIXES LAUNCHER_FIXES
-D_CONSOLE _CONSOLE
-D_LINUX _LINUX
-DLINUX LINUX
-D_GLIBCXX_USE_CXX11_ABI=0 _GLIBCXX_USE_CXX11_ABI=0
-U_FORTIFY_SOURCE _stricmp=strcasecmp
-D_stricmp=strcasecmp _strnicmp=strncasecmp
-D_strnicmp=strncasecmp _strdup=strdup
-D_strdup=strdup _vsnprintf=vsnprintf
-D_vsnprintf=vsnprintf
) )
if (NOT TARGET appversion) target_sources(hlds PRIVATE
add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/../../version/appversion.sh" "${PROJECT_SOURCE_DIR}/../..") ${DEDICATED_SRCS}
endif() ${COMMON_SRCS}
)
add_executable(hlds ${DEDICATED_SRCS} ${COMMON_SRCS}) target_link_libraries(hlds PRIVATE
add_dependencies(hlds appversion) dl
)
target_link_libraries(hlds dl)
set_target_properties(hlds PROPERTIES set_target_properties(hlds PROPERTIES
OUTPUT_NAME hlds_linux OUTPUT_NAME hlds_linux
PREFIX "" PREFIX ""
COMPILE_FLAGS "-m32" COMPILE_FLAGS ${COMPILE_FLAGS}
LINK_FLAGS "-m32" LINK_FLAGS ${LINK_FLAGS}
POSITION_INDEPENDENT_CODE OFF POSITION_INDEPENDENT_CODE OFF
) )

View File

@ -5,32 +5,37 @@ option(DEBUG "Build with debug information." OFF)
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Avoid -fPIC option
set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") 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) if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb") set(COMPILE_FLAGS "${COMPILE_FLAGS} -g3 -O3 -ggdb")
else() else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3 -fno-stack-protector") set(COMPILE_FLAGS "${COMPILE_FLAGS} -g0 -O3 -fno-stack-protector")
endif() endif()
# Check Intel C++ compiler # Check Intel C++ compiler
if ($ENV{CXX} MATCHES "icpc") if ("$ENV{CXX}" MATCHES "icpc")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp") set(COMPILE_FLAGS "${COMPILE_FLAGS} -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")
else() else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors. # 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. # 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\ -mtune=generic -msse3\
-fpermissive -fno-sized-deallocation\ -fpermissive -fno-sized-deallocation\
-Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-result -Wno-unused-function\ -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-result -Wno-unused-function\
-Wno-write-strings -Wno-sign-compare") -Wno-write-strings -Wno-sign-compare")
# Check if not Clang compiler AND GCC >= 8.3 # 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) 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") set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-stringop-truncation -Wno-class-memaccess")
endif() endif()
endif() endif()
@ -43,12 +48,12 @@ set(WRAP_FUNCS_LIST
) )
foreach(f ${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() endforeach()
# GCC >= 8.3 # GCC >= 8.3
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0) 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() endif()
set(PROJECT_SRC_DIR set(PROJECT_SRC_DIR
@ -71,32 +76,37 @@ set(FILESYSTEM_STDIO_SRCS
"src/public_amalgamation.cpp" "src/public_amalgamation.cpp"
) )
include_directories( add_library(filesystem_stdio SHARED ${FILESYSTEM_STDIO_SRCS})
target_include_directories(filesystem_stdio PRIVATE
${PROJECT_SRC_DIR} ${PROJECT_SRC_DIR}
${PROJECT_PUBLIC_DIR} ${PROJECT_PUBLIC_DIR}
) )
add_definitions( target_compile_definitions(filesystem_stdio PRIVATE
-D_LINUX _LINUX
-DLINUX LINUX
-D_GLIBCXX_USE_CXX11_ABI=0 _GLIBCXX_USE_CXX11_ABI=0
-U_FORTIFY_SOURCE _strdup=strdup
-D_strdup=strdup _stricmp=strcasecmp
-D_stricmp=strcasecmp _strnicmp=strncasecmp
-D_strnicmp=strncasecmp _vsnprintf=vsnprintf
-D_vsnprintf=vsnprintf _snprintf=snprintf
-D_snprintf=snprintf _unlink=unlink
-D_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 set_target_properties(filesystem_stdio PROPERTIES
LIBRARY_OUTPUT_NAME filesystem_stdio OUTPUT_NAME filesystem_stdio
PREFIX "" PREFIX ""
COMPILE_FLAGS "-m32" COMPILE_FLAGS ${COMPILE_FLAGS}
LINK_FLAGS "-m32" LINK_FLAGS ${LINK_FLAGS}
POSITION_INDEPENDENT_CODE OFF POSITION_INDEPENDENT_CODE OFF
) )
target_link_libraries(filesystem_stdio dl)

View File

@ -1,10 +1,10 @@
#include "precompiled.h" #include "precompiled.h"
#include "rehlds_tests_shared.h" #include "rehlds_tests_shared.h"
#include "cppunitlite/GradleAdapter.h" #include "cppunitlite/MainAdapter.h"
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
printf("TestRunner: main()\n"); printf("TestRunner: main()\n");
GradleAdapter a; MainAdapter a;
return a.testsEntryPoint(argc, argv); return a.testsEntryPoint(argc, argv);
} }

View File

@ -177,7 +177,7 @@ NOINLINE void _GetBitmaskAndBytecount(delta_t* delta, int* bits, int* bytecount,
NOINLINE delta_t* _CreateTestDeltaDesc() { NOINLINE delta_t* _CreateTestDeltaDesc() {
static delta_description_t _fields[32]; 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[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); _InitDeltaField(&_fields[1], 0x01, DT_BYTE, "b_01", offsetof(delta_test_struct_t, b_01), 1, 8, 1.0f, 1.0f);