mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-09 00:24:15 +00:00
Move project to CMake (#781)
* Move to cmake * Move sources to source_groups and ditch more old VS files * Add BuildVer.h generation * Break out cmake source lists to platforms * Don't copy swf files * Revert audio changes from merge * Add platform defines * Match MSBuild flags * Move BuildVer.h to common include and fix rebuild issue * Seperate projects properly * Exclude more files and make sure GameHDD exists * Missing line * Remove remaining VS project files * Update readme and actions * Use incremental LTCG * Update workflows * Update build workflows and output folder * Disable vcpkg checks * Force MSVC * Use precompiled headers * Only use PCH for cpp * Exclude compat_shims from PCH * Handle per-platform source includes * Copy only current platform media * Define Iggy libs per platform * Fix EnsureGameHDD check * Only set WIN32_EXECUTABLE on Windows * Correct Iggy libs path * Remove include of terrain_MipmapLevel * Correct path to xsb/xwb * Implement copilot suggestions * Add clang flags (untested) * Fix robocopy error checking * Update documentation * Drop CMakePresets.json version as we dont use v6 features * Always cleanup artifacts in nightly even if some builds fail * Re-work compiler target options * Move newer iggy dll into redist and cleanup * Fix typos * Remove 'Source Files' from all source groups * Remove old ps1 build scripts
This commit is contained in:
301
CMakeLists.txt
301
CMakeLists.txt
@@ -13,232 +13,101 @@ if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
message(FATAL_ERROR "Use a 64-bit generator/toolchain (x64).")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CONFIGURATION_TYPES
|
||||
"Debug"
|
||||
"Release"
|
||||
CACHE STRING "" FORCE
|
||||
)
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
|
||||
function(configure_msvc_target target)
|
||||
target_compile_options(${target} PRIVATE
|
||||
$<$<AND:$<NOT:$<CONFIG:Release>>,$<COMPILE_LANGUAGE:C,CXX>>:/W3>
|
||||
$<$<AND:$<CONFIG:Release>,$<COMPILE_LANGUAGE:C,CXX>>:/W0>
|
||||
$<$<COMPILE_LANGUAGE:C,CXX>:/MP>
|
||||
$<$<COMPILE_LANGUAGE:C,CXX>:/FS>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:/EHsc>
|
||||
$<$<AND:$<CONFIG:Release>,$<COMPILE_LANGUAGE:C,CXX>>:/GL /O2 /Oi /GT /GF>
|
||||
)
|
||||
function(configure_compiler_target target)
|
||||
# MSVC and compatible compilers (like Clang-cl)
|
||||
if (MSVC)
|
||||
target_compile_options(${target} PRIVATE
|
||||
$<$<AND:$<CONFIG:Debug>,$<COMPILE_LANGUAGE:C,CXX>>:/W3>
|
||||
$<$<AND:$<CONFIG:Release>,$<COMPILE_LANGUAGE:C,CXX>>:/W0>
|
||||
$<$<COMPILE_LANGUAGE:C,CXX>:/MP>
|
||||
$<$<COMPILE_LANGUAGE:C,CXX>:/FS>
|
||||
$<$<COMPILE_LANGUAGE:C,CXX>:/GS>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:/EHsc>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:/GR>
|
||||
$<$<AND:$<CONFIG:Debug>,$<COMPILE_LANGUAGE:C,CXX>>:/Od>
|
||||
$<$<AND:$<CONFIG:Release>,$<COMPILE_LANGUAGE:C,CXX>>:/O2 /Oi /GT /GF>
|
||||
)
|
||||
endif()
|
||||
|
||||
# MSVC
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
target_compile_options(${target} PRIVATE
|
||||
$<$<AND:$<CONFIG:Release>,$<COMPILE_LANGUAGE:C,CXX>>:/GL>
|
||||
)
|
||||
target_link_options(${target} PRIVATE
|
||||
$<$<CONFIG:Release>:/LTCG:incremental>
|
||||
)
|
||||
endif()
|
||||
|
||||
# Clang
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
target_compile_options(${target} PRIVATE
|
||||
$<$<AND:$<CONFIG:Debug>,$<COMPILE_LANGUAGE:C,CXX>>:-O0 -Wall>
|
||||
$<$<AND:$<CONFIG:Release>,$<COMPILE_LANGUAGE:C,CXX>>:-O2 -w -flto>
|
||||
)
|
||||
target_link_options(${target} PRIVATE
|
||||
$<$<CONFIG:Release>:-flto>
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/WorldSources.cmake")
|
||||
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/ClientSources.cmake")
|
||||
|
||||
list(TRANSFORM MINECRAFT_WORLD_SOURCES PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.World/")
|
||||
list(TRANSFORM MINECRAFT_CLIENT_SOURCES PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/")
|
||||
list(APPEND MINECRAFT_CLIENT_SOURCES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Xbox/MinecraftWindows.rc"
|
||||
# ---
|
||||
# Configuration
|
||||
# ---
|
||||
set(MINECRAFT_SHARED_DEFINES
|
||||
_LARGE_WORLDS
|
||||
_DEBUG_MENUS_ENABLED
|
||||
$<$<CONFIG:Debug>:_DEBUG>
|
||||
_CRT_NON_CONFORMING_SWPRINTFS
|
||||
_CRT_SECURE_NO_WARNINGS
|
||||
)
|
||||
|
||||
add_library(MinecraftWorld STATIC ${MINECRAFT_WORLD_SOURCES})
|
||||
target_include_directories(MinecraftWorld PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.World"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.World/x64headers"
|
||||
)
|
||||
target_compile_definitions(MinecraftWorld PRIVATE
|
||||
$<$<CONFIG:Debug>:_LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_DEBUG;_LIB;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64>
|
||||
$<$<NOT:$<CONFIG:Debug>>:_LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_LIB;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64>
|
||||
)
|
||||
if(MSVC)
|
||||
configure_msvc_target(MinecraftWorld)
|
||||
# Add platform-specific defines
|
||||
list(APPEND MINECRAFT_SHARED_DEFINES ${PLATFORM_DEFINES})
|
||||
|
||||
# ---
|
||||
# Sources
|
||||
# ---
|
||||
add_subdirectory(Minecraft.World)
|
||||
add_subdirectory(Minecraft.Client)
|
||||
if(PLATFORM_NAME STREQUAL "Windows64") # Server is only supported on Windows for now
|
||||
add_subdirectory(Minecraft.Server)
|
||||
endif()
|
||||
|
||||
add_executable(MinecraftClient WIN32 ${MINECRAFT_CLIENT_SOURCES})
|
||||
target_include_directories(MinecraftClient PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/Iggy/include"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Xbox/Sentient/Include"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.World/x64headers"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/"
|
||||
)
|
||||
target_compile_definitions(MinecraftClient PRIVATE
|
||||
$<$<CONFIG:Debug>:_LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_DEBUG;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64>
|
||||
$<$<NOT:$<CONFIG:Debug>>:_LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64>
|
||||
)
|
||||
if(MSVC)
|
||||
configure_msvc_target(MinecraftClient)
|
||||
target_link_options(MinecraftClient PRIVATE
|
||||
$<$<CONFIG:Release>:/LTCG /INCREMENTAL:NO>
|
||||
)
|
||||
endif()
|
||||
# ---
|
||||
# Build versioning
|
||||
# ---
|
||||
set(BUILDVER_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/cmake/GenerateBuildVer.cmake")
|
||||
set(BUILDVER_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/generated/Common/BuildVer.h")
|
||||
|
||||
set_target_properties(MinecraftClient PROPERTIES
|
||||
VS_DEBUGGER_WORKING_DIRECTORY "$<TARGET_FILE_DIR:MinecraftClient>"
|
||||
)
|
||||
|
||||
target_link_libraries(MinecraftClient PRIVATE
|
||||
MinecraftWorld
|
||||
d3d11
|
||||
XInput9_1_0
|
||||
wsock32
|
||||
legacy_stdio_definitions
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/Iggy/lib/iggy_w64.lib"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/Iggy/lib/iggyperfmon_w64.lib"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/Iggy/lib/iggyexpruntime_w64.lib"
|
||||
$<$<CONFIG:Debug>:
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Input_d.lib"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Storage_d.lib"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Render_PC_d.lib"
|
||||
>
|
||||
$<$<NOT:$<CONFIG:Debug>>:
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Input.lib"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Storage.lib"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Render_PC.lib"
|
||||
>
|
||||
)
|
||||
|
||||
set(MINECRAFT_SERVER_SOURCES ${MINECRAFT_CLIENT_SOURCES})
|
||||
list(APPEND MINECRAFT_SERVER_SOURCES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Windows64/ServerMain.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Access/Access.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Access/BanManager.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Access/WhitelistManager.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/ServerCli.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/ServerCliInput.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/ServerCliParser.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/ServerCliEngine.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/ServerCliRegistry.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/commands/ban/CliCommandBan.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/commands/ban-ip/CliCommandBanIp.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/commands/ban-list/CliCommandBanList.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/commands/help/CliCommandHelp.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/commands/pardon/CliCommandPardon.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/commands/pardon-ip/CliCommandPardonIp.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/commands/stop/CliCommandStop.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/commands/list/CliCommandList.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/commands/tp/CliCommandTp.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/commands/whitelist/CliCommandWhitelist.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/commands/gamemode/CliCommandGamemode.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/commands/time/CliCommandTime.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/commands/weather/CliCommandWeather.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/commands/give/CliCommandGive.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/commands/enchant/CliCommandEnchant.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/commands/kill/CliCommandKill.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/commands/defaultgamemode/CliCommandDefaultGamemode.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Console/commands/experience/CliCommandExperience.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Common/FileUtils.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Common/StringUtils.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/ServerLogger.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/ServerLogManager.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/ServerProperties.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/vendor/linenoise/linenoise.c"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/WorldManager.cpp"
|
||||
)
|
||||
|
||||
add_executable(MinecraftServer ${MINECRAFT_SERVER_SOURCES})
|
||||
target_include_directories(MinecraftServer PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/Iggy/include"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Xbox/Sentient/Include"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.World/x64headers"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Server/Windows64"
|
||||
)
|
||||
target_compile_definitions(MinecraftServer PRIVATE
|
||||
$<$<CONFIG:Debug>:_LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_DEBUG;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64;MINECRAFT_SERVER_BUILD>
|
||||
$<$<NOT:$<CONFIG:Debug>>:_LARGE_WORLDS;_DEBUG_MENUS_ENABLED;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_WINDOWS64;MINECRAFT_SERVER_BUILD>
|
||||
)
|
||||
if(MSVC)
|
||||
configure_msvc_target(MinecraftServer)
|
||||
target_link_options(MinecraftServer PRIVATE
|
||||
$<$<CONFIG:Release>:/LTCG /INCREMENTAL:NO>
|
||||
)
|
||||
endif()
|
||||
|
||||
set_target_properties(MinecraftServer PROPERTIES
|
||||
OUTPUT_NAME "Minecraft.Server"
|
||||
VS_DEBUGGER_WORKING_DIRECTORY "$<TARGET_FILE_DIR:MinecraftServer>"
|
||||
VS_DEBUGGER_COMMAND_ARGUMENTS "-port 25565 -bind 0.0.0.0 -name DedicatedServer"
|
||||
)
|
||||
|
||||
target_link_libraries(MinecraftServer PRIVATE
|
||||
MinecraftWorld
|
||||
d3d11
|
||||
XInput9_1_0
|
||||
wsock32
|
||||
legacy_stdio_definitions
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/Iggy/lib/iggy_w64.lib"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/Iggy/lib/iggyperfmon_w64.lib"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/Iggy/lib/iggyexpruntime_w64.lib"
|
||||
$<$<CONFIG:Debug>:
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Input_d.lib"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Storage_d.lib"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Render_PC_d.lib"
|
||||
>
|
||||
$<$<NOT:$<CONFIG:Debug>>:
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Input.lib"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Storage.lib"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/Windows64/4JLibs/libs/4J_Render_PC.lib"
|
||||
>
|
||||
)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
message(STATUS "Starting redist copy...")
|
||||
execute_process(
|
||||
COMMAND robocopy.exe
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/x64/Release"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
||||
/S /MT /R:0 /W:0 /NP
|
||||
)
|
||||
message(STATUS "Starting asset copy...")
|
||||
execute_process(
|
||||
COMMAND robocopy.exe
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
||||
/S /MT /R:0 /W:0 /NP
|
||||
/XF "*.cpp" "*.c" "*.h" "*.hpp" "*.asm"
|
||||
"*.xml" "*.lang" "*.vcxproj" "*.vcxproj.*" "*.sln"
|
||||
"*.docx" "*.xls"
|
||||
"*.bat" "*.cmd" "*.ps1" "*.py"
|
||||
"*Test*"
|
||||
/XD "Durango*" "Orbis*" "PS*" "Xbox"
|
||||
)
|
||||
message(STATUS "Patching Windows64Media...")
|
||||
execute_process(
|
||||
COMMAND robocopy.exe
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/DurangoMedia"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/Windows64Media"
|
||||
/S /MT /R:0 /W:0 /NP
|
||||
/XF "*.h" "*.xml" "*.lang" "*.bat"
|
||||
)
|
||||
elseif(CMAKE_HOST_UNIX)
|
||||
message(STATUS "Starting redist copy...")
|
||||
execute_process(
|
||||
COMMAND rsync -av "${CMAKE_CURRENT_SOURCE_DIR}/x64/Release/" "${CMAKE_CURRENT_BINARY_DIR}/"
|
||||
)
|
||||
message(STATUS "Starting asset copy...")
|
||||
execute_process(
|
||||
COMMAND rsync -av
|
||||
"--exclude=*.cpp" "--exclude=*.c" "--exclude=*.h" "--exclude=*.hpp" "--exclude=*.asm"
|
||||
"--exclude=*.xml" "--exclude=*.lang" "--exclude=*.vcxproj" "--exclude=*.vcxproj.*" "--exclude=*.sln"
|
||||
"--exclude=*.docx" "--exclude=*.xls"
|
||||
"--exclude=*.bat" "--exclude=*.cmd" "--exclude=*.ps1" "--exclude=*.py"
|
||||
"--exclude=*Test*"
|
||||
"--exclude=Durango*" "--exclude=Orbis*" "--exclude=PS*" "--exclude=Xbox"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/" "${CMAKE_CURRENT_BINARY_DIR}/"
|
||||
)
|
||||
message(STATUS "Patching Windows64Media...")
|
||||
execute_process(
|
||||
COMMAND rsync -av
|
||||
"--exclude=*.h" "--exclude=*.xml" "--exclude=*.lang" "--exclude=*.bat"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/Minecraft.Client/DurangoMedia/" "${CMAKE_CURRENT_BINARY_DIR}/Windows64Media/"
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR "Redist and asset copying is only supported on Windows (Robocopy) and Unix systems (rsync).")
|
||||
endif()
|
||||
|
||||
add_custom_command(TARGET MinecraftServer POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-DPROJECT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
-DOUTPUT_DIR="$<TARGET_FILE_DIR:MinecraftServer>"
|
||||
-DCONFIGURATION=$<CONFIG>
|
||||
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/CopyServerAssets.cmake"
|
||||
add_custom_target(GenerateBuildVer
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DOUTPUT_FILE=${BUILDVER_OUTPUT}"
|
||||
-P "${BUILDVER_SCRIPT}"
|
||||
COMMENT "Generating BuildVer.h..."
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT MinecraftServer)
|
||||
add_dependencies(Minecraft.World GenerateBuildVer)
|
||||
add_dependencies(Minecraft.Client GenerateBuildVer)
|
||||
if(PLATFORM_NAME STREQUAL "Windows64")
|
||||
add_dependencies(Minecraft.Server GenerateBuildVer)
|
||||
endif()
|
||||
|
||||
# ---
|
||||
# Project organisation
|
||||
# ---
|
||||
# Set the startup project for Visual Studio
|
||||
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT Minecraft.Client)
|
||||
|
||||
# Setup folders for Visual Studio, just hides the build targets under a sub folder
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
set_property(TARGET GenerateBuildVer PROPERTY FOLDER "Build")
|
||||
|
||||
Reference in New Issue
Block a user