2022-05-15 02:06:02 +02:00
|
|
|
# SPDX-FileCopyrightText: 2018 yuzu Emulator Project
|
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
2021-08-08 17:34:43 +02:00
|
|
|
# Credits to Samantas5855 and others for this function.
|
2021-02-14 00:20:41 -08:00
|
|
|
function(create_resource file output filename)
|
|
|
|
|
# Read hex data from file
|
|
|
|
|
file(READ ${file} filedata HEX)
|
|
|
|
|
# Convert hex data for C compatibility
|
|
|
|
|
string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," filedata ${filedata})
|
|
|
|
|
# Write data to output file
|
|
|
|
|
set(RESOURCES_DIR "${PROJECT_BINARY_DIR}/dist" PARENT_SCOPE)
|
|
|
|
|
file(WRITE "${PROJECT_BINARY_DIR}/dist/${output}" "const unsigned char ${filename}[] = {${filedata}};\nconst unsigned ${filename}_size = sizeof(${filename});\n")
|
|
|
|
|
endfunction()
|
|
|
|
|
|
2018-01-17 19:37:34 -05:00
|
|
|
add_executable(yuzu-cmd
|
|
|
|
|
emu_window/emu_window_sdl2.cpp
|
|
|
|
|
emu_window/emu_window_sdl2.h
|
2020-01-21 16:40:53 -03:00
|
|
|
emu_window/emu_window_sdl2_gl.cpp
|
|
|
|
|
emu_window/emu_window_sdl2_gl.h
|
2022-11-27 20:37:37 -05:00
|
|
|
emu_window/emu_window_sdl2_null.cpp
|
|
|
|
|
emu_window/emu_window_sdl2_null.h
|
2020-12-24 20:22:07 -03:00
|
|
|
emu_window/emu_window_sdl2_vk.cpp
|
|
|
|
|
emu_window/emu_window_sdl2_vk.h
|
2022-11-22 18:38:23 -05:00
|
|
|
precompiled_headers.h
|
2023-11-12 02:03:01 -05:00
|
|
|
sdl_config.cpp
|
|
|
|
|
sdl_config.h
|
2018-01-17 19:37:34 -05:00
|
|
|
yuzu.cpp
|
|
|
|
|
yuzu.rc
|
|
|
|
|
)
|
2014-08-23 22:22:05 -03:00
|
|
|
|
2023-11-12 02:03:01 -05:00
|
|
|
target_link_libraries(yuzu-cmd PRIVATE common core input_common frontend_common)
|
2023-11-12 02:03:55 -05:00
|
|
|
target_link_libraries(yuzu-cmd PRIVATE glad)
|
2015-06-22 20:59:00 -04:00
|
|
|
if (MSVC)
|
2018-01-11 19:21:20 -07:00
|
|
|
target_link_libraries(yuzu-cmd PRIVATE getopt)
|
2015-06-22 20:59:00 -04:00
|
|
|
endif()
|
2022-12-04 10:59:58 -05:00
|
|
|
target_link_libraries(yuzu-cmd PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
|
2014-04-30 16:56:25 -07:00
|
|
|
|
2021-02-14 00:20:41 -08:00
|
|
|
create_resource("../../dist/yuzu.bmp" "yuzu_cmd/yuzu_icon.h" "yuzu_icon")
|
|
|
|
|
target_include_directories(yuzu-cmd PRIVATE ${RESOURCES_DIR})
|
|
|
|
|
|
2022-12-06 00:44:52 +01:00
|
|
|
target_link_libraries(yuzu-cmd PRIVATE SDL2::SDL2 Vulkan::Headers)
|
2021-07-15 21:02:00 -04:00
|
|
|
|
2025-07-23 10:00:29 +02:00
|
|
|
# In Solaris needs explicit linking for ffmpeg which links to /lib/amd64/libX11.so
|
2025-08-19 21:29:36 +02:00
|
|
|
if (PLATFORM_SUN)
|
2025-08-20 00:21:16 +02:00
|
|
|
target_link_libraries(yuzu-cmd PRIVATE X11 "/usr/lib/xorg/amd64/libdrm.so")
|
2025-07-23 10:00:29 +02:00
|
|
|
endif()
|
|
|
|
|
|
2016-10-10 05:58:05 +00:00
|
|
|
if(UNIX AND NOT APPLE)
|
2022-03-27 15:09:03 +02:00
|
|
|
install(TARGETS yuzu-cmd)
|
2015-08-30 03:37:42 -03:00
|
|
|
endif()
|
2016-03-01 17:24:18 +00:00
|
|
|
|
2022-12-24 03:39:59 +01:00
|
|
|
if(WIN32)
|
|
|
|
|
# compile as a win32 gui application instead of a console application
|
|
|
|
|
if(MSVC)
|
|
|
|
|
set_target_properties(yuzu-cmd PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup")
|
|
|
|
|
elseif(MINGW)
|
|
|
|
|
set_target_properties(yuzu-cmd PROPERTIES LINK_FLAGS_RELEASE "-Wl,--subsystem,windows")
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
2016-03-01 17:24:18 +00:00
|
|
|
if (MSVC)
|
2018-01-13 23:49:16 +00:00
|
|
|
include(CopyYuzuSDLDeps)
|
|
|
|
|
copy_yuzu_SDL_deps(yuzu-cmd)
|
2016-03-01 17:24:18 +00:00
|
|
|
endif()
|
2022-11-22 18:38:23 -05:00
|
|
|
|
|
|
|
|
if (YUZU_USE_PRECOMPILED_HEADERS)
|
|
|
|
|
target_precompile_headers(yuzu-cmd PRIVATE precompiled_headers.h)
|
|
|
|
|
endif()
|
2024-01-26 15:29:04 +00:00
|
|
|
|
|
|
|
|
create_target_directory_groups(yuzu-cmd)
|