Initial Linux attempt.

This commit is contained in:
Skyth 2024-12-12 23:04:59 +03:00
parent 27eab0af66
commit d29049dcb1
5 changed files with 97 additions and 37 deletions

View file

@ -45,6 +45,38 @@
"cacheVariables": { "cacheVariables": {
"CMAKE_BUILD_TYPE": "Release" "CMAKE_BUILD_TYPE": "Release"
} }
},
{
"name": "linux-debug",
"displayName": "Linux Debug",
"description": "Target the Windows Subsystem for Linux (WSL) or a remote Linux system.",
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_TOOLCHAIN_FILE": {
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"type": "FILEPATH"
},
"VCPKG_TARGET_TRIPLET": {
"value": "x64-linux",
"type": "STRING"
}
},
"environment": {
"VCPKG_ROOT": "~/vcpkg"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"vendor": {
"microsoft.com/VisualStudioRemoteSettings/CMake/2.0": {
"remoteSourceRootDir": "$env{HOME}/.vs/$ms{projectDirName}"
}
}
} }
] ]
} }

View file

@ -90,10 +90,15 @@ set(SWA_GPU_CXX_SOURCES
"gpu/imgui/imgui_common.cpp" "gpu/imgui/imgui_common.cpp"
"gpu/imgui/imgui_font_builder.cpp" "gpu/imgui/imgui_font_builder.cpp"
"gpu/imgui/imgui_snapshot.cpp" "gpu/imgui/imgui_snapshot.cpp"
"gpu/rhi/plume_d3d12.cpp"
"gpu/rhi/plume_vulkan.cpp" "gpu/rhi/plume_vulkan.cpp"
) )
if (WIN32)
list(APPEND SWA_GPU_CXX_SOURCES
"gpu/rhi/plume_d3d12.cpp"
)
endif()
set(SWA_APU_CXX_SOURCES set(SWA_APU_CXX_SOURCES
"apu/audio.cpp" "apu/audio.cpp"
"apu/embedded_player.cpp" "apu/embedded_player.cpp"
@ -204,9 +209,12 @@ endif()
set_target_properties(UnleashedRecomp PROPERTIES OUTPUT_NAME ${TARGET_NAME}) set_target_properties(UnleashedRecomp PROPERTIES OUTPUT_NAME ${TARGET_NAME})
if (WIN32)
find_package(directx-headers CONFIG REQUIRED) find_package(directx-headers CONFIG REQUIRED)
find_package(directx12-agility CONFIG REQUIRED) find_package(directx12-agility CONFIG REQUIRED)
find_package(d3d12-memory-allocator CONFIG REQUIRED) find_package(d3d12-memory-allocator CONFIG REQUIRED)
endif()
find_package(SDL2 CONFIG REQUIRED) find_package(SDL2 CONFIG REQUIRED)
find_package(unordered_dense CONFIG REQUIRED) find_package(unordered_dense CONFIG REQUIRED)
find_package(VulkanHeaders CONFIG) find_package(VulkanHeaders CONFIG)
@ -225,6 +233,7 @@ find_package(unofficial-tiny-aes-c CONFIG REQUIRED)
find_package(nfd CONFIG REQUIRED) find_package(nfd CONFIG REQUIRED)
find_package(Vorbis CONFIG REQUIRED) find_package(Vorbis CONFIG REQUIRED)
if (WIN32)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/D3D12) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/D3D12)
add_custom_command(TARGET UnleashedRecomp POST_BUILD add_custom_command(TARGET UnleashedRecomp POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_PROPERTY:Microsoft::DirectX12-Core,IMPORTED_LOCATION_RELEASE> ${CMAKE_CURRENT_BINARY_DIR}/D3D12 COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_PROPERTY:Microsoft::DirectX12-Core,IMPORTED_LOCATION_RELEASE> ${CMAKE_CURRENT_BINARY_DIR}/D3D12
@ -239,25 +248,29 @@ target_link_libraries(UnleashedRecomp PRIVATE
Microsoft::DirectX-Guids Microsoft::DirectX-Guids
Microsoft::DirectX12-Agility Microsoft::DirectX12-Agility
Microsoft::DirectXShaderCompiler Microsoft::DirectXShaderCompiler
unofficial::D3D12MemoryAllocator
comctl32 comctl32
dxgi dxgi
ntdll
winmm
Synchronization
)
endif()
target_link_libraries(UnleashedRecomp PRIVATE
Vulkan::Headers Vulkan::Headers
volk::volk volk::volk
volk::volk_headers volk::volk_headers
GPUOpen::VulkanMemoryAllocator GPUOpen::VulkanMemoryAllocator
ntdll
o1heap o1heap
PowerUtils PowerUtils
SDL2::SDL2-static SDL2::SDL2-static
UnleashedRecompLib UnleashedRecompLib
unofficial::D3D12MemoryAllocator
unordered_dense::unordered_dense unordered_dense::unordered_dense
winmm
xxHash::xxhash xxHash::xxhash
PkgConfig::tomlplusplus PkgConfig::tomlplusplus
zstd::libzstd_static zstd::libzstd_static
unofficial::concurrentqueue::concurrentqueue unofficial::concurrentqueue::concurrentqueue
Synchronization
imgui::imgui imgui::imgui
magic_enum::magic_enum magic_enum::magic_enum
unofficial::tiny-aes-c::tiny-aes-c unofficial::tiny-aes-c::tiny-aes-c
@ -283,17 +296,20 @@ target_precompile_headers(UnleashedRecomp PUBLIC ${SWA_PRECOMPILED_HEADERS})
function(compile_shader FILE_PATH TARGET_NAME) function(compile_shader FILE_PATH TARGET_NAME)
set(FILE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/gpu/shader/${FILE_PATH}.hlsl) set(FILE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/gpu/shader/${FILE_PATH}.hlsl)
cmake_path(GET FILE_PATH STEM VARIABLE_NAME) cmake_path(GET FILE_PATH STEM VARIABLE_NAME)
if (WIN32)
add_custom_command( add_custom_command(
OUTPUT ${FILE_PATH}.dxil.h OUTPUT ${FILE_PATH}.dxil.h
COMMAND ${DIRECTX_DXC_TOOL} -T ${TARGET_NAME} -HV 2021 -all-resources-bound -Wno-ignored-attributes -Fh ${FILE_PATH}.dxil.h ${FILE_PATH} -Vn g_${VARIABLE_NAME}_dxil COMMAND ${DIRECTX_DXC_TOOL} -T ${TARGET_NAME} -HV 2021 -all-resources-bound -Wno-ignored-attributes -Fh ${FILE_PATH}.dxil.h ${FILE_PATH} -Vn g_${VARIABLE_NAME}_dxil
DEPENDS ${FILE_PATH} DEPENDS ${FILE_PATH}
) )
target_sources(UnleashedRecomp PRIVATE ${FILE_PATH}.dxil.h)
endif()
add_custom_command( add_custom_command(
OUTPUT ${FILE_PATH}.spirv.h OUTPUT ${FILE_PATH}.spirv.h
COMMAND ${DIRECTX_DXC_TOOL} -T ${TARGET_NAME} -HV 2021 -all-resources-bound -spirv -fvk-use-dx-layout ${ARGN} -Fh ${FILE_PATH}.spirv.h ${FILE_PATH} -Vn g_${VARIABLE_NAME}_spirv COMMAND ${DIRECTX_DXC_TOOL} -T ${TARGET_NAME} -HV 2021 -all-resources-bound -spirv -fvk-use-dx-layout ${ARGN} -Fh ${FILE_PATH}.spirv.h ${FILE_PATH} -Vn g_${VARIABLE_NAME}_spirv
DEPENDS ${FILE_PATH} DEPENDS ${FILE_PATH}
) )
target_sources(UnleashedRecomp PRIVATE ${FILE_PATH}.dxil.h ${FILE_PATH}.spirv.h) target_sources(UnleashedRecomp PRIVATE ${FILE_PATH}.spirv.h)
endfunction() endfunction()
function(compile_vertex_shader FILE_PATH) function(compile_vertex_shader FILE_PATH)

@ -1 +1 @@
Subproject commit f936ed2212d8291439003eb0c0d8edc0ecafd24d Subproject commit 5eaf542426992cec9b98ab14a1c46c85d4ad3120

View file

@ -2,6 +2,6 @@ project("fshasher")
add_executable(fshasher "fshasher.cpp") add_executable(fshasher "fshasher.cpp")
find_package(xxhash CONFIG REQUIRED) find_package(xxHash CONFIG REQUIRED)
target_link_libraries(fshasher PRIVATE xxHash::xxhash) target_link_libraries(fshasher PRIVATE xxHash::xxhash)

View file

@ -1,9 +1,26 @@
{ {
"builtin-baseline": "e63bd09dc0b7204467705c1c7c71d0e2a3f8860b", "builtin-baseline": "e63bd09dc0b7204467705c1c7c71d0e2a3f8860b",
"dependencies": [ "dependencies": [
"directx-headers", {
"directx12-agility", "name": "directx-headers",
"d3d12-memory-allocator", "platform": "windows"
},
{
"name": "directx12-agility",
"platform": "windows"
},
{
"name": "d3d12-memory-allocator",
"platform": "windows"
},
{
"name": "pkgconf",
"platform": "windows"
},
{
"name": "imgui",
"features": [ "sdl2-binding" ]
},
"directx-dxc", "directx-dxc",
"sdl2", "sdl2",
"unordered-dense", "unordered-dense",
@ -11,16 +28,11 @@
"vulkan-headers", "vulkan-headers",
"vulkan-memory-allocator", "vulkan-memory-allocator",
"xxhash", "xxhash",
"pkgconf",
"tomlplusplus", "tomlplusplus",
"zstd", "zstd",
"stb", "stb",
"concurrentqueue", "concurrentqueue",
"tiny-aes-c", "tiny-aes-c",
{
"name": "imgui",
"features": [ "sdl2-binding" ]
},
"magic-enum", "magic-enum",
"nativefiledialog-extended", "nativefiledialog-extended",
"freetype", "freetype",