Add dns c library

This commit is contained in:
Benau 2021-03-12 09:07:14 +08:00
parent 9d57deb35b
commit f1aa29634b
5 changed files with 11726 additions and 6 deletions

View File

@ -44,6 +44,7 @@ CMAKE_DEPENDENT_OPTION(USE_SYSTEM_SQUISH "Use system Squish library instead of t
"NOT SERVER_ONLY" OFF)
CMAKE_DEPENDENT_OPTION(USE_WIIUSE "Support for wiimote input devices" ON
"NOT SERVER_ONLY;NOT CYGWIN;NOT USE_SWITCH" OFF)
CMAKE_DEPENDENT_OPTION(USE_DNS_C "Build bundled dns resolver" OFF "NOT CYGWIN;NOT USE_SWITCH" ON)
if(APPLE AND NOT IOS)
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm")
@ -189,12 +190,19 @@ endif()
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/bullet")
include_directories(BEFORE "${PROJECT_SOURCE_DIR}/lib/bullet/src")
if(WIN32 OR CMAKE_SYSTEM_NAME MATCHES "BSD" OR CMAKE_SYSTEM_NAME MATCHES "DragonFly" OR USE_SWITCH)
set(LIBRESOLV_LIBRARY)
elseif (HAIKU)
find_library(LIBRESOLV_LIBRARY NAMES network socket)
# Build the DNS C library
if(USE_DNS_C)
add_definitions(-DDNS_C)
add_subdirectory("${PROJECT_SOURCE_DIR}/lib/dnsc")
include_directories(BEFORE "${PROJECT_SOURCE_DIR}/lib/dnsc")
else()
find_library(LIBRESOLV_LIBRARY NAMES resolv libresolv)
if(WIN32 OR CMAKE_SYSTEM_NAME MATCHES "BSD" OR CMAKE_SYSTEM_NAME MATCHES "DragonFly" OR USE_SWITCH)
set(LIBRESOLV_LIBRARY)
elseif (HAIKU)
find_library(LIBRESOLV_LIBRARY NAMES network socket)
else()
find_library(LIBRESOLV_LIBRARY NAMES resolv libresolv)
endif()
endif()
# Find system ENet library or build it if missing
@ -611,7 +619,6 @@ target_link_libraries(supertuxkart
stkirrlicht
${Angelscript_LIBRARIES}
${CURL_LIBRARIES}
${LIBRESOLV_LIBRARY}
${MCPP_LIBRARY}
)
@ -638,6 +645,12 @@ if (USE_SWITCH)
)
endif()
if (USE_DNS_C)
target_link_libraries(supertuxkart dnsc)
else()
target_link_libraries(supertuxkart ${LIBRESOLV_LIBRARY})
endif()
if (USE_SQLITE3)
target_link_libraries(supertuxkart ${SQLITE3_LIBRARY})
endif()

1
lib/dnsc/CMakeLists.txt Normal file
View File

@ -0,0 +1 @@
add_library(dnsc STATIC dns.c)

19
lib/dnsc/LICENSE Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2008-2015 William Ahern <william@25thandClement.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.

10460
lib/dnsc/dns.c Normal file

File diff suppressed because it is too large Load Diff

1227
lib/dnsc/dns.h Normal file

File diff suppressed because it is too large Load Diff