mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-02-16 02:30:54 +00:00
add tests executable
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -28,3 +28,6 @@
|
||||
[submodule "deps/fmt"]
|
||||
path = deps/fmt
|
||||
url = https://github.com/fmtlib/fmt
|
||||
[submodule "deps/doctest"]
|
||||
path = deps/doctest
|
||||
url = https://github.com/doctest/doctest
|
||||
|
||||
@@ -92,10 +92,14 @@ message(STATUS "Adding local source dependencies")
|
||||
# this has to happen before -DDEBUG since it wont compile properly with -DDEBUG
|
||||
add_subdirectory(deps)
|
||||
|
||||
# ------------------------ BEAMMP SERVER -----------------------------
|
||||
# ------------------------ VARIABLES ---------------------------------
|
||||
|
||||
add_executable(BeamMP-Server
|
||||
src/main.cpp
|
||||
include(FindLua)
|
||||
include(FindOpenSSL)
|
||||
include(FindThreads)
|
||||
include(FindZLIB)
|
||||
|
||||
set(BeamMP_Sources
|
||||
include/TConsole.h src/TConsole.cpp
|
||||
include/TServer.h src/TServer.cpp
|
||||
include/Compat.h src/Compat.cpp
|
||||
@@ -115,28 +119,26 @@ add_executable(BeamMP-Server
|
||||
include/TScopedTimer.h src/TScopedTimer.cpp
|
||||
include/SignalHandling.h src/SignalHandling.cpp
|
||||
include/ArgsParser.h src/ArgsParser.cpp
|
||||
include/Environment.h)
|
||||
include/Environment.h
|
||||
)
|
||||
|
||||
target_compile_definitions(BeamMP-Server PRIVATE SECRET_SENTRY_URL="${BEAMMP_SECRET_SENTRY_URL}")
|
||||
include_directories(BeamMP-Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
target_include_directories(BeamMP-Server PUBLIC
|
||||
set(BeamMP_Includes
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/commandline"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/commandline")
|
||||
|
||||
include(FindLua)
|
||||
include(FindOpenSSL)
|
||||
include(FindThreads)
|
||||
include(FindZLIB)
|
||||
|
||||
target_include_directories(BeamMP-Server PUBLIC
|
||||
${LUA_INCLUDE_DIR}
|
||||
${CURL_INCLUDE_DIRS}
|
||||
"include/tomlplusplus"
|
||||
"include/sentry-native/include"
|
||||
"include/curl/include")
|
||||
"include/curl/include"
|
||||
)
|
||||
|
||||
target_link_libraries(BeamMP-Server
|
||||
set(BeamMP_Definitions
|
||||
SECRET_SENTRY_URL="${BEAMMP_SECRET_SENTRY_URL}"
|
||||
)
|
||||
|
||||
set(BeamMP_Libraries
|
||||
doctest::doctest
|
||||
OpenSSL::SSL
|
||||
OpenSSL::Crypto
|
||||
sol2::sol2
|
||||
@@ -145,8 +147,57 @@ target_link_libraries(BeamMP-Server
|
||||
ZLIB::ZLIB
|
||||
${LUA_LIBRARIES}
|
||||
commandline
|
||||
sentry)
|
||||
sentry
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(BeamMP-Server wsock32 ws2_32)
|
||||
set(BeamMP_PlatformLibs wsock32 ws2_32)
|
||||
endif ()
|
||||
|
||||
# ------------------------ BEAMMP SERVER -----------------------------
|
||||
# ------------------------ BEAMMP SERVER TESTS -----------------------
|
||||
|
||||
add_executable(BeamMP-Server
|
||||
src/main.cpp
|
||||
${BeamMP_Sources}
|
||||
)
|
||||
|
||||
target_compile_definitions(BeamMP-Server PRIVATE
|
||||
${BeamMP_Definitions}
|
||||
DOCTEST_CONFIG_DISABLE
|
||||
)
|
||||
|
||||
target_include_directories(BeamMP-Server PUBLIC
|
||||
${BeamMP_Includes}
|
||||
)
|
||||
|
||||
target_link_libraries(BeamMP-Server
|
||||
${BeamMP_Libraries}
|
||||
${BeamMP_PlatformLibs}
|
||||
)
|
||||
|
||||
# ------------------------ BEAMMP SERVER TESTS -----------------------
|
||||
|
||||
option(BUILD_TESTS "Build BeamMP-Server tests" ON)
|
||||
|
||||
if(BUILD_TESTS)
|
||||
add_executable(BeamMP-Server-tests
|
||||
test/test_main.cpp
|
||||
${BeamMP_Sources}
|
||||
)
|
||||
|
||||
target_compile_definitions(BeamMP-Server-tests PRIVATE
|
||||
${BeamMP_Definitions}
|
||||
DOCTEST_CONFIG_DISABLE
|
||||
)
|
||||
|
||||
target_include_directories(BeamMP-Server-tests PUBLIC
|
||||
${BeamMP_Includes}
|
||||
)
|
||||
|
||||
target_link_libraries(BeamMP-Server-tests
|
||||
${BeamMP_Libraries}
|
||||
${BeamMP_PlatformLibs}
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
1
deps/CMakeLists.txt
vendored
1
deps/CMakeLists.txt
vendored
@@ -8,3 +8,4 @@ include_directories("${PROJECT_SOURCE_DIR}/deps")
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/commandline")
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/sol2")
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/fmt")
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/doctest")
|
||||
|
||||
1
deps/doctest
vendored
Submodule
1
deps/doctest
vendored
Submodule
Submodule deps/doctest added at 7b98851331
2
test/test_main.cpp
Normal file
2
test/test_main.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
|
||||
#include <doctest/doctest.h>
|
||||
Reference in New Issue
Block a user