Skip to content

Commit

Permalink
fix: building server & client together on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Xenapte committed Feb 16, 2024
1 parent 147441e commit 12c92ab
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
32 changes: 17 additions & 15 deletions BallanceMMOClient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,25 @@ include_directories("${CMAKE_CURRENT_LIST_DIR}/../BallanceMMOCommon/include"
set(CONFIG_DIR ${CMAKE_CURRENT_LIST_DIR}/../BallanceMMOCommon/include/config)
configure_file(${CONFIG_DIR}/version_config.h.in ${CONFIG_DIR}/version_config.h @ONLY)

if (CMAKE_SYSTEM_NAME MATCHES "Windows")
# setting vcpkg toolchain file
# set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake
# CACHE STRING "Vcpkg toolchain file")

if (MINGW) # if mingw
# setting vcpkg
if (DEFINED ENV{VCPKG_DEFAULT_TRIPLET} AND NOT DEFINED VCPKG_TARGET_TRIPLET)
set(VCPKG_TARGET_TRIPLET "$ENV{VCPKG_DEFAULT_TRIPLET}" CACHE STRING "")
endif ()
endif ()
find_package(Protobuf REQUIRED)
find_package(GameNetworkingSockets REQUIRED)
# if (CMAKE_SYSTEM_NAME MATCHES "Windows")
# # setting vcpkg toolchain file
# # set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake
# # CACHE STRING "Vcpkg toolchain file")

# if (MINGW) # if mingw
# # setting vcpkg
# if (DEFINED ENV{VCPKG_DEFAULT_TRIPLET} AND NOT DEFINED VCPKG_TARGET_TRIPLET)
# set(VCPKG_TARGET_TRIPLET "$ENV{VCPKG_DEFAULT_TRIPLET}" CACHE STRING "")
# endif ()
# endif ()
# find_package(Protobuf REQUIRED)
# find_package(GameNetworkingSockets REQUIRED)
# endif ()

if (NOT TARGET replxx)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../submodule/replxx ${CMAKE_CURRENT_BINARY_DIR}/replxx)
endif ()

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../submodule/replxx ${CMAKE_CURRENT_BINARY_DIR}/replxx)

set(VIRTOOLS_SDK_PATH "${VIRTOOLS_SDK_PATH}" CACHE PATH "Path to the Virtools SDK")
set(VIRTOOLS_SDK_FETCH_FROM_GIT "${VIRTOOLS_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable")
set(VIRTOOLS_SDK_FETCH_FROM_GIT_PATH "${VIRTOOLS_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
Expand Down
16 changes: 10 additions & 6 deletions BallanceMMOServer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ set(CMAKE_BUILD_WITH_INSTALL_RPATH on)
# endif ()

#add_compile_options("$<$<CONFIG:DEBUG>:-DDEBUG>")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../submodule/GameNetworkingSockets ${CMAKE_CURRENT_BINARY_DIR}/GameNetworkingSockets)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../submodule/replxx ${CMAKE_CURRENT_BINARY_DIR}/replxx)
if (NOT TARGET GameNetworkingSockets)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../submodule/GameNetworkingSockets ${CMAKE_CURRENT_BINARY_DIR}/GameNetworkingSockets)
endif ()
if (NOT TARGET replxx)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../submodule/replxx ${CMAKE_CURRENT_BINARY_DIR}/replxx)
endif ()

include_directories(../submodule/asio/asio/include)
include_directories(../submodule/ya_getopt)
Expand Down Expand Up @@ -98,9 +102,9 @@ endif()

# os specific scripts
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/powershell_wrapper.bat ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/start_ballancemmo_loop.bat COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/start_ballancemmo_loop.ps1 ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/bmmo_loop.ps1 COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/postbuild.bat ${CMAKE_CURRENT_BINARY_DIR}/postbuild.bat COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/powershell_wrapper.bat ${BMMO_RUNTIME_DIR}/start_ballancemmo_loop.bat COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/start_ballancemmo_loop.ps1 ${BMMO_RUNTIME_DIR}/bmmo_loop.ps1 COPYONLY)
# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/postbuild.bat ${CMAKE_CURRENT_BINARY_DIR}/postbuild.bat COPYONLY)
else()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/start_ballancemmo_loop.sh ${CMAKE_CURRENT_BINARY_DIR}/start_ballancemmo_loop.sh COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/start_ballancemmo_loop.sh ${BMMO_RUNTIME_DIR}/start_ballancemmo_loop.sh COPYONLY)
endif()
2 changes: 1 addition & 1 deletion submodule/vcpkg
Submodule vcpkg updated 2662 files

0 comments on commit 12c92ab

Please sign in to comment.