[Build] Convert build system to raw cmake and remove premake layer
This commit is contained in:
115
src/xenia/app/CMakeLists.txt
Normal file
115
src/xenia/app/CMakeLists.txt
Normal file
@@ -0,0 +1,115 @@
|
||||
# src/xenia/app/CMakeLists.txt - Main xenia_canary executable.
|
||||
|
||||
if(WIN32)
|
||||
add_executable(xenia-app WIN32)
|
||||
else()
|
||||
add_executable(xenia-app)
|
||||
endif()
|
||||
|
||||
set_target_properties(xenia-app PROPERTIES OUTPUT_NAME "xenia_canary")
|
||||
|
||||
# Main source
|
||||
target_sources(xenia-app PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/xenia_main.cc
|
||||
)
|
||||
|
||||
# Other app sources (emulator_window, profile_dialogs, etc.)
|
||||
xe_platform_sources(xenia-app ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# Platform-specific entry points
|
||||
if(WIN32)
|
||||
target_sources(xenia-app PRIVATE
|
||||
${PROJECT_SOURCE_DIR}/src/xenia/base/main_init_win.cc
|
||||
${PROJECT_SOURCE_DIR}/src/xenia/ui/windowed_app_main_win.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/main_resources.rc
|
||||
${PROJECT_SOURCE_DIR}/src/xenia/base/app_win32.manifest
|
||||
)
|
||||
# main_init_win.cc needs SSE2 only (not AVX)
|
||||
set_source_files_properties(
|
||||
${PROJECT_SOURCE_DIR}/src/xenia/base/main_init_win.cc
|
||||
PROPERTIES COMPILE_OPTIONS "/arch:SSE2"
|
||||
)
|
||||
else()
|
||||
target_sources(xenia-app PRIVATE
|
||||
${PROJECT_SOURCE_DIR}/src/xenia/base/main_init_posix.cc
|
||||
${PROJECT_SOURCE_DIR}/src/xenia/ui/windowed_app_main_posix.cc
|
||||
)
|
||||
if(NOT MSVC)
|
||||
set_source_files_properties(
|
||||
${PROJECT_SOURCE_DIR}/src/xenia/base/main_init_posix.cc
|
||||
PROPERTIES COMPILE_OPTIONS "-msse2;-mno-avx"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_compile_definitions(xenia-app PRIVATE
|
||||
XBYAK_NO_OP_NAMES
|
||||
XBYAK_ENABLE_OMITTED_OPERAND
|
||||
)
|
||||
|
||||
# Core libraries (all platforms)
|
||||
target_link_libraries(xenia-app PRIVATE
|
||||
xenia-apu
|
||||
xenia-apu-nop
|
||||
xenia-base
|
||||
xenia-core
|
||||
xenia-cpu
|
||||
xenia-gpu
|
||||
xenia-gpu-null
|
||||
xenia-gpu-vulkan
|
||||
xenia-hid
|
||||
xenia-hid-nop
|
||||
xenia-kernel
|
||||
xenia-patcher
|
||||
xenia-ui
|
||||
xenia-ui-vulkan
|
||||
xenia-vfs
|
||||
# Third-party
|
||||
aes_128
|
||||
capstone
|
||||
fmt
|
||||
dxbc
|
||||
discord-rpc
|
||||
glslang-spirv
|
||||
imgui
|
||||
libavcodec
|
||||
libavutil
|
||||
mspack
|
||||
snappy
|
||||
xxhash
|
||||
)
|
||||
|
||||
# Non-Android specific (always true for Windows/Linux)
|
||||
target_link_libraries(xenia-app PRIVATE
|
||||
xenia-app-discord
|
||||
xenia-apu-sdl
|
||||
xenia-debug-ui
|
||||
xenia-helper-sdl
|
||||
xenia-hid-sdl
|
||||
)
|
||||
|
||||
# x64 backend
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
|
||||
target_link_libraries(xenia-app PRIVATE xenia-cpu-backend-x64)
|
||||
endif()
|
||||
|
||||
# Platform-specific libraries
|
||||
if(WIN32)
|
||||
target_link_libraries(xenia-app PRIVATE
|
||||
xenia-apu-xaudio2
|
||||
xenia-gpu-d3d12
|
||||
xenia-hid-winkey
|
||||
xenia-hid-xinput
|
||||
xenia-ui-d3d12
|
||||
)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
target_link_libraries(xenia-app PRIVATE
|
||||
xenia-apu-alsa
|
||||
X11
|
||||
xcb
|
||||
X11-xcb
|
||||
SDL2
|
||||
)
|
||||
endif()
|
||||
|
||||
xe_target_defaults(xenia-app)
|
||||
9
src/xenia/app/discord/CMakeLists.txt
Normal file
9
src/xenia/app/discord/CMakeLists.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
add_library(xenia-app-discord STATIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/discord_presence.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/discord_presence.h
|
||||
)
|
||||
target_include_directories(xenia-app-discord PRIVATE
|
||||
${PROJECT_SOURCE_DIR}/third_party/discord-rpc/src
|
||||
)
|
||||
target_link_libraries(xenia-app-discord PUBLIC discord-rpc)
|
||||
xe_target_defaults(xenia-app-discord)
|
||||
@@ -1,18 +0,0 @@
|
||||
project_root = "../../../.."
|
||||
include(project_root.."/tools/build")
|
||||
|
||||
group("src")
|
||||
project("xenia-app-discord")
|
||||
uuid("d14c0885-22d2-40de-ab28-7b234ef2b949")
|
||||
kind("StaticLib")
|
||||
language("C++")
|
||||
links({
|
||||
"discord-rpc"
|
||||
})
|
||||
includedirs({
|
||||
project_root.."/third_party/discord-rpc/src"
|
||||
})
|
||||
files({
|
||||
"discord_presence.cc",
|
||||
"discord_presence.h"
|
||||
})
|
||||
@@ -1,133 +0,0 @@
|
||||
project_root = "../../.."
|
||||
include(project_root.."/tools/build")
|
||||
|
||||
group("src")
|
||||
project("xenia-app")
|
||||
uuid("d7e98620-d007-4ad8-9dbd-b47c8853a17f")
|
||||
language("C++")
|
||||
links({
|
||||
"xenia-apu",
|
||||
"xenia-apu-nop",
|
||||
"xenia-base",
|
||||
"xenia-core",
|
||||
"xenia-cpu",
|
||||
"xenia-gpu",
|
||||
"xenia-gpu-null",
|
||||
"xenia-gpu-vulkan",
|
||||
"xenia-hid",
|
||||
"xenia-hid-nop",
|
||||
"xenia-kernel",
|
||||
"xenia-patcher",
|
||||
"xenia-ui",
|
||||
"xenia-ui-vulkan",
|
||||
"xenia-vfs",
|
||||
})
|
||||
links({
|
||||
"aes_128",
|
||||
"capstone",
|
||||
"fmt",
|
||||
"dxbc",
|
||||
"discord-rpc",
|
||||
"glslang-spirv",
|
||||
"imgui",
|
||||
"libavcodec",
|
||||
"libavutil",
|
||||
"mspack",
|
||||
"snappy",
|
||||
"xxhash",
|
||||
})
|
||||
defines({
|
||||
"XBYAK_NO_OP_NAMES",
|
||||
"XBYAK_ENABLE_OMITTED_OPERAND",
|
||||
})
|
||||
local_platform_files()
|
||||
files({
|
||||
"../base/main_init_"..platform_suffix..".cc",
|
||||
"../ui/windowed_app_main_"..platform_suffix..".cc",
|
||||
})
|
||||
|
||||
resincludedirs({
|
||||
project_root,
|
||||
})
|
||||
|
||||
filter(SINGLE_LIBRARY_FILTER)
|
||||
-- Unified library containing all apps as StaticLibs, not just the main
|
||||
-- emulator windowed app.
|
||||
kind("SharedLib")
|
||||
if enableMiscSubprojects then
|
||||
links({
|
||||
"xenia-gpu-vulkan-trace-viewer",
|
||||
"xenia-hid-demo",
|
||||
"xenia-ui-window-vulkan-demo",
|
||||
})
|
||||
end
|
||||
filter(NOT_SINGLE_LIBRARY_FILTER)
|
||||
kind("WindowedApp")
|
||||
|
||||
-- `targetname` is broken if building from Gradle, works only for toggling the
|
||||
-- `lib` prefix, as Gradle uses LOCAL_MODULE_FILENAME, not a derivative of
|
||||
-- LOCAL_MODULE, to specify the targets to build when executing ndk-build.
|
||||
filter("platforms:not Android-*")
|
||||
targetname("xenia_canary")
|
||||
|
||||
filter("architecture:x86_64")
|
||||
links({
|
||||
"xenia-cpu-backend-x64",
|
||||
})
|
||||
|
||||
-- TODO(Triang3l): The emulator itself on Android.
|
||||
filter("platforms:not Android-*")
|
||||
files({
|
||||
"xenia_main.cc",
|
||||
})
|
||||
|
||||
filter("platforms:Windows")
|
||||
files({
|
||||
"main_resources.rc",
|
||||
})
|
||||
|
||||
filter({"architecture:x86_64", "files:../base/main_init_"..platform_suffix..".cc"})
|
||||
vectorextensions("SSE2") -- Disable AVX for main_init_win.cc so our AVX check doesn't use AVX instructions.
|
||||
|
||||
filter("platforms:not Android-*")
|
||||
links({
|
||||
"xenia-app-discord",
|
||||
"xenia-apu-sdl",
|
||||
-- TODO(Triang3l): CPU debugger on Android.
|
||||
"xenia-debug-ui",
|
||||
"xenia-helper-sdl",
|
||||
"xenia-hid-sdl",
|
||||
})
|
||||
|
||||
filter("platforms:Linux")
|
||||
links({
|
||||
"xenia-apu-alsa",
|
||||
"X11",
|
||||
"xcb",
|
||||
"X11-xcb",
|
||||
"SDL2",
|
||||
})
|
||||
|
||||
filter("platforms:Windows")
|
||||
links({
|
||||
"xenia-apu-xaudio2",
|
||||
"xenia-gpu-d3d12",
|
||||
"xenia-hid-winkey",
|
||||
"xenia-hid-xinput",
|
||||
"xenia-ui-d3d12",
|
||||
})
|
||||
|
||||
if enableMiscSubprojects then
|
||||
filter({"platforms:Windows", SINGLE_LIBRARY_FILTER})
|
||||
links({
|
||||
"xenia-gpu-d3d12-trace-viewer",
|
||||
"xenia-ui-window-d3d12-demo",
|
||||
})
|
||||
end
|
||||
|
||||
filter("platforms:Windows")
|
||||
-- Only create the .user file if it doesn't already exist.
|
||||
local user_file = project_root.."/build/xenia-app.vcxproj.user"
|
||||
if not os.isfile(user_file) then
|
||||
debugdir(project_root)
|
||||
end
|
||||
Reference in New Issue
Block a user