feat(build): use CMake to fetch and link enet library
This commit is contained in:
parent
69be7aa529
commit
d417b147ed
@ -4,6 +4,13 @@ project(FarmFighter)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
if(POLICY CMP0077)
|
||||
cmake_policy(SET CMP0077 NEW)
|
||||
endif()
|
||||
set(FETCHCONTENT_QUIET OFF)
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
raylib
|
||||
@ -15,6 +22,15 @@ FetchContent_MakeAvailable(raylib)
|
||||
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
set(BUILD_GAMES OFF CACHE BOOL "" FORCE)
|
||||
|
||||
FetchContent_Declare(
|
||||
enet
|
||||
URL https://github.com/zpl-c/enet/archive/refs/tags/v2.3.10.zip
|
||||
)
|
||||
FetchContent_MakeAvailable(enet)
|
||||
|
||||
add_library(enet INTERFACE)
|
||||
target_include_directories(enet INTERFACE ${enet_SOURCE_DIR}/include)
|
||||
|
||||
add_subdirectory(networking)
|
||||
add_subdirectory(engine)
|
||||
add_subdirectory(client)
|
||||
|
@ -22,7 +22,6 @@ add_library(ImGui STATIC
|
||||
)
|
||||
target_include_directories(ImGui PUBLIC ${imgui_SOURCE_DIR})
|
||||
|
||||
# rlImGui
|
||||
FetchContent_Declare(
|
||||
rlImGui
|
||||
GIT_REPOSITORY https://github.com/raylib-extras/rlImGui.git
|
||||
@ -47,7 +46,8 @@ target_include_directories(client PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../networking/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../engine/include
|
||||
)
|
||||
target_link_libraries(client raylib networking engine rlImGui ImGui)
|
||||
|
||||
target_link_libraries(client raylib networking engine rlImGui ImGui enet)
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(client ws2_32)
|
||||
|
@ -9,4 +9,6 @@ target_include_directories(networking PUBLIC
|
||||
${raylib_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
target_include_directories(networking PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
target_include_directories(networking PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
target_link_libraries(networking enet)
|
@ -10,8 +10,8 @@ target_include_directories(server PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../engine/include
|
||||
)
|
||||
|
||||
target_link_libraries(server networking engine raylib)
|
||||
target_link_libraries(server networking engine raylib enet)
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(server ws2_32)
|
||||
endif()
|
||||
endif()
|
||||
|
Loading…
x
Reference in New Issue
Block a user