Skip to content

Commit

Permalink
Update cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
ldslds449 committed Nov 19, 2023
1 parent c2d117c commit 54f6bb0
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 12 deletions.
30 changes: 30 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug Online",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/bin/mapArtist.exe",
"args": ["-m", "-a", "mcfallout.net", "-c", "config_online.txt"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/bin",
"environment": [],
"console": "externalTerminal"
},
{
"name": "Debug Local",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/bin/mapArtist.exe",
"args": ["-c", "config_local.txt"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/bin",
"environment": [],
"console": "externalTerminal"
}
]
}
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ if(NOT GIT_FOUND)
endif()

if(MSVC)
message(STATUS "Config Type: ${CMAKE_CONFIGURATION_TYPES}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /O2")
if(NOT CMAKE_GENERATOR_PLATFORM STREQUAL "")
list(APPEND BUILD_PLATFORM "-A ${CMAKE_GENERATOR_PLATFORM}")
Expand Down Expand Up @@ -64,7 +65,7 @@ add_dependencies(${TARGET_NAME} Botcraft-install)
target_compile_definitions(${TARGET_NAME} PUBLIC "PROTOCOL_VERSION=${PROTOCOL_VERSION}")
target_compile_definitions(${TARGET_NAME} PUBLIC "USE_IMGUI=1")
target_compile_definitions(${TARGET_NAME} PUBLIC "USE_GUI=1")
target_link_libraries(${TARGET_NAME} ws2_32 botcraft protocolCraft)
target_link_libraries(${TARGET_NAME} ws2_32 botcraft$<$<CONFIG:Debug>:_d> protocolCraft$<$<CONFIG:Debug>:_d>)

# pathfinding
target_include_directories(${TARGET_NAME} PUBLIC ${PATHFINDING_HEADER_PATH})
Expand Down
10 changes: 5 additions & 5 deletions cmake/botcraft.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ ExternalProject_Add(Botcraft
STEP_TARGETS install
EXCLUDE_FROM_ALL TRUE
CMAKE_GENERATOR ${CMAKE_GENERATOR}
CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${BOTCRAFT_SRC_PATH} -B ${BOTCRAFT_BUILD_PATH} -G ${CMAKE_GENERATOR} -DBOTCRAFT_USE_OPENGL_GUI=ON -DBOTCRAFT_USE_IMGUI=ON -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DBOTCRAFT_GAME_VERSION=${MC_VERSION} -DBOTCRAFT_OUTPUT_DIR=${BOTCRAFT_BUILD_PATH} -DBOTCRAFT_COMPRESSION=ON -DCMAKE_BUILD_TYPE=Release ${BUILD_PLATFORM} -DBOTCRAFT_FORCE_LOCAL_ZLIB=${ZLIB_INSTALL_PATH} -DBOTCRAFT_FORCE_LOCAL_OPENSSL=${OPENSSL_INSTALL_PATH}
BUILD_COMMAND ${CMAKE_COMMAND} --build ${BOTCRAFT_BUILD_PATH} --config Release
INSTALL_COMMAND ${CMAKE_COMMAND} --install ${BOTCRAFT_BUILD_PATH} --prefix ${BOTCRAFT_INSTALL_PATH}
CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${BOTCRAFT_SRC_PATH} -B ${BOTCRAFT_BUILD_PATH} -G ${CMAKE_GENERATOR} -DBOTCRAFT_USE_OPENGL_GUI=ON -DBOTCRAFT_USE_IMGUI=ON -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DBOTCRAFT_GAME_VERSION=${MC_VERSION} -DBOTCRAFT_OUTPUT_DIR=${BOTCRAFT_BUILD_PATH} -DBOTCRAFT_COMPRESSION=ON ${BUILD_PLATFORM} -DBOTCRAFT_FORCE_LOCAL_ZLIB=${ZLIB_INSTALL_PATH} -DBOTCRAFT_FORCE_LOCAL_OPENSSL=${OPENSSL_INSTALL_PATH} -DCMAKE_BUILD_TYPE=Release
BUILD_COMMAND ${CMAKE_COMMAND} --build ${BOTCRAFT_BUILD_PATH} --config $<IF:$<CONFIG:Debug>,Debug,Release>
INSTALL_COMMAND ${CMAKE_COMMAND} --install ${BOTCRAFT_BUILD_PATH} --prefix ${BOTCRAFT_INSTALL_PATH} --config $<IF:$<CONFIG:Debug>,Debug,Release>
)

add_dependencies(Botcraft-install Openssl-install Zlib-install)
Expand All @@ -37,8 +37,8 @@ if(MINGW)
list(APPEND BOTCRAFT_DEPEND_DLL ${BOTCRAFT_BINARY_PATH}/libprotocolCraft.dll)
list(APPEND BOTCRAFT_DEPEND_DLL ${BOTCRAFT_BINARY_PATH}/libstdc++-6.dll)
elseif(MSVC)
list(APPEND BOTCRAFT_DEPEND_DLL ${BOTCRAFT_BINARY_PATH}/botcraft.dll)
list(APPEND BOTCRAFT_DEPEND_DLL ${BOTCRAFT_BINARY_PATH}/protocolCraft.dll)
list(APPEND BOTCRAFT_DEPEND_DLL ${BOTCRAFT_BINARY_PATH}/botcraft"$<$<CONFIG:Debug>:_d>".dll)
list(APPEND BOTCRAFT_DEPEND_DLL ${BOTCRAFT_BINARY_PATH}/protocolCraft"$<$<CONFIG:Debug>:_d>".dll)
endif()
add_custom_command(TARGET Botcraft-install POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
Expand Down
4 changes: 2 additions & 2 deletions cmake/dpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ ExternalProject_Add(Dpp
EXCLUDE_FROM_ALL TRUE
CMAKE_GENERATOR ${CMAKE_GENERATOR}
CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${DPP_SRC_PATH} -B ${DPP_BUILD_PATH} -G ${CMAKE_GENERATOR} -DDPP_NO_VCPKG=ON ${BUILD_PLATFORM} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DDPP_BUILD_TEST=OFF -DCMAKE_BUILD_TYPE=Release
BUILD_COMMAND ${CMAKE_COMMAND} --build ${DPP_BUILD_PATH} --config Release
INSTALL_COMMAND ${CMAKE_COMMAND} --install ${DPP_BUILD_PATH} --prefix ${DPP_INSTALL_PATH}
BUILD_COMMAND ${CMAKE_COMMAND} --build ${DPP_BUILD_PATH} --config $<IF:$<CONFIG:Debug>,Debug,Release>
INSTALL_COMMAND ${CMAKE_COMMAND} --install ${DPP_BUILD_PATH} --prefix ${DPP_INSTALL_PATH} --config $<IF:$<CONFIG:Debug>,Debug,Release>
)

file(GLOB DPP_DEPEND_DLL ${DPP_SRC_PATH}/win32/bin/*.dll)
Expand Down
4 changes: 2 additions & 2 deletions cmake/openssl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ ExternalProject_Add(Openssl
EXCLUDE_FROM_ALL TRUE
CMAKE_GENERATOR ${CMAKE_GENERATOR}
CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${OPENSSL_SRC_PATH} -B ${OPENSSL_BUILD_PATH} -G ${CMAKE_GENERATOR} -DCMAKE_BUILD_TYPE=Release ${BUILD_PLATFORM} -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DCMAKE_INSTALL_PREFIX=install -DWITH_APPS=OFF -DCPACK_SOURCE_7Z=OFF -DCPACK_SOURCE_ZIP=OFF -DMSVC_RUNTIME=dynamic -DCMAKE_POSITION_INDEPENDENT_CODE=ON
BUILD_COMMAND ${CMAKE_COMMAND} --build ${OPENSSL_BUILD_PATH} --config Release
INSTALL_COMMAND ${CMAKE_COMMAND} --install ${OPENSSL_BUILD_PATH} --prefix ${OPENSSL_INSTALL_PATH}
BUILD_COMMAND ${CMAKE_COMMAND} --build ${OPENSSL_BUILD_PATH} --config $<IF:$<CONFIG:Debug>,Debug,Release>
INSTALL_COMMAND ${CMAKE_COMMAND} --install ${OPENSSL_BUILD_PATH} --prefix ${OPENSSL_INSTALL_PATH} --config $<IF:$<CONFIG:Debug>,Debug,Release>
)
4 changes: 2 additions & 2 deletions cmake/zlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ ExternalProject_Add(Zlib
EXCLUDE_FROM_ALL TRUE
CMAKE_GENERATOR ${CMAKE_GENERATOR}
CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${ZLIB_SRC_PATH} -B ${ZLIB_BUILD_PATH} -G ${CMAKE_GENERATOR} -DCMAKE_INSTALL_PREFIX=${ZLIB_INSTALL_PATH} -DCMAKE_BUILD_TYPE=Release ${BUILD_PLATFORM} -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DCMAKE_POSITION_INDEPENDENT_CODE=ON
BUILD_COMMAND ${CMAKE_COMMAND} --build ${ZLIB_BUILD_PATH} --config Release
INSTALL_COMMAND ${CMAKE_COMMAND} --install ${ZLIB_BUILD_PATH} --prefix ${ZLIB_INSTALL_PATH}
BUILD_COMMAND ${CMAKE_COMMAND} --build ${ZLIB_BUILD_PATH} --config $<IF:$<CONFIG:Debug>,Debug,Release>
INSTALL_COMMAND ${CMAKE_COMMAND} --install ${ZLIB_BUILD_PATH} --prefix ${ZLIB_INSTALL_PATH} --config $<IF:$<CONFIG:Debug>,Debug,Release>
)

0 comments on commit 54f6bb0

Please sign in to comment.