Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #206 from PazerOP/msix_package
Browse files Browse the repository at this point in the history
  • Loading branch information
PazerOP authored Sep 9, 2020
2 parents 987a1ef + a0e825e commit 54c623d
Show file tree
Hide file tree
Showing 88 changed files with 3,883 additions and 1,104 deletions.
384 changes: 346 additions & 38 deletions .github/workflows/ccpp.yml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -346,3 +346,4 @@ staging/cfg/settings.json
out/
staging/debug_report.zip
staging/cfg/playerlist.json
staging/cfg/.non_portable
285 changes: 13 additions & 272 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,282 +1,23 @@
cmake_minimum_required(VERSION 3.17.2)
project(tf2_bot_detector VERSION 1.1.0.10)
cmake_minimum_required(VERSION 3.17)

include(GenerateExportHeader)

message("TF2BD CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")

option(TF2BD_IS_CI_COMPILE "Set to true if this is a compile on a CI service. Used to help determine if user has made modifications to the source code." off)
if (TF2BD_IS_CI_COMPILE)
add_compile_definitions(TF2BD_IS_CI_COMPILE=1)
else()
add_compile_definitions(TF2BD_IS_CI_COMPILE=0)
endif()
option(TF2BD_ENABLE_DISCORD_INTEGRATION "Enable discord integration" on)
option(TF2BD_ENABLE_TESTS "Enable test compilation" off)

# Generate PDBs for release builds - RelWithDebInfo is NOT a Release build!
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG")
endif()
include(cmake/init-preproject.cmake)
project(tf2_bot_detector)
include(cmake/init-postproject.cmake)

set_property(GLOBAL PROPERTY INTERPROCEDURAL_OPTIMIZATION_RELEASE true)
if (MSVC AND (CMAKE_BUILD_TYPE MATCHES "Release"))
add_link_options(/OPT:REF /OPT:ICF)
endif()
set_warning_level(1)
set(ENABLE_EXAMPLES off CACHE BOOL "Build examples" FORCE)
add_subdirectory("submodules/cppcoro")

set_warning_level(3)
add_subdirectory(submodules/ValveFileVDF)
add_subdirectory(submodules/SourceRCON)
add_subdirectory(submodules/imgui_desktop)
add_subdirectory(submodules/mh_stuff)

set(ENABLE_EXAMPLES off CACHE BOOL "Build examples" FORCE)
add_subdirectory("submodules/cppcoro")

if (WIN32)
add_library(tf2_bot_detector SHARED)
set_target_properties(tf2_bot_detector PROPERTIES PDB_NAME "tf2_bot_detector_dll")

generate_export_header(tf2_bot_detector
EXPORT_FILE_NAME "tf2_bot_detector/tf2_bot_detector_export.h"
)

add_executable(tf2_bot_detector_launcher WIN32
"tf2_bot_detector/Platform/Windows/CrashHandler.cpp"
"tf2_bot_detector/Launcher/main.cpp"
"tf2_bot_detector/Launcher/Resources.rc"
)
target_compile_definitions(tf2_bot_detector_launcher PRIVATE TF2BD_LAUNCHER_USE_WINMAIN)

target_include_directories(tf2_bot_detector_launcher PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/tf2_bot_detector)
target_link_libraries(tf2_bot_detector_launcher PRIVATE tf2_bot_detector)
set_target_properties(tf2_bot_detector_launcher PROPERTIES OUTPUT_NAME "tf2_bot_detector")
set_property(TARGET tf2_bot_detector_launcher PROPERTY CXX_STANDARD 17)
else()
add_executable(tf2_bot_detector
"tf2_bot_detector/Launcher/main.cpp"
)
endif()

target_sources(tf2_bot_detector PRIVATE
"tf2_bot_detector/Actions/RCONActionManager.cpp"
"tf2_bot_detector/Actions/RCONActionManager.h"
"tf2_bot_detector/Actions/ActionGenerators.cpp"
"tf2_bot_detector/Actions/ActionGenerators.h"
"tf2_bot_detector/Actions/Actions.cpp"
"tf2_bot_detector/Actions/Actions.h"
"tf2_bot_detector/Actions/HijackActionManager.h"
"tf2_bot_detector/Actions/HijackActionManager.cpp"
"tf2_bot_detector/Actions/IActionManager.h"
"tf2_bot_detector/Actions/ICommandSource.h"
"tf2_bot_detector/Config/ConfigHelpers.cpp"
"tf2_bot_detector/Config/ConfigHelpers.h"
"tf2_bot_detector/Config/DRPInfo.cpp"
"tf2_bot_detector/Config/DRPInfo.h"
"tf2_bot_detector/Config/PlayerListJSON.cpp"
"tf2_bot_detector/Config/PlayerListJSON.h"
"tf2_bot_detector/Config/Rules.cpp"
"tf2_bot_detector/Config/Rules.h"
"tf2_bot_detector/Config/Settings.cpp"
"tf2_bot_detector/Config/Settings.h"
"tf2_bot_detector/Config/SponsorsList.h"
"tf2_bot_detector/Config/SponsorsList.cpp"
"tf2_bot_detector/ConsoleLog/ConsoleLogParser.h"
"tf2_bot_detector/ConsoleLog/ConsoleLogParser.cpp"
"tf2_bot_detector/ConsoleLog/ConsoleLines.cpp"
"tf2_bot_detector/ConsoleLog/ConsoleLines.h"
"tf2_bot_detector/ConsoleLog/IConsoleLine.h"
"tf2_bot_detector/ConsoleLog/ConsoleLineListener.cpp"
"tf2_bot_detector/ConsoleLog/ConsoleLineListener.h"
"tf2_bot_detector/ConsoleLog/NetworkStatus.cpp"
"tf2_bot_detector/ConsoleLog/NetworkStatus.h"
"tf2_bot_detector/GameData/MatchmakingQueue.h"
"tf2_bot_detector/GameData/TFClassType.h"
"tf2_bot_detector/GameData/TFParty.h"
"tf2_bot_detector/GameData/UserMessageType.h"
"tf2_bot_detector/Networking/GithubAPI.h"
"tf2_bot_detector/Networking/GithubAPI.cpp"
"tf2_bot_detector/Networking/HTTPClient.h"
"tf2_bot_detector/Networking/HTTPClient.cpp"
"tf2_bot_detector/Networking/HTTPHelpers.h"
"tf2_bot_detector/Networking/HTTPHelpers.cpp"
"tf2_bot_detector/Networking/NetworkHelpers.h"
"tf2_bot_detector/Networking/NetworkHelpers.cpp"
"tf2_bot_detector/Networking/SteamAPI.h"
"tf2_bot_detector/Networking/SteamAPI.cpp"
"tf2_bot_detector/Platform/Platform.h"
"tf2_bot_detector/SetupFlow/BasicSettingsPage.h"
"tf2_bot_detector/SetupFlow/BasicSettingsPage.cpp"
"tf2_bot_detector/SetupFlow/ChatWrappersGeneratorPage.h"
"tf2_bot_detector/SetupFlow/ChatWrappersGeneratorPage.cpp"
"tf2_bot_detector/SetupFlow/ChatWrappersVerifyPage.h"
"tf2_bot_detector/SetupFlow/ChatWrappersVerifyPage.cpp"
"tf2_bot_detector/SetupFlow/ISetupFlowPage.h"
"tf2_bot_detector/SetupFlow/NetworkSettingsPage.h"
"tf2_bot_detector/SetupFlow/NetworkSettingsPage.cpp"
"tf2_bot_detector/SetupFlow/SetupFlow.cpp"
"tf2_bot_detector/SetupFlow/SetupFlow.h"
"tf2_bot_detector/SetupFlow/TF2CommandLinePage.h"
"tf2_bot_detector/SetupFlow/TF2CommandLinePage.cpp"
"tf2_bot_detector/UI/ImGui_TF2BotDetector.cpp"
"tf2_bot_detector/UI/ImGui_TF2BotDetector.h"
"tf2_bot_detector/UI/MainWindow.cpp"
"tf2_bot_detector/UI/MainWindow.Scoreboard.cpp"
"tf2_bot_detector/UI/MainWindow.h"
"tf2_bot_detector/Util/JSONUtils.h"
"tf2_bot_detector/Util/PathUtils.cpp"
"tf2_bot_detector/Util/PathUtils.h"
"tf2_bot_detector/Util/TextUtils.cpp"
"tf2_bot_detector/Util/TextUtils.h"
"tf2_bot_detector/BaseTextures.h"
"tf2_bot_detector/BaseTextures.cpp"
"tf2_bot_detector/BatchedAction.h"
"tf2_bot_detector/Bitmap.h"
"tf2_bot_detector/Bitmap.cpp"
"tf2_bot_detector/Clock.cpp"
"tf2_bot_detector/Clock.h"
"tf2_bot_detector/CompensatedTS.cpp"
"tf2_bot_detector/CompensatedTS.h"
"tf2_bot_detector/Config/ChatWrappers.cpp"
"tf2_bot_detector/Config/ChatWrappers.h"
"tf2_bot_detector/DLLMain.cpp"
"tf2_bot_detector/DLLMain.h"
"tf2_bot_detector/IPlayer.cpp"
"tf2_bot_detector/IPlayer.h"
"tf2_bot_detector/Log.cpp"
"tf2_bot_detector/Log.h"
"tf2_bot_detector/ModeratorLogic.cpp"
"tf2_bot_detector/ModeratorLogic.h"
"tf2_bot_detector/PlayerStatus.h"
"tf2_bot_detector/SteamID.cpp"
"tf2_bot_detector/SteamID.h"
"tf2_bot_detector/TextureManager.h"
"tf2_bot_detector/TextureManager.cpp"
"tf2_bot_detector/TFConstants.h"
"tf2_bot_detector/Version.h"
"tf2_bot_detector/WorldEventListener.cpp"
"tf2_bot_detector/WorldEventListener.h"
"tf2_bot_detector/WorldState.cpp"
"tf2_bot_detector/WorldState.h"
)

configure_file(tf2_bot_detector/Version.base.h tf2_bot_detector/Version.h)
target_include_directories(tf2_bot_detector PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/tf2_bot_detector)

if(WIN32)
if ((CMAKE_BUILD_TYPE MATCHES "Release"))
set(TF2BD_RESOURCE_FILEFLAGS "0")
else()
set(TF2BD_RESOURCE_FILEFLAGS "VS_FF_DEBUG")
endif()
configure_file(tf2_bot_detector/Resources.base.rc tf2_bot_detector/Resources.rc)

target_sources(tf2_bot_detector PRIVATE
"tf2_bot_detector/Platform/Windows/Processes.cpp"
"tf2_bot_detector/Platform/Windows/Shell.cpp"
"tf2_bot_detector/Platform/Windows/Steam.cpp"
"tf2_bot_detector/Platform/Windows/WindowsHelpers.h"
"tf2_bot_detector/Resources.rc"
)
endif()

target_include_directories(tf2_bot_detector
PRIVATE tf2_bot_detector
)
target_compile_definitions(tf2_bot_detector PRIVATE WIN32_LEAN_AND_MEAN)

option(TF2BD_ENABLE_DISCORD_INTEGRATION "Enable discord integration" on)
if (TF2BD_ENABLE_DISCORD_INTEGRATION)
target_compile_definitions(tf2_bot_detector PRIVATE TF2BD_ENABLE_DISCORD_INTEGRATION)
find_library(DISCORD_GAME_SDK discord_game_sdk)
message("DISCORD_GAME_SDK = ${DISCORD_GAME_SDK}")
target_link_libraries(tf2_bot_detector PRIVATE ${DISCORD_GAME_SDK})

find_path(GAME_SDK_INCLUDE discord-game-sdk/discord.h)
target_include_directories(tf2_bot_detector PRIVATE ${DISCORD_GAME_SDK_INCLUDE})

find_library(DISCORD_CPP_GAME_SDK discord_game_sdk_cpp)
message("DISCORD_CPP_GAME_SDK = ${DISCORD_CPP_GAME_SDK}")
target_link_libraries(tf2_bot_detector PRIVATE ${DISCORD_CPP_GAME_SDK})

target_sources(tf2_bot_detector PRIVATE
"tf2_bot_detector/DiscordRichPresence.cpp"
"tf2_bot_detector/DiscordRichPresence.h"
)
endif()

find_package(OpenSSL REQUIRED)
target_link_libraries(tf2_bot_detector)

find_path(HTTPLIB_PATH NAMES httplib.h)
target_include_directories(tf2_bot_detector PRIVATE ${HTTPLIB_PATH})

find_package(nlohmann_json CONFIG REQUIRED)
find_package(libzippp CONFIG REQUIRED)
find_package(fmt CONFIG REQUIRED)

target_link_libraries(tf2_bot_detector PRIVATE
imgui_desktop
mh_stuff
ValveFileVDF
libzip::libzip
libzippp::libzippp
cppcoro
SourceRCON
OpenSSL::SSL # cpp-httplib requires openssl
nlohmann_json::nlohmann_json
fmt::fmt
)

option(TF2BD_ENABLE_TESTS "Enable test compilation" off)
if (TF2BD_ENABLE_TESTS)
enable_testing()

find_package(Catch2 CONFIG REQUIRED)
target_link_libraries(tf2_bot_detector PRIVATE Catch2::Catch2)
target_compile_definitions(tf2_bot_detector PRIVATE TF2BD_ENABLE_TESTS)
target_sources(tf2_bot_detector PRIVATE
"tf2_bot_detector/Tests/Catch2.cpp"
"tf2_bot_detector/Tests/ConsoleLineTests.cpp"
"tf2_bot_detector/Tests/Tests.h"
)

SET(TF2BD_ENABLE_CLI_EXE true)

add_test(NAME TF2BD_Tests COMMAND tf2_bot_detector_cli --run-tests
WORKING_DIRECTORY staging
)
endif()

if(TF2BD_ENABLE_CLI_EXE)
add_executable(tf2_bot_detector_cli "tf2_bot_detector/Launcher/main.cpp")
target_include_directories(tf2_bot_detector_cli PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/tf2_bot_detector)
target_link_libraries(tf2_bot_detector_cli PRIVATE tf2_bot_detector)
set_property(TARGET tf2_bot_detector_cli PROPERTY CXX_STANDARD 17)
endif()

# TODO: Find a way to do this locally
if(MSVC)
target_compile_options(tf2_bot_detector PRIVATE /WX)
endif()

set_property(TARGET tf2_bot_detector PROPERTY CXX_STANDARD 20)
if (MSVC)
add_definitions(/await)
endif()

set_target_properties(tf2_bot_detector PROPERTIES
VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/staging"
)
add_subdirectory(tf2_bot_detector_common)
# add_subdirectory(tf2_bot_detector_updater)
add_subdirectory(tf2_bot_detector)

# "installation" aka create a build we can upload to github as a release
if (WIN32)
file(GLOB TF2BD_INSTALL_DEPS_DLL LIST_DIRECTORIES false "${CMAKE_BINARY_DIR}/*.dll")
install(FILES ${TF2BD_INSTALL_DEPS_DLL} DESTINATION /)
endif()
install(DIRECTORY staging/ staging/ DESTINATION "/" FILES_MATCHING
PATTERN "*"
PATTERN "staging/cfg/settings.json" EXCLUDE
PATTERN "staging/logs" EXCLUDE
)
install(TARGETS tf2_bot_detector DESTINATION /)
20 changes: 10 additions & 10 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"buildRoot": "${projectDir}\\out\\build_tf2_bot_detector\\${name}",
"installRoot": "${projectDir}\\out\\install_tf2_bot_detector\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
Expand All @@ -23,8 +23,8 @@
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "Release",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"buildRoot": "${projectDir}\\out\\build_tf2_bot_detector\\${name}",
"installRoot": "${projectDir}\\out\\install_tf2_bot_detector\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
Expand All @@ -42,8 +42,8 @@
"name": "x86-Release",
"generator": "Ninja",
"configurationType": "Release",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"buildRoot": "${projectDir}\\out\\build_tf2_bot_detector\\${name}",
"installRoot": "${projectDir}\\out\\install_tf2_bot_detector\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
Expand All @@ -61,8 +61,8 @@
"name": "x86-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"buildRoot": "${projectDir}\\out\\build_tf2_bot_detector\\${name}",
"installRoot": "${projectDir}\\out\\install_tf2_bot_detector\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
Expand All @@ -77,4 +77,4 @@
"cmakeToolchain": "submodules/vcpkg/scripts/buildsystems/vcpkg.cmake"
}
]
}
}
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
<br />
-->
<br />
<a href="https://tf2bd-util.pazer.us/Redirect/AppInstaller?source=https://tf2bd-util.pazer.us/AppInstaller/Nightly.appinstaller">Install</a>
·
<a href="https://github.com/PazerOP/tf2_bot_detector/issues">Report a Bug</a>
·
<a href="https://github.com/PazerOP/tf2_bot_detector/issues">Request a Feature</a>
Expand Down Expand Up @@ -68,13 +70,16 @@

These instructions will give a quick overview of getting started with TF2BD. There is also a (very slightly out of date, but still useable) video by CrazyGunman#6724 [here][install-video].

### Prerequisites
### Installation

#### Automatic Install

>A note about 64 bit vs 32 bit: If your computer was made after 2011 it is 64 bit and you should use the 64 bit version.
If you are using Windows 10 1809 or newer, just click this link: [Install][msix-install-link]

This program requires [Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019][mscr-link] ([32bit version available here][mscr86-link])
#### Powershell Install
`Add-AppxPackage -AppInstallerFile https://tf2bd-util.pazer.us/AppInstaller/Nightly.appinstaller`

### Installation
#### Manual/Portable Install

1. Download and install the [Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019][mscr-link]
2. Download the [latest release][latest-64] ([32bit version][latest-86])
Expand Down Expand Up @@ -182,6 +187,7 @@ Huge thanks to the people sponsoring this project via [GitHub Sponsors][github-s
[discord-link]: https://discord.gg/W8ZSh3Z
[mscr-link]: https://aka.ms/vs/16/release/vc_redist.x64.exe
[mscr86-link]: https://aka.ms/vs/16/release/vc_redist.x86.exe
[msix-install-link]: https://tf2bd-util.pazer.us/Redirect/AppInstaller?source=https://tf2bd-util.pazer.us/AppInstaller/Nightly.appinstaller
[zip-image]: https://i.imgur.com/ZeCuUul.png
[github-sponsors-pazerop]: https://github.com/sponsors/PazerOP
[wiki-customization-link]: https://github.com/PazerOP/tf2_bot_detector/wiki/Customization#third-party-player-lists
Expand Down
Loading

0 comments on commit 54c623d

Please sign in to comment.