Make the monolith test a C++ binary.

This way, developers compile toxcore, toxav, and toxencryptsave as C++ at
least once at home, reducing the likelyhood of running into travis
failures where we compile as C++ in the windows build.
This commit is contained in:
iphydf 2018-01-20 21:26:32 +00:00
parent 52778aed93
commit 033965b8cc
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9
6 changed files with 19 additions and 14 deletions

View File

@ -403,7 +403,7 @@ install_module(toxcore DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tox)
# endif() # endif()
# #
# if(MSGPACK_FOUND) # if(MSGPACK_FOUND)
# add_c_executable(toxcore-sut # add_binary(toxcore-sut
# testing/hstox/binary_decode.c # testing/hstox/binary_decode.c
# testing/hstox/binary_encode.c # testing/hstox/binary_encode.c
# testing/hstox/driver.c # testing/hstox/driver.c
@ -445,7 +445,7 @@ endif()
function(auto_test target) function(auto_test target)
if(CHECK_FOUND AND NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" AND ARGV1 STREQUAL "MSVC_DONT_BUILD")) if(CHECK_FOUND AND NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" AND ARGV1 STREQUAL "MSVC_DONT_BUILD"))
add_c_executable(auto_${target}_test auto_tests/${target}_test.c) add_binary(auto_${target}_test auto_tests/${target}_test.c)
target_link_modules(auto_${target}_test target_link_modules(auto_${target}_test
toxcore toxcore
toxcrypto toxcrypto
@ -460,8 +460,8 @@ function(auto_test target)
endfunction() endfunction()
if(BUILD_TOXAV) if(BUILD_TOXAV)
add_c_executable(auto_monolith_test add_binary(auto_monolith_test
auto_tests/monolith_test.c auto_tests/monolith_test.cpp
${ANDROID_CPU_FEATURES}) ${ANDROID_CPU_FEATURES})
target_link_modules(auto_monolith_test target_link_modules(auto_monolith_test
${LIBSODIUM_LIBRARIES} ${LIBSODIUM_LIBRARIES}
@ -511,7 +511,7 @@ endif()
option(DHT_BOOTSTRAP "Enable building of DHT_bootstrap" ON) option(DHT_BOOTSTRAP "Enable building of DHT_bootstrap" ON)
if(DHT_BOOTSTRAP) if(DHT_BOOTSTRAP)
add_c_executable(DHT_bootstrap add_binary(DHT_bootstrap
other/DHT_bootstrap.c other/DHT_bootstrap.c
other/bootstrap_node_packets.c) other/bootstrap_node_packets.c)
target_link_modules(DHT_bootstrap toxnetcrypto) target_link_modules(DHT_bootstrap toxnetcrypto)
@ -523,7 +523,7 @@ if(BOOTSTRAP_DAEMON)
message(FATAL_ERROR "Building tox-bootstrapd for Windows is not supported") message(FATAL_ERROR "Building tox-bootstrapd for Windows is not supported")
endif() endif()
if(LIBCONFIG_FOUND) if(LIBCONFIG_FOUND)
add_c_executable(tox-bootstrapd add_binary(tox-bootstrapd
other/bootstrap_daemon/src/command_line_arguments.c other/bootstrap_daemon/src/command_line_arguments.c
other/bootstrap_daemon/src/command_line_arguments.h other/bootstrap_daemon/src/command_line_arguments.h
other/bootstrap_daemon/src/config.c other/bootstrap_daemon/src/config.c
@ -554,7 +554,7 @@ option(BUILD_AV_TEST "Build toxav test" ON)
if(NOT WIN32 if(NOT WIN32
AND BUILD_AV_TEST AND BUILD_TOXAV AND BUILD_AV_TEST AND BUILD_TOXAV
AND SNDFILE_FOUND AND PORTAUDIO_FOUND AND OPENCV_FOUND) AND SNDFILE_FOUND AND PORTAUDIO_FOUND AND OPENCV_FOUND)
add_c_executable(av_test testing/av_test.c) add_binary(av_test testing/av_test.c)
target_link_modules(av_test target_link_modules(av_test
toxcore toxcore
${OPENCV_LIBRARIES} ${OPENCV_LIBRARIES}
@ -567,23 +567,23 @@ if(NOT WIN32
endif() endif()
endif() endif()
add_c_executable(DHT_test testing/DHT_test.c) add_binary(DHT_test testing/DHT_test.c)
target_link_modules(DHT_test toxdht) target_link_modules(DHT_test toxdht)
add_c_executable(Messenger_test testing/Messenger_test.c) add_binary(Messenger_test testing/Messenger_test.c)
target_link_modules(Messenger_test toxmessenger) target_link_modules(Messenger_test toxmessenger)
if(NOT WIN32) if(NOT WIN32)
add_c_executable(tox_sync testing/tox_sync.c) add_binary(tox_sync testing/tox_sync.c)
target_link_modules(tox_sync toxcore) target_link_modules(tox_sync toxcore)
endif() endif()
if(UTIL_LIBRARIES) if(UTIL_LIBRARIES)
add_c_executable(tox_shell testing/tox_shell.c) add_binary(tox_shell testing/tox_shell.c)
target_link_modules(tox_shell toxcore ${UTIL_LIBRARIES}) target_link_modules(tox_shell toxcore ${UTIL_LIBRARIES})
endif() endif()
if(NOT WIN32) if(NOT WIN32)
add_c_executable(irc_syncbot testing/irc_syncbot.c) add_binary(irc_syncbot testing/irc_syncbot.c)
target_link_modules(irc_syncbot toxcore toxnetwork) target_link_modules(irc_syncbot toxcore toxnetwork)
endif() endif()

View File

@ -15,6 +15,7 @@ cc_library(
srcs = [src], srcs = [src],
copts = [ copts = [
"-Wno-parentheses", "-Wno-parentheses",
"-Wno-sign-compare",
], ],
deps = [ deps = [
":helpers", ":helpers",
@ -25,4 +26,4 @@ cc_library(
"//c-toxcore/toxencryptsave", "//c-toxcore/toxencryptsave",
"@check", "@check",
], ],
) for src in glob(["*_test.c"])] ) for src in glob(["*_test.c*"])]

View File

@ -28,7 +28,7 @@ macro(set_source_language)
endif() endif()
endmacro() endmacro()
function(add_c_executable exec) function(add_binary exec)
set_source_language(${ARGN}) set_source_language(${ARGN})
add_executable(${exec} ${ARGN}) add_executable(${exec} ${ARGN})

View File

@ -26,7 +26,9 @@
#endif #endif
#define _DARWIN_C_SOURCE #define _DARWIN_C_SOURCE
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE 600 #define _XOPEN_SOURCE 600
#endif
#if defined(_WIN32) && _WIN32_WINNT >= _WIN32_WINNT_WINXP #if defined(_WIN32) && _WIN32_WINNT >= _WIN32_WINNT_WINXP
#define _WIN32_WINNT 0x501 #define _WIN32_WINNT 0x501

View File

@ -27,7 +27,9 @@
#include "config.h" #include "config.h"
#endif #endif
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE 600 #define _XOPEN_SOURCE 600
#endif
#include "util.h" #include "util.h"