Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restyle refactor: Move some OS-specifics into tox_system. #2402

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
_build
_install
2 changes: 1 addition & 1 deletion .github/scripts/flags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ add_flag -O3 -march=native
# Warn on non-ISO C.
add_c_flag -pedantic
add_c_flag -std=c99
add_cxx_flag -std=c++11
add_cxx_flag -std=c++17

add_flag -g3
add_flag -ftrapv
36 changes: 33 additions & 3 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,49 @@ project()
genrule(
name = "public_headers",
srcs = [
"toxav.h",
"tox.h",
"toxencryptsave.h",
"//c-toxcore/toxav:toxav.h",
"//c-toxcore/toxcore:tox.h",
"//c-toxcore/toxcore:tox_attributes.h",
"//c-toxcore/toxcore:tox_logger.h",
"//c-toxcore/toxcore:tox_memory.h",
"//c-toxcore/toxcore:tox_network.h",
"//c-toxcore/toxcore:tox_random.h",
"//c-toxcore/toxcore:tox_system.h",
"//c-toxcore/toxcore:tox_time.h",
"//c-toxcore/toxencryptsave:toxencryptsave.h",
],
outs = [
"tox/toxav.h",
"tox/tox.h",
"tox/toxencryptsave.h",
"tox/toxav/toxav.h",
"tox/toxcore/tox.h",
"tox/toxcore/tox_attributes.h",
"tox/toxcore/tox_logger.h",
"tox/toxcore/tox_memory.h",
"tox/toxcore/tox_network.h",
"tox/toxcore/tox_random.h",
"tox/toxcore/tox_system.h",
"tox/toxcore/tox_time.h",
"tox/toxencryptsave/toxencryptsave.h",
],
cmd = """
cp $(location //c-toxcore/toxav:toxav.h) $(GENDIR)/c-toxcore/tox/toxav.h
cp $(location //c-toxcore/toxcore:tox.h) $(GENDIR)/c-toxcore/tox/tox.h
cp $(location //c-toxcore/toxencryptsave:toxencryptsave.h) $(GENDIR)/c-toxcore/tox/toxencryptsave.h
cp $(location toxav.h) $(GENDIR)/c-toxcore/tox/toxav.h
cp $(location tox.h) $(GENDIR)/c-toxcore/tox/tox.h
cp $(location toxencryptsave.h) $(GENDIR)/c-toxcore/tox/toxencryptsave.h
cp $(location //c-toxcore/toxav:toxav.h) $(GENDIR)/c-toxcore/tox/toxav/toxav.h
cp $(location //c-toxcore/toxcore:tox.h) $(GENDIR)/c-toxcore/tox/toxcore/tox.h
cp $(location //c-toxcore/toxcore:tox_attributes.h) $(GENDIR)/c-toxcore/tox/toxcore/tox_attributes.h
cp $(location //c-toxcore/toxcore:tox_logger.h) $(GENDIR)/c-toxcore/tox/toxcore/tox_logger.h
cp $(location //c-toxcore/toxcore:tox_memory.h) $(GENDIR)/c-toxcore/tox/toxcore/tox_memory.h
cp $(location //c-toxcore/toxcore:tox_network.h) $(GENDIR)/c-toxcore/tox/toxcore/tox_network.h
cp $(location //c-toxcore/toxcore:tox_random.h) $(GENDIR)/c-toxcore/tox/toxcore/tox_random.h
cp $(location //c-toxcore/toxcore:tox_system.h) $(GENDIR)/c-toxcore/tox/toxcore/tox_system.h
cp $(location //c-toxcore/toxcore:tox_time.h) $(GENDIR)/c-toxcore/tox/toxcore/tox_time.h
cp $(location //c-toxcore/toxencryptsave:toxencryptsave.h) $(GENDIR)/c-toxcore/tox/toxencryptsave/toxencryptsave.h
""",
visibility = ["//visibility:public"],
)
Expand Down
45 changes: 43 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ set(toxcore_SOURCES
toxcore/logger.h
toxcore/Messenger.c
toxcore/Messenger.h
toxcore/mem.c
toxcore/mem.h
toxcore/mono_time.c
toxcore/mono_time.h
toxcore/net_crypto.c
Expand All @@ -280,6 +282,17 @@ set(toxcore_SOURCES
toxcore/onion_client.c
toxcore/onion_client.h
toxcore/onion.h
toxcore/os_logger.c
toxcore/os_logger.h
toxcore/os_memory.c
toxcore/os_memory.h
toxcore/os_network.c
toxcore/os_network.h
toxcore/os_network_impl.h
toxcore/os_random.c
toxcore/os_random.h
toxcore/os_system.c
toxcore/os_system.h
toxcore/ping_array.c
toxcore/ping_array.h
toxcore/ping.c
Expand All @@ -300,11 +313,29 @@ set(toxcore_SOURCES
toxcore/timed_auth.h
toxcore/tox_api.c
toxcore/tox.c
toxcore/tox.h
toxcore/tox_dispatch.c
toxcore/tox_dispatch.h
toxcore/tox_events.c
toxcore/tox_events.h
toxcore/tox.h
toxcore/tox_logger.c
toxcore/tox_logger.h
toxcore/tox_logger_impl.h
toxcore/tox_memory.c
toxcore/tox_memory.h
toxcore/tox_memory_impl.h
toxcore/tox_network.c
toxcore/tox_network.h
toxcore/tox_network_impl.h
toxcore/tox_random.c
toxcore/tox_random.h
toxcore/tox_random_impl.h
toxcore/tox_system.c
toxcore/tox_system.h
toxcore/tox_system_impl.h
toxcore/tox_time.c
toxcore/tox_time.h
toxcore/tox_time_impl.h
toxcore/tox_private.c
toxcore/tox_private.h
toxcore/tox_unpack.c
Expand All @@ -314,9 +345,16 @@ set(toxcore_SOURCES
set(toxcore_LINK_MODULES ${toxcore_LINK_MODULES} ${LIBSODIUM_LIBRARIES})
set(toxcore_PKGCONFIG_REQUIRES ${toxcore_PKGCONFIG_REQUIRES} libsodium)
set(toxcore_API_HEADERS
${toxcore_SOURCE_DIR}/tox.h^tox
${toxcore_SOURCE_DIR}/toxcore/tox.h^tox
${toxcore_SOURCE_DIR}/toxcore/tox_dispatch.h^tox
${toxcore_SOURCE_DIR}/toxcore/tox_events.h^tox
${toxcore_SOURCE_DIR}/toxcore/tox_dispatch.h^tox)
${toxcore_SOURCE_DIR}/toxcore/tox_logger.h^tox
${toxcore_SOURCE_DIR}/toxcore/tox_memory.h^tox
${toxcore_SOURCE_DIR}/toxcore/tox_network.h^tox
${toxcore_SOURCE_DIR}/toxcore/tox_random.h^tox
${toxcore_SOURCE_DIR}/toxcore/tox_system.h^tox
${toxcore_SOURCE_DIR}/toxcore/tox_time.h^tox)

################################################################################
#
Expand Down Expand Up @@ -344,6 +382,7 @@ if(BUILD_TOXAV)
toxav/video.c
toxav/video.h)
set(toxcore_API_HEADERS ${toxcore_API_HEADERS}
${toxcore_SOURCE_DIR}/toxav.h^toxav
${toxcore_SOURCE_DIR}/toxav/toxav.h^toxav)

set(toxcore_LINK_MODULES ${toxcore_LINK_MODULES} ${OPUS_LIBRARIES} ${VPX_LIBRARIES})
Expand All @@ -360,6 +399,7 @@ set(toxcore_SOURCES ${toxcore_SOURCES}
toxencryptsave/toxencryptsave.c
toxencryptsave/toxencryptsave.h)
set(toxcore_API_HEADERS ${toxcore_API_HEADERS}
${toxcore_SOURCE_DIR}/toxencryptsave.h^tox
${toxcore_SOURCE_DIR}/toxencryptsave/toxencryptsave.h^tox)

################################################################################
Expand Down Expand Up @@ -434,6 +474,7 @@ unit_test(toxcore bin_pack)
unit_test(toxcore crypto_core)
unit_test(toxcore group_announce)
unit_test(toxcore group_moderation)
unit_test(toxcore mem)
unit_test(toxcore mono_time)
unit_test(toxcore ping_array)
unit_test(toxcore tox)
Expand Down
5 changes: 5 additions & 0 deletions auto_tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ cc_library(
"//c-toxcore/toxcore:Messenger",
"//c-toxcore/toxcore:mono_time",
"//c-toxcore/toxcore:tox",
"//c-toxcore/toxcore:tox_time",
],
)

Expand Down Expand Up @@ -61,9 +62,13 @@ flaky_tests = {
"//c-toxcore/toxcore:onion",
"//c-toxcore/toxcore:onion_announce",
"//c-toxcore/toxcore:onion_client",
"//c-toxcore/toxcore:os_memory",
"//c-toxcore/toxcore:os_network",
"//c-toxcore/toxcore:os_random",
"//c-toxcore/toxcore:tox",
"//c-toxcore/toxcore:tox_dispatch",
"//c-toxcore/toxcore:tox_events",
"//c-toxcore/toxcore:tox_time",
"//c-toxcore/toxcore:util",
"//c-toxcore/toxencryptsave",
"@libsodium",
Expand Down
Loading