Skip to content

Commit

Permalink
Linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Vlasov authored and Sergey Vlasov committed Mar 31, 2024
1 parent 1e6d61f commit f9424a9
Show file tree
Hide file tree
Showing 15 changed files with 307 additions and 100 deletions.
4 changes: 4 additions & 0 deletions 01_project.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

cmake --preset=linux-dbg -S .

17 changes: 13 additions & 4 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@
"version": 3,
"configurePresets": [
{
"name": "default",
"binaryDir": "$env{BUILD_ROOT}/dns_server",
"name": "windows-dbg",
"binaryDir": "C:/build/dns_server",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_TOOLCHAIN_FILE": "C:/vcpkg/scripts/buildsystems/vcpkg.cmake"
}
},
{
"name": "linux-dbg",
"binaryDir": "/home/sergv/Documents/build/dns_server",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_TOOLCHAIN_FILE": "/home/sergv/Documents/vcpkg/scripts/buildsystems/vcpkg.cmake"
}
}
]
}
}
7 changes: 7 additions & 0 deletions libdns/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@ add_library(dns STATIC
dns_answer.cpp dns_answer.h
dns_auth_server.cpp dns_auth_server.h
dns_package.cpp dns_package.h
dns_selector.cpp dns_selector.h
dns_socket.cpp dns_socket.h
dns.cpp dns.h
)


target_include_directories(dns PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(dns PRIVATE JsonCpp::JsonCpp)

if(WIN32)
target_link_libraries(dns PUBLIC wsock32 ws2_32)
target_sources(dns PRIVATE dns_selector_win32.cpp)
else()
target_link_libraries(dns PUBLIC pthread)
target_sources(dns PRIVATE dns_selector_posix.cpp)
endif()
Loading

0 comments on commit f9424a9

Please sign in to comment.