diff --git a/CMakePresets.json b/CMakePresets.json index 6aab713f9..75ba6b4f5 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -12,7 +12,8 @@ "displayName": "Windows64", "inherits": "base", "cacheVariables": { - "PLATFORM_DEFINES": "_WINDOWS64" + "PLATFORM_DEFINES": "_WINDOWS64", + "PLATFORM_FOLDER": "Windows64" } }, { @@ -21,7 +22,8 @@ "inherits": "base", "toolchainFile": "${sourceDir}/cmake/toolchains/durango.cmake", "cacheVariables": { - "PLATFORM_DEFINES": "_DURANGO;_XBOX_ONE" + "PLATFORM_DEFINES": "_DURANGO;_XBOX_ONE", + "PLATFORM_FOLDER": "Durango" } }, { @@ -30,7 +32,8 @@ "inherits": "base", "toolchainFile": "${sourceDir}/cmake/toolchains/orbis.cmake", "cacheVariables": { - "PLATFORM_DEFINES": "__ORBIS__" + "PLATFORM_DEFINES": "__ORBIS__", + "PLATFORM_FOLDER": "Orbis" } }, { @@ -39,7 +42,8 @@ "inherits": "base", "toolchainFile": "${sourceDir}/cmake/toolchains/ps3.cmake", "cacheVariables": { - "PLATFORM_DEFINES": "__PS3__" + "PLATFORM_DEFINES": "__PS3__", + "PLATFORM_FOLDER": "PS3" } }, { @@ -48,7 +52,8 @@ "inherits": "base", "toolchainFile": "${sourceDir}/cmake/toolchains/psvita.cmake", "cacheVariables": { - "PLATFORM_DEFINES": "__PSVITA__" + "PLATFORM_DEFINES": "__PSVITA__", + "PLATFORM_FOLDER": "PSVita" } }, { @@ -57,7 +62,8 @@ "inherits": "base", "toolchainFile": "${sourceDir}/cmake/toolchains/xbox360.cmake", "cacheVariables": { - "PLATFORM_DEFINES": "_XBOX" + "PLATFORM_DEFINES": "_XBOX", + "PLATFORM_FOLDER": "Xbox" } } ], diff --git a/Minecraft.Client/CMakeLists.txt b/Minecraft.Client/CMakeLists.txt index d883fedd8..b21538da3 100644 --- a/Minecraft.Client/CMakeLists.txt +++ b/Minecraft.Client/CMakeLists.txt @@ -9,15 +9,15 @@ include("${CMAKE_CURRENT_LIST_DIR}/cmake/sources/Xbox360.cmake") include("${CMAKE_SOURCE_DIR}/cmake/CommonSources.cmake") # Combine all source files into a single variable for the target -# TODO Add conditions to include sources for the current platform +# We cant use CMAKE_CONFIGURE_PRESET here as VS doesn't set it, so just rely on the folder set(MINECRAFT_CLIENT_SOURCES ${MINECRAFT_CLIENT_COMMON} - # ${MINECRAFT_CLIENT_DURANGO} - # ${MINECRAFT_CLIENT_ORBIS} - # ${MINECRAFT_CLIENT_PS3} - # ${MINECRAFT_CLIENT_PSVITA} - ${MINECRAFT_CLIENT_WINDOWS} - # ${MINECRAFT_CLIENT_XBOX360} + $<$:${MINECRAFT_CLIENT_DURANGO}> + $<$:${MINECRAFT_CLIENT_ORBIS}> + $<$:${MINECRAFT_CLIENT_PS3}> + $<$:${MINECRAFT_CLIENT_PSVITA}> + $<$:${MINECRAFT_CLIENT_WINDOWS}> + $<$:${MINECRAFT_CLIENT_XBOX360}> ${SOURCES_COMMON} ) @@ -26,7 +26,7 @@ add_executable(Minecraft.Client WIN32 ${MINECRAFT_CLIENT_SOURCES}) target_include_directories(Minecraft.Client PRIVATE "${CMAKE_BINARY_DIR}/generated/" # This is for the generated BuildVer.h "${CMAKE_CURRENT_SOURCE_DIR}" - "${CMAKE_CURRENT_SOURCE_DIR}/Windows64/Iggy/include" + "${CMAKE_CURRENT_SOURCE_DIR}/${PLATFORM_FOLDER}/Iggy/include" "${CMAKE_SOURCE_DIR}/include/" ) target_compile_definitions(Minecraft.Client PRIVATE @@ -52,18 +52,18 @@ target_link_libraries(Minecraft.Client PRIVATE XInput9_1_0 wsock32 legacy_stdio_definitions - "${CMAKE_CURRENT_SOURCE_DIR}/Windows64/Iggy/lib/iggy_w64.lib" - "${CMAKE_CURRENT_SOURCE_DIR}/Windows64/Iggy/lib/iggyperfmon_w64.lib" - "${CMAKE_CURRENT_SOURCE_DIR}/Windows64/Iggy/lib/iggyexpruntime_w64.lib" + "${CMAKE_CURRENT_SOURCE_DIR}/${PLATFORM_FOLDER}/Iggy/lib/iggy_w64.lib" + "${CMAKE_CURRENT_SOURCE_DIR}/${PLATFORM_FOLDER}/Iggy/lib/iggyperfmon_w64.lib" + "${CMAKE_CURRENT_SOURCE_DIR}/${PLATFORM_FOLDER}/Iggy/lib/iggyexpruntime_w64.lib" $<$: # Debug 4J libraries - "${CMAKE_CURRENT_SOURCE_DIR}/Windows64/4JLibs/libs/4J_Input_d.lib" - "${CMAKE_CURRENT_SOURCE_DIR}/Windows64/4JLibs/libs/4J_Storage_d.lib" - "${CMAKE_CURRENT_SOURCE_DIR}/Windows64/4JLibs/libs/4J_Render_PC_d.lib" + "${CMAKE_CURRENT_SOURCE_DIR}/${PLATFORM_FOLDER}/4JLibs/libs/4J_Input_d.lib" + "${CMAKE_CURRENT_SOURCE_DIR}/${PLATFORM_FOLDER}/4JLibs/libs/4J_Storage_d.lib" + "${CMAKE_CURRENT_SOURCE_DIR}/${PLATFORM_FOLDER}/4JLibs/libs/4J_Render_PC_d.lib" > $<$>: # Release 4J libraries - "${CMAKE_CURRENT_SOURCE_DIR}/Windows64/4JLibs/libs/4J_Input.lib" - "${CMAKE_CURRENT_SOURCE_DIR}/Windows64/4JLibs/libs/4J_Storage.lib" - "${CMAKE_CURRENT_SOURCE_DIR}/Windows64/4JLibs/libs/4J_Render_PC.lib" + "${CMAKE_CURRENT_SOURCE_DIR}/${PLATFORM_FOLDER}/4JLibs/libs/4J_Input.lib" + "${CMAKE_CURRENT_SOURCE_DIR}/${PLATFORM_FOLDER}/4JLibs/libs/4J_Storage.lib" + "${CMAKE_CURRENT_SOURCE_DIR}/${PLATFORM_FOLDER}/4JLibs/libs/4J_Render_PC.lib" > ) @@ -86,13 +86,15 @@ add_custom_target(CopyRedist ALL add_dependencies(Minecraft.Client CopyRedist) set_property(TARGET CopyRedist PROPERTY FOLDER "Build") -# Make sure GameHDD exists -add_custom_target(EnsureGameHDD ALL - COMMAND ${CMAKE_COMMAND} - -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/$/Windows64/GameHDD" - COMMENT "Ensuring GameHDD directory exists..." - VERBATIM -) +# Make sure GameHDD exists on Windows +if(CMAKE_CONFIGURE_PRESET STREQUAL "windows64") + add_custom_target(EnsureGameHDD ALL + COMMAND ${CMAKE_COMMAND} + -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/$/Windows64/GameHDD" + COMMENT "Ensuring GameHDD directory exists..." + VERBATIM + ) -add_dependencies(Minecraft.Client EnsureGameHDD) -set_property(TARGET EnsureGameHDD PROPERTY FOLDER "Build") + add_dependencies(Minecraft.Client EnsureGameHDD) + set_property(TARGET EnsureGameHDD PROPERTY FOLDER "Build") +endif() diff --git a/Minecraft.Client/compile_flags.txt b/Minecraft.Client/compile_flags.txt deleted file mode 100644 index 5aa08a435..000000000 --- a/Minecraft.Client/compile_flags.txt +++ /dev/null @@ -1,22 +0,0 @@ --xc++ --m64 --std=c++14 --Wno-unused-includes --Wno-unsafe-buffer-usage-in-libc-call --Wno-unsafe-buffer-usage --Wno-unused-macros --Wno-c++98-compat --Wno-c++98-compat-pedantic --Wno-pre-c++14-compat --D_LARGE_WORLDS --D_DEBUG_MENUS_ENABLED --D_LIB --D_CRT_NON_CONFORMING_SWPRINTFS --D_CRT_SECURE_NO_WARNINGS --D_WINDOWS64 --I -./Xbox/Sentient/Include --I -../Minecraft.World/x64headers --I -./ diff --git a/Minecraft.World/CMakeLists.txt b/Minecraft.World/CMakeLists.txt index d2f1d45f1..0686f2fc8 100644 --- a/Minecraft.World/CMakeLists.txt +++ b/Minecraft.World/CMakeLists.txt @@ -4,10 +4,10 @@ include("${CMAKE_CURRENT_LIST_DIR}/cmake/sources/Durango.cmake") include("${CMAKE_SOURCE_DIR}/cmake/CommonSources.cmake") # Combine all source files into a single variable for the target -# TODO Add conditions to include sources for the current platform +# We cant use CMAKE_CONFIGURE_PRESET here as VS doesn't set it, so just rely on the folder set(MINECRAFT_WORLD_SOURCES ${MINECRAFT_WORLD_COMMON} - # ${MINECRAFT_WORLD_DURANGO} + $<$:${MINECRAFT_WORLD_DURANGO}> ${SOURCES_COMMON} ) diff --git a/Minecraft.World/compile_flags.txt b/Minecraft.World/compile_flags.txt deleted file mode 100644 index 57863c770..000000000 --- a/Minecraft.World/compile_flags.txt +++ /dev/null @@ -1,18 +0,0 @@ --xc++ --m64 --std=c++14 --Wno-unused-includes --Wno-unsafe-buffer-usage-in-libc-call --Wno-unsafe-buffer-usage --Wno-unused-macros --Wno-c++98-compat --Wno-c++98-compat-pedantic --Wno-pre-c++14-compat --D_LARGE_WORLDS --D_DEBUG_MENUS_ENABLED --D_LIB --D_CRT_NON_CONFORMING_SWPRINTFS --D_CRT_SECURE_NO_WARNINGS --D_WINDOWS64 --I -./x64headers \ No newline at end of file