mirror of
https://github.com/ahmedbarakat2007/rpcs3-for-andstation3.git
synced 2024-11-27 00:50:24 +00:00
CMake: Refactor CMake build (#5032)
* CMake: Refactor build to multiple libraries - Refactor CMake build system by creating separate libraries for different components - Create interface libraries for most dependencies and add 3rdparty::* ALIAS targets for ease of use and use them to try specifying correct dependencies for each target - Prefer 3rdparty:: ALIAS when linking dependencies - Exclude xxHash subdirectory from ALL build target - Add USE_SYSTEM_ZLIB option to select between using included ZLib and the ZLib in CMake search path * Add cstring include to Log.cpp * CMake: Add 3rdparty::glew interface target * Add Visual Studio CMakeSettings.json to gitignore * CMake: Move building and finding LLVM to 3rdparty/llvm.cmake script - LLVM is now built under 3rdparty/ directory in the binary directory * CMake: Move finding Qt5 to 3rdparty/qt5.cmake script - Script has to be included in rpcs3/CMakeLists.txt because it defines Qt5::moc target which isn't available in that folder if it is included in 3rdparty directory - Set AUTOMOC and AUTOUIC properties for targets requiring them (rpcs3 and rpcs3_ui) instead of setting CMAKE_AUTOMOC and CMAKE_AUTOUIC so those properties are not defined for all targets under rpcs3 dir * CMake: Remove redundant code from rpcs3/CMakeLists.txt * CMake: Add BUILD_LLVM_SUBMODULE option instead of hardcoded check - Add BUILD_LLVM_SUBMODULE option (defaults to ON) to allow controlling usage of the LLVM submodule. - Move option definitions to root CMakeLists * CMake: Remove separate Emu subtargets - Based on discussion in pull request #5032, I decided to combine subtargets under Emu folder back to a single rpcs3_emu target * CMake: Remove utilities, loader and crypto targets: merge them to Emu - Removed separate targets and merged them into rpcs3_emu target as recommended in pull request (#5032) conversations. Separating targets probably later in a separate pull request * Fix relative includes in pad_thread.cpp * Fix Travis-CI cloning all submodules needlessly
This commit is contained in:
parent
e37da61a1c
commit
7aef811ff7
4
.gitignore
vendored
4
.gitignore
vendored
@ -59,6 +59,7 @@
|
||||
*.VC.*
|
||||
*.vcxproj.user
|
||||
enc_temp_folder/*
|
||||
CMakeSettings.json
|
||||
|
||||
# Ignore other system generated files
|
||||
x64/*
|
||||
@ -85,3 +86,6 @@ qrc_*.cpp
|
||||
rpcs3_automoc.cpp
|
||||
ui_*.h
|
||||
rpcs3/rpcs3_autogen/*
|
||||
|
||||
# QtCreator
|
||||
CMakeLists.txt.user
|
||||
|
@ -30,4 +30,4 @@ matrix:
|
||||
|
||||
git:
|
||||
depth: false # Unshallow clone to obtain proper GIT_VERSION
|
||||
submodules: false
|
||||
submodules: false
|
||||
|
@ -26,7 +26,7 @@ else
|
||||
export CXX=${CLANGXX_BINARY}
|
||||
fi
|
||||
|
||||
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DLLVM_DIR=../llvmlibs/lib/cmake/llvm/ -DUSE_NATIVE_INSTRUCTIONS=OFF -G Ninja
|
||||
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_LLVM_SUBMODULE=OFF -DLLVM_DIR=llvmlibs/lib/cmake/llvm/ -DUSE_NATIVE_INSTRUCTIONS=OFF -G Ninja
|
||||
|
||||
ninja
|
||||
|
||||
|
362
3rdparty/CMakeLists.txt
vendored
Normal file
362
3rdparty/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,362 @@
|
||||
find_package(PkgConfig)
|
||||
include(ExternalProject)
|
||||
|
||||
if(APPLE)
|
||||
set(PLATFORM_ARCH "macosx/x86_64")
|
||||
elseif(WIN32)
|
||||
set(PLATFORM_ARCH "Windows/x86_64")
|
||||
else()
|
||||
set(PLATFORM_ARCH "linux/x86_64")
|
||||
endif()
|
||||
|
||||
# Dummy target to use when lib isn't available
|
||||
add_library(3rdparty_dummy_lib INTERFACE)
|
||||
|
||||
|
||||
# ZLib
|
||||
if (USE_SYSTEM_ZLIB)
|
||||
find_package(ZLIB QUIET)
|
||||
endif()
|
||||
|
||||
if (NOT ZLIB_FOUND)
|
||||
message(STATUS "Using builtin ZLIB")
|
||||
set(SKIP_INSTALL_ALL ON)
|
||||
add_subdirectory(zlib EXCLUDE_FROM_ALL)
|
||||
set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/zlib" "${CMAKE_CURRENT_BINARY_DIR}/zlib")
|
||||
set(ZLIB_LIBRARY zlibstatic)
|
||||
endif()
|
||||
|
||||
add_library(3rdparty_zlib INTERFACE)
|
||||
target_link_libraries(3rdparty_zlib INTERFACE ${ZLIB_LIBRARY})
|
||||
target_include_directories(3rdparty_zlib INTERFACE ${ZLIB_INCLUDE_DIR})
|
||||
|
||||
# libPNG
|
||||
# Select the version of libpng to use, default is builtin
|
||||
if (NOT USE_SYSTEM_LIBPNG)
|
||||
# We use libpng's static library and don't need to build the shared library and run the tests
|
||||
set(PNG_SHARED OFF CACHE BOOL "Build shared lib" FORCE)
|
||||
set(PNG_TESTS OFF CACHE BOOL "Build libpng tests" FORCE)
|
||||
set(PNG_BUILD_ZLIB ON CACHE BOOL "ZLIB is already build or package is found" FORCE)
|
||||
set(SKIP_INSTALL_ALL ON)
|
||||
add_subdirectory(libpng EXCLUDE_FROM_ALL)
|
||||
|
||||
set(LIBPNG_TARGET png_static)
|
||||
|
||||
target_include_directories(png_static INTERFACE "${libpng_BINARY_DIR}" "${libpng_SOURCE_DIR}")
|
||||
else()
|
||||
find_package(PNG REQUIRED)
|
||||
|
||||
add_library(3rdparty_system_libpng INTERFACE)
|
||||
target_include_directories(3rdparty_system_libpng INTERFACE ${PNG_INCLUDE_DIR})
|
||||
target_link_libraries(3rdparty_system_libpng INTERFACE ${PNG_LIBRARY})
|
||||
target_compile_definitions(3rdparty_system_libpng INTERFACE ${PNG_DEFINITIONS})
|
||||
|
||||
set(LIBPNG_TARGET 3rdparty_system_libpng)
|
||||
endif()
|
||||
|
||||
|
||||
# pugixml
|
||||
add_subdirectory(pugixml EXCLUDE_FROM_ALL)
|
||||
|
||||
|
||||
# hidapi
|
||||
add_library(3rdparty_hidapi INTERFACE)
|
||||
target_include_directories(3rdparty_hidapi INTERFACE hidapi/hidapi)
|
||||
|
||||
if(APPLE)
|
||||
add_subdirectory(hidapi/mac EXCLUDE_FROM_ALL)
|
||||
target_include_directories(hidapi-mac PUBLIC hidapi/hidapi)
|
||||
|
||||
target_link_libraries(3rdparty_hidapi INTERFACE hidapi-mac "-framework CoreFoundation" "-framework IOKit")
|
||||
elseif(CMAKE_SYSTEM MATCHES "Linux")
|
||||
add_subdirectory(hidapi/linux EXCLUDE_FROM_ALL)
|
||||
target_include_directories(hidapi-hidraw PUBLIC hidapi/hidapi)
|
||||
|
||||
target_link_libraries(3rdparty_hidapi INTERFACE hidapi-hidraw udev)
|
||||
elseif(WIN32)
|
||||
add_subdirectory(hidapi/windows EXCLUDE_FROM_ALL)
|
||||
target_include_directories(hidapi-hid PUBLIC hidapi/hidapi)
|
||||
|
||||
target_link_libraries(3rdparty_hidapi INTERFACE hidapi-hid Shlwapi.lib)
|
||||
else()
|
||||
add_subdirectory(hidapi/libusb EXCLUDE_FROM_ALL)
|
||||
target_link_libraries(3rdparty_hidapi INTERFACE hidapi-libusb usb)
|
||||
endif()
|
||||
|
||||
|
||||
# yaml-cpp
|
||||
# We don't want to install yaml-cpp but its cmake file doesn't have option
|
||||
# to disable it...
|
||||
# So we just install it to a different directory
|
||||
set(CMAKE_INSTALL_PREFIX_OLD ${CMAKE_INSTALL_PREFIX})
|
||||
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/yaml-cpp_install)
|
||||
|
||||
set(YAML_CPP_BUILD_TESTS OFF CACHE BOOL "Enable testing" FORCE)
|
||||
set(YAML_CPP_BUILD_TOOLS OFF CACHE BOOL "Enable parse tools" FORCE)
|
||||
set(YAML_CPP_BUILD_CONTRIB OFF CACHE BOOL "Enable contrib stuff in library" FORCE)
|
||||
add_subdirectory(yaml-cpp EXCLUDE_FROM_ALL)
|
||||
|
||||
set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX_OLD})
|
||||
|
||||
|
||||
# xxHash
|
||||
set(XXHASH_BUNDLED_MODE ON)
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Make xxHash build static libs")
|
||||
add_subdirectory(xxHash/cmake_unofficial EXCLUDE_FROM_ALL)
|
||||
target_include_directories(xxhash INTERFACE xxHash)
|
||||
|
||||
|
||||
# cereal
|
||||
add_library(3rdparty_cereal INTERFACE)
|
||||
target_include_directories(3rdparty_cereal INTERFACE cereal/include)
|
||||
|
||||
|
||||
# OpenGL
|
||||
|
||||
# Prefer GLVND for OpenGL rather than legacy
|
||||
set(OpenGL_GL_PREFERENCE GLVND)
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
add_library(3rdparty_opengl INTERFACE)
|
||||
target_include_directories(3rdparty_opengl INTERFACE GL)
|
||||
|
||||
if (WIN32)
|
||||
if(NOT MSVC)
|
||||
target_link_libraries(3rdparty_opengl INTERFACE ${OPENGL_LIBRARIES} opengl32.lib glu32.lib)
|
||||
else()
|
||||
target_link_libraries(3rdparty_opengl INTERFACE dxgi.lib d2d1.lib dwrite.lib)
|
||||
endif()
|
||||
else()
|
||||
target_link_libraries(3rdparty_opengl INTERFACE ${OPENGL_LIBRARIES})
|
||||
|
||||
target_compile_definitions(3rdparty_opengl
|
||||
INTERFACE
|
||||
-DGL_GLEXT_PROTOTYPES
|
||||
-DGLX_GLXEXT_PROTOTYPES)
|
||||
endif()
|
||||
|
||||
|
||||
# GSL
|
||||
add_library(3rdparty_gsl INTERFACE)
|
||||
target_include_directories(3rdparty_gsl INTERFACE GSL/include)
|
||||
|
||||
|
||||
# stblib
|
||||
add_library(3rdparty_stblib INTERFACE)
|
||||
target_include_directories(3rdparty_stblib INTERFACE stblib)
|
||||
|
||||
|
||||
# discord_rpc
|
||||
add_library(3rdparty_discord-rpc INTERFACE)
|
||||
|
||||
# We don't want Discord Rich Presence on the BSDs and other OSes
|
||||
if (WIN32 OR CMAKE_SYSTEM MATCHES "Linux" OR APPLE)
|
||||
if (WIN32 AND NOT MSVC)
|
||||
ExternalProject_Add(discord-rpc
|
||||
GIT_REPOSITORY https://github.com/discordapp/discord-rpc
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/discord-rpc
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
target_include_directories(3rdparty_discord-rpc INTERFACE discord-rpc/include)
|
||||
target_compile_definitions(3rdparty_discord-rpc INTERFACE -DWITH_DISCORD_RPC)
|
||||
|
||||
set(DISCORD_RPC_LIB NOTFOUND)
|
||||
if (WIN32)
|
||||
if (NOT MSVC)
|
||||
set(DISCORD_RPC_LIB ${CMAKE_BINARY_DIR}/discord-rpc/src/libdiscord-rpc.a)
|
||||
else()
|
||||
find_library(DISCORD_RPC_LIB discord-rpc PATHS discord-rpc/lib/ NO_DEFAULT_PATH)
|
||||
endif()
|
||||
elseif(CMAKE_SYSTEM MATCHES "Linux")
|
||||
find_library(DISCORD_RPC_LIB discord-rpc-linux PATHS discord-rpc/lib/ NO_DEFAULT_PATH)
|
||||
elseif(APPLE)
|
||||
find_library(DISCORD_RPC_LIB discord-rpc-mac PATHS discord-rpc/lib/ NO_DEFAULT_PATH)
|
||||
endif()
|
||||
target_link_libraries(3rdparty_discord-rpc INTERFACE ${DISCORD_RPC_LIB})
|
||||
endif()
|
||||
|
||||
|
||||
# ALSA
|
||||
set(ALSA_TARGET 3rdparty_dummy_lib)
|
||||
|
||||
if(USE_ALSA)
|
||||
find_package(ALSA)
|
||||
if(ALSA_FOUND)
|
||||
add_library(3rdparty_alsa INTERFACE)
|
||||
target_compile_definitions(3rdparty_alsa INTERFACE -DHAVE_ALSA)
|
||||
target_include_directories(3rdparty_alsa SYSTEM INTERFACE ${ALSA_INCLUDE_DIRS})
|
||||
target_link_libraries(3rdparty_alsa INTERFACE ${ALSA_LIBRARIES})
|
||||
|
||||
set(ALSA_TARGET 3rdparty_alsa)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# Pulse
|
||||
set(PULSE_TARGET 3rdparty_dummy_lib)
|
||||
if(USE_PULSE)
|
||||
pkg_check_modules(PULSE libpulse-simple)
|
||||
|
||||
if(PULSE_FOUND)
|
||||
add_library(3rdparty_pulse INTERFACE)
|
||||
target_compile_definitions(3rdparty_pulse INTERFACE -DHAVE_PULSE)
|
||||
target_include_directories(3rdparty_pulse SYSTEM
|
||||
INTERFACE ${PULSE_INCLUDE_DIRS})
|
||||
target_link_libraries(3rdparty_pulse INTERFACE ${PULSE_LDFLAGS})
|
||||
|
||||
set(PULSE_TARGET 3rdparty_pulse)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# libevdev
|
||||
set(LIBEVDEV_TARGET 3rdparty_dummy_lib)
|
||||
if(USE_LIBEVDEV)
|
||||
pkg_check_modules(LIBEVDEV libevdev)
|
||||
if(LIBEVDEV_FOUND)
|
||||
add_library(3rdparty_libevdev INTERFACE)
|
||||
target_compile_definitions(3rdparty_libevdev INTERFACE -DHAVE_LIBEVDEV)
|
||||
target_include_directories(3rdparty_libevdev SYSTEM
|
||||
INTERFACE ${LIBEVDEV_INCLUDE_DIRS})
|
||||
target_link_libraries(3rdparty_libevdev INTERFACE ${LIBEVDEV_LDFLAGS})
|
||||
|
||||
set(LIBEVDEV_TARGET 3rdparty_libevdev)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# Vulkan
|
||||
set(VULKAN_TARGET 3rdparty_dummy_lib)
|
||||
if(NOT APPLE AND USE_VULKAN)
|
||||
find_package(Vulkan)
|
||||
if(VULKAN_FOUND)
|
||||
add_library(3rdparty_vulkan INTERFACE)
|
||||
target_compile_definitions(3rdparty_vulkan INTERFACE -DHAVE_VULKAN)
|
||||
target_link_libraries(3rdparty_vulkan INTERFACE SPIRV Vulkan::Vulkan)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
find_package(Wayland)
|
||||
if (WAYLAND_FOUND)
|
||||
target_include_directories(3rdparty_vulkan
|
||||
INTERFACE ${WAYLAND_INCLUDE_DIR})
|
||||
|
||||
target_compile_definitions(3rdparty_vulkan
|
||||
INTERFACE -DVK_USE_PLATFORM_WAYLAND_KHR)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(VULKAN_TARGET 3rdparty_vulkan)
|
||||
else()
|
||||
message("WARNING! USE_VULKAN was enabled, but libvulkan was not found. RPCS3 will be compiled without Vulkan support.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# OpenAL
|
||||
if (MSVC)
|
||||
find_path(OPENAL_INCLUDE_DIR al.h PATHS OpenAL/include)
|
||||
find_library(OPENAL_LIBRARY OpenAL32 PATHS OpenAL/libs/Win64/)
|
||||
else()
|
||||
find_package(OpenAL REQUIRED)
|
||||
endif()
|
||||
|
||||
add_library(3rdparty_openal INTERFACE)
|
||||
target_include_directories(3rdparty_openal INTERFACE ${OPENAL_INCLUDE_DIR})
|
||||
target_link_libraries(3rdparty_openal INTERFACE ${OPENAL_LIBRARY})
|
||||
|
||||
|
||||
# FFMPEG
|
||||
add_library(3rdparty_ffmpeg INTERFACE)
|
||||
|
||||
# Select the version of ffmpeg to use, default is builtin
|
||||
if(USE_SYSTEM_FFMPEG)
|
||||
message("-- RPCS3: using shared ffmpeg")
|
||||
find_package(FFMPEG REQUIRED)
|
||||
|
||||
target_include_directories(3rdparty_ffmpeg INTERFACE ${FFMPEG_INCLUDE_DIR})
|
||||
target_link_libraries(3rdparty_ffmpeg INTERFACE ${FFMPEG_LIBRARIES})
|
||||
else()
|
||||
set(FFMPEG_PLATFORM_DIR "ffmpeg/${PLATFORM_ARCH}")
|
||||
|
||||
if (NOT MSVC AND WIN32)
|
||||
message("-- RPCS3: building ffmpeg submodule")
|
||||
|
||||
ExternalProject_Add(ffmpeg-mingw
|
||||
DOWNLOAD_COMMAND ""
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/ffmpeg
|
||||
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg/configure --prefix=./Windows/x86_64 --arch=x86_64 --disable-avdevice --disable-programs --disable-avfilter --disable-postproc --disable-doc --disable-pthreads --enable-w32threads --disable-network --disable-everything --disable-encoders --disable-muxers --disable-hwaccels --disable-parsers --disable-protocols --enable-dxva2 --enable-static --disable-shared --enable-decoder=aac --enable-decoder=aac_latm --enable-decoder=atrac3 --enable-decoder=atrac3p --enable-decoder=mp3 --enable-decoder=pcm_s16le --enable-decoder=pcm_s8 --enable-decoder=h264 --enable-decoder=mpeg4 --enable-decoder=mpeg2video --enable-decoder=mjpeg --enable-decoder=mjpegb --enable-encoder=pcm_s16le --enable-encoder=ffv1 --enable-encoder=mpeg4 --enable-parser=h264 --enable-parser=mpeg4video --enable-parser=mpegaudio --enable-parser=mpegvideo --enable-parser=mjpeg --enable-parser=aac --enable-parser=aac_latm --enable-muxer=avi --enable-demuxer=h264 --enable-demuxer=m4v --enable-demuxer=mp3 --enable-demuxer=mpegvideo --enable-demuxer=mpegps --enable-demuxer=mjpeg --enable-demuxer=avi --enable-demuxer=aac --enable-demuxer=pmp --enable-demuxer=oma --enable-demuxer=pcm_s16le --enable-demuxer=pcm_s8 --enable-demuxer=wav --enable-hwaccel=h264_dxva2 --enable-indev=dshow --enable-protocol=file
|
||||
BUILD_COMMAND make -j 4
|
||||
INSTALL_COMMAND make install
|
||||
)
|
||||
|
||||
set(FFMPEG_LIB_AVFORMAT "${CMAKE_CURRENT_BINARY_DIR}/ffmpeg/${PLATFORM_ARCH}/lib/libavformat.a")
|
||||
set(FFMPEG_LIB_AVCODEC "${CMAKE_CURRENT_BINARY_DIR}/ffmpeg/${PLATFORM_ARCH}/lib/libavcodec.a")
|
||||
set(FFMPEG_LIB_AVUTIL "${CMAKE_CURRENT_BINARY_DIR}/ffmpeg/${PLATFORM_ARCH}/lib/libavutil.a")
|
||||
set(FFMPEG_LIB_SWSCALE "${CMAKE_CURRENT_BINARY_DIR}/ffmpeg/${PLATFORM_ARCH}/lib/libswscale.a")
|
||||
else()
|
||||
message("-- RPCS3: using builtin ffmpeg")
|
||||
|
||||
set(FFMPEG_LIB_DIR "${FFMPEG_PLATFORM_DIR}/lib")
|
||||
find_library(FFMPEG_LIB_AVFORMAT avformat PATHS ${FFMPEG_LIB_DIR} NO_DEFAULT_PATH)
|
||||
find_library(FFMPEG_LIB_AVCODEC avcodec PATHS ${FFMPEG_LIB_DIR} NO_DEFAULT_PATH)
|
||||
find_library(FFMPEG_LIB_AVUTIL avutil PATHS ${FFMPEG_LIB_DIR} NO_DEFAULT_PATH)
|
||||
find_library(FFMPEG_LIB_SWSCALE swscale PATHS ${FFMPEG_LIB_DIR} NO_DEFAULT_PATH)
|
||||
endif()
|
||||
|
||||
target_include_directories(3rdparty_ffmpeg INTERFACE "${FFMPEG_PLATFORM_DIR}/include")
|
||||
|
||||
target_link_libraries(3rdparty_ffmpeg
|
||||
INTERFACE
|
||||
${FFMPEG_LIB_AVFORMAT}
|
||||
${FFMPEG_LIB_AVCODEC}
|
||||
${FFMPEG_LIB_AVUTIL}
|
||||
${FFMPEG_LIB_SWSCALE})
|
||||
endif()
|
||||
|
||||
|
||||
# dx12
|
||||
add_library(3rdparty_dx12 INTERFACE)
|
||||
if (WIN32)
|
||||
target_link_libraries(3rdparty_dx12 INTERFACE dxgi.lib d2d1.lib dwrite.lib)
|
||||
endif()
|
||||
|
||||
|
||||
# GLEW
|
||||
add_library(3rdparty_glew INTERFACE)
|
||||
if(NOT MSVC)
|
||||
find_package(GLEW 1.13.0 REQUIRED)
|
||||
target_link_libraries(3rdparty_glew INTERFACE GLEW::GLEW)
|
||||
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD 1)
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(3rdparty_glew INTERFACE Threads::Threads)
|
||||
endif()
|
||||
|
||||
|
||||
# LLVM
|
||||
include(llvm.cmake)
|
||||
|
||||
|
||||
# add nice ALIAS targets for ease of use
|
||||
add_library(3rdparty::zlib ALIAS 3rdparty_zlib)
|
||||
add_library(3rdparty::pugixml ALIAS pugixml)
|
||||
add_library(3rdparty::yaml-cpp ALIAS yaml-cpp)
|
||||
add_library(3rdparty::xxhash ALIAS xxhash)
|
||||
add_library(3rdparty::hidapi ALIAS 3rdparty_hidapi)
|
||||
add_library(3rdparty::libpng ALIAS ${LIBPNG_TARGET})
|
||||
add_library(3rdparty::cereal ALIAS 3rdparty_cereal)
|
||||
add_library(3rdparty::opengl ALIAS 3rdparty_opengl)
|
||||
add_library(3rdparty::gsl ALIAS 3rdparty_gsl)
|
||||
add_library(3rdparty::stblib ALIAS 3rdparty_stblib)
|
||||
add_library(3rdparty::discord-rpc ALIAS 3rdparty_discord-rpc)
|
||||
add_library(3rdparty::alsa ALIAS ${ALSA_TARGET})
|
||||
add_library(3rdparty::pulse ALIAS ${PULSE_TARGET})
|
||||
add_library(3rdparty::libevdev ALIAS ${LIBEVDEV_TARGET})
|
||||
add_library(3rdparty::vulkan ALIAS ${VULKAN_TARGET})
|
||||
add_library(3rdparty::openal ALIAS 3rdparty_openal)
|
||||
add_library(3rdparty::ffmpeg ALIAS 3rdparty_ffmpeg)
|
||||
add_library(3rdparty::dx12 ALIAS 3rdparty_dx12)
|
||||
add_library(3rdparty::glew ALIAS 3rdparty_glew)
|
65
3rdparty/llvm.cmake
vendored
Normal file
65
3rdparty/llvm.cmake
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
if(NOT WITHOUT_LLVM)
|
||||
if(BUILD_LLVM_SUBMODULE)
|
||||
message(STATUS "LLVM will be built from the submodule.")
|
||||
|
||||
set(LLVM_TARGETS_TO_BUILD "X86" CACHE INTERNAL "")
|
||||
option(LLVM_BUILD_RUNTIME OFF)
|
||||
option(LLVM_BUILD_TOOLS OFF)
|
||||
option(LLVM_INCLUDE_DOCS OFF)
|
||||
option(LLVM_INCLUDE_EXAMPLES OFF)
|
||||
option(LLVM_INCLUDE_TESTS OFF)
|
||||
option(LLVM_INCLUDE_TOOLS OFF)
|
||||
option(LLVM_INCLUDE_UTILS OFF)
|
||||
option(WITH_POLLY OFF)
|
||||
option(LLVM_ENABLE_CXX1Z TRUE)
|
||||
|
||||
set(CXX_FLAGS_OLD ${CMAKE_CXX_FLAGS})
|
||||
|
||||
if (MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS")
|
||||
endif()
|
||||
|
||||
# LLVM needs to be built out-of-tree
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/llvm ${CMAKE_CURRENT_BINARY_DIR}/llvm_build EXCLUDE_FROM_ALL)
|
||||
set(LLVM_DIR "${CMAKE_CURRENT_BINARY_DIR}/llvm_build/lib/cmake/llvm/")
|
||||
|
||||
set(CMAKE_CXX_FLAGS ${CXX_FLAGS_OLD})
|
||||
|
||||
# now tries to find LLVM again
|
||||
find_package(LLVM 7.0 CONFIG)
|
||||
if(NOT LLVM_FOUND)
|
||||
message(FATAL_ERROR "Couldn't build LLVM from the submodule. You might need to run `git submodule update --init`")
|
||||
endif()
|
||||
|
||||
else()
|
||||
message(STATUS "Using prebuilt LLVM")
|
||||
|
||||
if (LLVM_DIR AND NOT IS_ABSOLUTE "${LLVM_DIR}")
|
||||
# change relative LLVM_DIR to be relative to the source dir
|
||||
set(LLVM_DIR ${CMAKE_SOURCE_DIR}/${LLVM_DIR})
|
||||
endif()
|
||||
|
||||
find_package(LLVM 7.0 CONFIG)
|
||||
|
||||
if (NOT LLVM_FOUND)
|
||||
if (LLVM_VERSION AND LLVM_VERSION_MAJOR LESS 7)
|
||||
message(FATAL_ERROR "Found LLVM version ${LLVM_VERSION}. Required version 7.0. \
|
||||
Enable BUILD_LLVM_SUBMODULE option to build LLVM from included as a git submodule.")
|
||||
endif()
|
||||
|
||||
message(FATAL_ERROR "Can't find LLVM libraries from the CMAKE_PREFIX_PATH path or LLVM_DIR. \
|
||||
Enable BUILD_LLVM_SUBMODULE option to build LLVM from included as a git submodule.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(LLVM_LIBS LLVMMCJIT LLVMX86CodeGen)
|
||||
|
||||
add_library(3rdparty_llvm INTERFACE)
|
||||
target_link_libraries(3rdparty_llvm INTERFACE ${LLVM_LIBS})
|
||||
target_include_directories(3rdparty_llvm INTERFACE ${LLVM_INCLUDE_DIRS})
|
||||
target_compile_definitions(3rdparty_llvm INTERFACE ${LLVM_DEFINITIONS} -DLLVM_AVAILABLE)
|
||||
|
||||
add_library(3rdparty::llvm ALIAS 3rdparty_llvm)
|
||||
else()
|
||||
add_library(3rdparty::llvm ALIAS 3rdparty_dummy_lib)
|
||||
endif()
|
49
3rdparty/qt5.cmake
vendored
Normal file
49
3rdparty/qt5.cmake
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
add_library(3rdparty_qt5 INTERFACE)
|
||||
|
||||
find_package(Qt5 5.10 CONFIG COMPONENTS Widgets Network Qml)
|
||||
if(WIN32)
|
||||
find_package(Qt5 5.10 COMPONENTS WinExtras REQUIRED)
|
||||
target_link_libraries(3rdparty_qt5 INTERFACE Qt5::Widgets Qt5::WinExtras Qt5::Network Qt5::Qml)
|
||||
else()
|
||||
find_package(Qt5 5.10 COMPONENTS DBus Gui)
|
||||
if(Qt5DBus_FOUND)
|
||||
target_link_libraries(3rdparty_qt5 INTERFACE Qt5::Widgets Qt5::DBus Qt5::Network Qt5::Qml)
|
||||
target_compile_definitions(3rdparty_qt5 INTERFACE -DHAVE_QTDBUS)
|
||||
else()
|
||||
target_link_libraries(3rdparty_qt5 INTERFACE Qt5::Widgets Qt5::Network Qt5::Qml)
|
||||
endif()
|
||||
target_include_directories(3rdparty_qt5 INTERFACE ${Qt5Gui_PRIVATE_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
if(NOT Qt5Widgets_FOUND)
|
||||
if(Qt5Widgets_VERSION VERSION_LESS 5.10.0)
|
||||
message("Minimum supported Qt5 version is 5.10.0! You have version ${Qt5Widgets_VERSION} installed, please upgrade!")
|
||||
if(CMAKE_SYSTEM MATCHES "Linux")
|
||||
message(FATAL_ERROR "Most distros do not provide an up-to-date version of Qt.
|
||||
If you're on Ubuntu or Linux Mint, there are PPAs you can use to install one of the latest qt5 versions.
|
||||
https://launchpad.net/~beineri/+archive/ubuntu/opt-qt-5.11.0-bionic
|
||||
https://launchpad.net/~beineri/+archive/ubuntu/opt-qt-5.11.0-xenial
|
||||
https://launchpad.net/~beineri/+archive/ubuntu/opt-qt-5.10.1-trusty
|
||||
just make sure to run
|
||||
source /opt/qt511/bin/qt511-env.sh
|
||||
respective
|
||||
source /opt/qt510/bin/qt510-env.sh
|
||||
before re-running cmake")
|
||||
elseif(WIN32)
|
||||
message(FATAL_ERROR "You can download the latest version of Qt5 here: https://www.qt.io/download-open-source/")
|
||||
else()
|
||||
message(FATAL_ERROR "Look online for instructions on installing an up-to-date Qt5 on ${CMAKE_SYSTEM}.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message("CMake was unable to find Qt5!")
|
||||
if(WIN32)
|
||||
message(FATAL_ERROR "Make sure the QTDIR env variable has been set properly. (for example C:\\Qt\\5.11.1\\msvc2017_64\\)")
|
||||
elseif(CMAKE_SYSTEM MATCHES "Linux")
|
||||
message(FATAL_ERROR "Make sure to install your distro's qt5 package!")
|
||||
else()
|
||||
message(FATAL_ERROR "You need to have Qt5 installed, look online for instructions on installing Qt5 on ${CMAKE_SYSTEM}.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(3rdparty::qt5 ALIAS 3rdparty_qt5)
|
@ -1,17 +1,30 @@
|
||||
cmake_minimum_required(VERSION 3.8.2)
|
||||
|
||||
project(rpcs3)
|
||||
|
||||
option(WITH_GDB "WITH_GDB" OFF)
|
||||
option(WITHOUT_LLVM "WITHOUT_LLVM" OFF)
|
||||
option(USE_NATIVE_INSTRUCTIONS "USE_NATIVE_INSTRUCTIONS makes rpcs3 compile with -march=native, which is useful for local builds, but not good for packages." ON)
|
||||
|
||||
option(WITH_LLVM "Enable usage of LLVM library" ON)
|
||||
option(BUILD_LLVM_SUBMODULE "Build LLVM from git submodule" ON)
|
||||
|
||||
option(USE_ALSA "ALSA audio backend" ON)
|
||||
option(USE_PULSE "PulseAudio audio backend" ON)
|
||||
option(USE_LIBEVDEV "libevdev-based joystick support" ON)
|
||||
|
||||
option(USE_SYSTEM_ZLIB "Prefer system ZLIB instead of the builtin one" ON)
|
||||
|
||||
option(USE_VULKAN "Vulkan render backend" ON)
|
||||
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/rpcs3/cmake_modules")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
if (WITH_GDB)
|
||||
add_definitions(-DWITH_GDB_DEBUGGER)
|
||||
endif()
|
||||
|
||||
set(ASMJIT_EMBED TRUE)
|
||||
set(ASMJIT_DIR "${CMAKE_CURRENT_LIST_DIR}/asmjit" CACHE PATH "Location of 'asmjit'")
|
||||
include("${ASMJIT_DIR}/CMakeLists.txt")
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
message(STATUS "No build type selected, default to Release")
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
@ -27,50 +40,18 @@ if (CCACHE_FOUND)
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
||||
endif()
|
||||
|
||||
find_package(ZLIB QUIET)
|
||||
if (NOT ZLIB_FOUND)
|
||||
add_subdirectory(3rdparty/zlib EXCLUDE_FROM_ALL)
|
||||
set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/zlib" "${CMAKE_CURRENT_BINARY_DIR}/3rdparty/zlib" CACHE INTERNAL "")
|
||||
set(ZLIB_LIBRARY zlibstatic)
|
||||
if(WIN32)
|
||||
add_definitions(-DUNICODE)
|
||||
add_definitions(-D_WIN32_WINNT=0x0602)
|
||||
endif()
|
||||
|
||||
# Select the version of libpng to use, default is builtin
|
||||
if (NOT USE_SYSTEM_LIBPNG)
|
||||
# We use libpng's static library and don't need to build the shared library and run the tests
|
||||
set(PNG_SHARED OFF CACHE BOOL "Build shared lib" FORCE)
|
||||
set(PNG_TESTS OFF CACHE BOOL "Build libpng tests" FORCE)
|
||||
set(SKIP_INSTALL_ALL ON)
|
||||
add_subdirectory(3rdparty/libpng EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
add_subdirectory(3rdparty/pugixml EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(Vulkan EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(asmjitsrc EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(3rdparty)
|
||||
|
||||
# TODO: do real installation, including copying directory structure
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${PROJECT_BINARY_DIR}/bin")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${PROJECT_BINARY_DIR}/bin")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${PROJECT_BINARY_DIR}/bin")
|
||||
|
||||
add_subdirectory(Vulkan EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(rpcs3)
|
||||
|
||||
include_directories(3rdparty/hidapi/hidapi)
|
||||
if(APPLE)
|
||||
add_subdirectory(3rdparty/hidapi/mac EXCLUDE_FROM_ALL)
|
||||
#list(APPEND LIBS hidapi)
|
||||
elseif(CMAKE_SYSTEM MATCHES "Linux")
|
||||
add_subdirectory(3rdparty/hidapi/linux EXCLUDE_FROM_ALL)
|
||||
elseif(WIN32)
|
||||
add_subdirectory(3rdparty/hidapi/windows EXCLUDE_FROM_ALL)
|
||||
else()
|
||||
add_subdirectory(3rdparty/hidapi/libusb EXCLUDE_FROM_ALL)
|
||||
#list(APPEND LIBS hidapi-libusb)
|
||||
endif()
|
||||
|
||||
set(YAML_CPP_BUILD_TESTS OFF CACHE BOOL "Enable testing" FORCE)
|
||||
set(YAML_CPP_BUILD_TOOLS OFF CACHE BOOL "Enable parse tools" FORCE)
|
||||
set(YAML_CPP_BUILD_CONTRIB OFF CACHE BOOL "Enable contrib stuff in library" FORCE)
|
||||
add_subdirectory(3rdparty/yaml-cpp EXCLUDE_FROM_ALL)
|
||||
|
||||
set(XXHASH_BUNDLED_MODE ON)
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Make xxHash build static libs")
|
||||
add_subdirectory(3rdparty/xxHash/cmake_unofficial)
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "Log.h"
|
||||
#include "Log.h"
|
||||
#include "File.h"
|
||||
#include "StrFmt.h"
|
||||
#include "sema.h"
|
||||
@ -11,6 +11,7 @@
|
||||
#include <unordered_map>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <cstring>
|
||||
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
|
17
asmjitsrc/CMakeLists.txt
Normal file
17
asmjitsrc/CMakeLists.txt
Normal file
@ -0,0 +1,17 @@
|
||||
set(ASMJIT_EMBED TRUE)
|
||||
set(ASMJIT_STATIC TRUE)
|
||||
set(ASMJIT_BUILD_X86 TRUE)
|
||||
set(ASMJIT_BUILD_ARM FALSE)
|
||||
set(ASMJIT_BUILD_TEST FALSE)
|
||||
set(ASMJIT_DIR "${CMAKE_CURRENT_LIST_DIR}/../asmjit" CACHE PATH "Location of 'asmjit'")
|
||||
|
||||
include("${ASMJIT_DIR}/CMakeLists.txt")
|
||||
|
||||
add_library(asmjit ${ASMJIT_SRC})
|
||||
target_include_directories(asmjit PUBLIC ${ASMJIT_DIR}/src)
|
||||
target_link_libraries(asmjit PRIVATE ${ASMJIT_DEPS})
|
||||
|
||||
# ASMJIT should have a option for disabling installing and this wouldnt
|
||||
# be required to avoid installing ASMJIT...
|
||||
|
||||
add_library(3rdparty::asmjit ALIAS asmjit)
|
@ -1,86 +1,13 @@
|
||||
cmake_minimum_required(VERSION 3.8.2)
|
||||
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_modules")
|
||||
set(RES_FILES "")
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(ExternalProject)
|
||||
|
||||
# Qt section
|
||||
find_package(Qt5 5.10 COMPONENTS Widgets Network Qml)
|
||||
if(WIN32)
|
||||
find_package(Qt5 5.10 COMPONENTS WinExtras REQUIRED)
|
||||
set(RPCS3_QT_LIBS Qt5::Widgets Qt5::WinExtras Qt5::Network Qt5::Qml)
|
||||
else()
|
||||
find_package(Qt5 5.10 COMPONENTS DBus Gui)
|
||||
if(Qt5DBus_FOUND)
|
||||
set(RPCS3_QT_LIBS Qt5::Widgets Qt5::DBus Qt5::Network Qt5::Qml)
|
||||
add_definitions(-DHAVE_QTDBUS)
|
||||
else()
|
||||
set(RPCS3_QT_LIBS Qt5::Widgets Qt5::Network Qt5::Qml)
|
||||
endif()
|
||||
include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
# Let's make sure we have Qt before we continue
|
||||
if(NOT Qt5Widgets_FOUND)
|
||||
if(Qt5Widgets_VERSION VERSION_LESS 5.10.0)
|
||||
message("Minimum supported Qt5 version is 5.10.0! You have version ${Qt5Widgets_VERSION} installed, please upgrade!")
|
||||
if(CMAKE_SYSTEM MATCHES "Linux")
|
||||
message(FATAL_ERROR "Most distros do not provide an up-to-date version of Qt.
|
||||
If you're on Ubuntu or Linux Mint, there are PPAs you can use to install one of the latest qt5 versions.
|
||||
https://launchpad.net/~beineri/+archive/ubuntu/opt-qt-5.11.0-bionic
|
||||
https://launchpad.net/~beineri/+archive/ubuntu/opt-qt-5.11.0-xenial
|
||||
https://launchpad.net/~beineri/+archive/ubuntu/opt-qt-5.10.1-trusty
|
||||
just make sure to run
|
||||
source /opt/qt511/bin/qt511-env.sh
|
||||
respective
|
||||
source /opt/qt510/bin/qt510-env.sh
|
||||
before re-running cmake")
|
||||
elseif(WIN32)
|
||||
message(FATAL_ERROR "You can download the latest version of Qt5 here: https://www.qt.io/download-open-source/")
|
||||
else()
|
||||
message(FATAL_ERROR "Look online for instructions on installing an up-to-date Qt5 on ${CMAKE_SYSTEM}.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message("CMake was unable to find Qt5!")
|
||||
if(WIN32)
|
||||
message(FATAL_ERROR "Make sure the QTDIR env variable has been set properly. (for example C:\\Qt\\5.11.1\\msvc2017_64\\)")
|
||||
elseif(CMAKE_SYSTEM MATCHES "Linux")
|
||||
message(FATAL_ERROR "Make sure to install your distro's qt5 package!")
|
||||
else()
|
||||
message(FATAL_ERROR "You need to have Qt5 installed, look online for instructions on installing Qt5 on ${CMAKE_SYSTEM}.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
# To make UI files on cmake 3.7 or less work
|
||||
if(CMAKE_VERION VERSION_LESS 3.8)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
endif()
|
||||
|
||||
if(Qt5_POSITION_INDEPENDENT_CODE)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
if(UNIX)
|
||||
# Cotire needs this set for some reason
|
||||
set(CMAKE_CXX_COMPILE_OPTIONS_PIE -fPIC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(cotire)
|
||||
|
||||
project(rpcs3)
|
||||
|
||||
# Generate git-version.h at build time.
|
||||
add_custom_target(GitVersion ALL
|
||||
DEPENDS something_that_never_exists)
|
||||
add_custom_command(OUTPUT something_that_never_exists
|
||||
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/git-version.cmake)
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/git-version.cmake)
|
||||
|
||||
# Check for a sufficient compiler and set build options
|
||||
include(ConfigureCompiler)
|
||||
@ -90,75 +17,7 @@ if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(-DUNICODE)
|
||||
add_definitions(-D_WIN32_WINNT=0x0601)
|
||||
add_definitions(-DWITH_DISCORD_RPC)
|
||||
set(RES_FILES "rpcs3.rc")
|
||||
else()
|
||||
add_definitions(-DGL_GLEXT_PROTOTYPES)
|
||||
add_definitions(-DGLX_GLXEXT_PROTOTYPES)
|
||||
if(CMAKE_SYSTEM MATCHES "Linux" OR APPLE)
|
||||
# We don't want Discord Rich Presence on the BSDs and other OSes
|
||||
add_definitions(-DWITH_DISCORD_RPC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_NATIVE_INSTRUCTIONS)
|
||||
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||
if(COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||
add_compile_options(-march=native)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-pch -fexceptions")
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-command-line-argument")
|
||||
endif()
|
||||
|
||||
# This hides our LLVM from mesa's LLVM, otherwise we get some unresolvable conflicts.
|
||||
if(NOT APPLE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--exclude-libs,ALL")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(CMAKE_RC_COMPILER_INIT windres)
|
||||
enable_language(RC)
|
||||
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
|
||||
|
||||
# Workaround for mingw64 (MSYS2)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--allow-multiple-definition")
|
||||
endif()
|
||||
|
||||
add_compile_options(-msse -msse2 -mcx16)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
# This fixes 'some' of the st11range issues. See issue #2516
|
||||
if(APPLE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-image_base,0x10000 -Wl,-pagezero_size,0x10000")
|
||||
else()
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -image-base=0x10000")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Some distros have the compilers set to use PIE by default, but RPCS3 doesn't work with PIE, so we need to disable it.
|
||||
if(APPLE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-no_pie")
|
||||
else()
|
||||
CHECK_CXX_COMPILER_FLAG("-no-pie" HAS_NO_PIE)
|
||||
CHECK_CXX_COMPILER_FLAG("-nopie" HAS_NOPIE)
|
||||
|
||||
if(HAS_NO_PIE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie")
|
||||
elseif(HAS_NOPIE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -nopie")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:throwingNew /std:c++latest /D _CRT_SECURE_NO_DEPRECATE=1 /D _CRT_NON_CONFORMING_SWPRINTFS=1 /D _SCL_SECURE_NO_WARNINGS=1")
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /DYNAMICBASE:NO /BASE:0x10000 /FIXED")
|
||||
endif()
|
||||
|
||||
set(ADDITIONAL_LIBS "")
|
||||
@ -170,13 +29,6 @@ elseif(NOT MSVC AND NOT CMAKE_CXX_FLAGS MATCHES "LIBICONV_PLUG")
|
||||
#implementations like the one on OSX don't seem implement them
|
||||
set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} "iconv")
|
||||
endif()
|
||||
if(UNIX AND NOT APPLE)
|
||||
find_package(Wayland)
|
||||
if (WAYLAND_FOUND)
|
||||
include_directories(${WAYLAND_INCLUDE_DIR})
|
||||
add_definitions(-DVK_USE_PLATFORM_WAYLAND_KHR)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT RPCS3_SRC_DIR)
|
||||
set(RPCS3_SRC_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
@ -185,210 +37,17 @@ else()
|
||||
message("-- Using Custom RPCS3_SRC_DIR=${RPCS3_SRC_DIR}")
|
||||
endif()
|
||||
|
||||
# Prefer GLVND for OpenGL rather than legacy
|
||||
set(OpenGL_GL_PREFERENCE GLVND)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(OpenAL REQUIRED)
|
||||
if(NOT WITHOUT_LLVM)
|
||||
if (EXISTS "${CMAKE_SOURCE_DIR}/llvmlibs")
|
||||
find_package(LLVM 7.0 CONFIG)
|
||||
endif()
|
||||
if(NOT LLVM_FOUND)
|
||||
message("LLVM will be built from the submodule.")
|
||||
# Qt5
|
||||
# finds Qt libraries and setups custom commands for MOC and UIC
|
||||
# Must be done here because generated MOC and UIC targets cant
|
||||
# be found otherwise
|
||||
include(../3rdparty/qt5.cmake)
|
||||
|
||||
set(LLVM_TARGETS_TO_BUILD "X86" CACHE INTERNAL "")
|
||||
option(LLVM_BUILD_RUNTIME OFF)
|
||||
option(LLVM_BUILD_TOOLS OFF)
|
||||
option(LLVM_INCLUDE_DOCS OFF)
|
||||
option(LLVM_INCLUDE_EXAMPLES OFF)
|
||||
option(LLVM_INCLUDE_TESTS OFF)
|
||||
option(LLVM_INCLUDE_TOOLS OFF)
|
||||
option(LLVM_INCLUDE_UTILS OFF)
|
||||
option(WITH_POLLY OFF)
|
||||
# subdirectories
|
||||
add_subdirectory(Emu)
|
||||
add_subdirectory(rpcs3qt)
|
||||
|
||||
if(WIN32 AND NOT MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_FORMAT_MACROS=1")
|
||||
endif()
|
||||
|
||||
# LLVM needs to be built out-of-tree
|
||||
add_subdirectory(../llvm ../llvm_build EXCLUDE_FROM_ALL)
|
||||
set(LLVM_DIR "${CMAKE_CURRENT_BINARY_DIR}/../llvm_build/lib/cmake/llvm/")
|
||||
|
||||
# now tries to find LLVM again
|
||||
find_package(LLVM 7.0 CONFIG)
|
||||
if(NOT LLVM_FOUND)
|
||||
message(WARNING "Couldn't build LLVM from the submodule. You might need to run `git submodule update --init`")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
if(APPLE)
|
||||
set(PLATFORM_ARCH "macosx/x86_64")
|
||||
elseif(WIN32)
|
||||
set(PLATFORM_ARCH "Windows/x86_64")
|
||||
else()
|
||||
set(PLATFORM_ARCH "linux/x86_64")
|
||||
option(USE_ALSA "ALSA audio backend" ON)
|
||||
option(USE_PULSE "PulseAudio audio backend" ON)
|
||||
option(USE_LIBEVDEV "libevdev-based joystick support" ON)
|
||||
endif()
|
||||
|
||||
if(USE_ALSA)
|
||||
find_package(ALSA)
|
||||
if(ALSA_FOUND)
|
||||
add_definitions(-DHAVE_ALSA)
|
||||
include_directories(SYSTEM ${ALSA_INCLUDE_DIRS})
|
||||
list(APPEND ADDITIONAL_LIBS ${ALSA_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
if(USE_PULSE)
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PULSE libpulse-simple)
|
||||
if(PULSE_FOUND)
|
||||
add_definitions(-DHAVE_PULSE)
|
||||
include_directories(SYSTEM ${PULSE_INCLUDE_DIRS})
|
||||
list(APPEND ADDITIONAL_LIBS ${PULSE_LDFLAGS})
|
||||
endif()
|
||||
endif()
|
||||
if(USE_LIBEVDEV)
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(LIBEVDEV libevdev)
|
||||
if(LIBEVDEV_FOUND)
|
||||
add_definitions(-DHAVE_LIBEVDEV)
|
||||
include_directories(SYSTEM ${LIBEVDEV_INCLUDE_DIRS})
|
||||
list(APPEND ADDITIONAL_LIBS ${LIBEVDEV_LDFLAGS})
|
||||
endif()
|
||||
endif()
|
||||
option(USE_VULKAN "Vulkan render backend" ON)
|
||||
if(USE_VULKAN)
|
||||
find_package(Vulkan)
|
||||
if(VULKAN_FOUND)
|
||||
add_definitions(-DHAVE_VULKAN)
|
||||
include_directories("${Vulkan_INCLUDE_DIRS}")
|
||||
else()
|
||||
message("WARNING! USE_VULKAN was enabled, but libvulkan was not found. RPCS3 will be compiled without Vulkan support.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Select the version of libpng to use, default is builtin
|
||||
if(USE_SYSTEM_LIBPNG)
|
||||
message("-- RPCS3: using shared libpng")
|
||||
find_package(PNG REQUIRED)
|
||||
include_directories("${PNG_INCLUDE_DIRS}")
|
||||
else()
|
||||
message("-- RPCS3: using builtin libpng")
|
||||
include_directories("${libpng_BINARY_DIR}" "${libpng_SOURCE_DIR}")
|
||||
endif()
|
||||
|
||||
# Select the version of ffmpeg to use, default is builtin
|
||||
if(USE_SYSTEM_FFMPEG)
|
||||
message("-- RPCS3: using shared ffmpeg")
|
||||
find_package(FFMPEG REQUIRED)
|
||||
include_directories("${FFMPEG_INCLUDE_DIR}")
|
||||
else()
|
||||
message("-- RPCS3: using builtin ffmpeg")
|
||||
if(MSVC OR NOT WIN32)
|
||||
include_directories("${RPCS3_SRC_DIR}/../3rdparty/ffmpeg/${PLATFORM_ARCH}/include")
|
||||
link_directories("${RPCS3_SRC_DIR}/../3rdparty/ffmpeg/${PLATFORM_ARCH}/lib")
|
||||
else()
|
||||
ExternalProject_Add(ffmpeg-mingw
|
||||
DOWNLOAD_COMMAND ""
|
||||
SOURCE_DIR /e/src/rpcs3/3rdparty/ffmpeg
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/ffmpeg
|
||||
CONFIGURE_COMMAND /e/src/rpcs3/3rdparty/ffmpeg/configure --prefix=./Windows/x86_64 --arch=x86_64 --disable-avdevice --disable-programs --disable-avfilter --disable-postproc --disable-doc --disable-pthreads --enable-w32threads --disable-network --disable-everything --disable-encoders --disable-muxers --disable-hwaccels --disable-parsers --disable-protocols --enable-dxva2 --enable-static --disable-shared --enable-decoder=aac --enable-decoder=aac_latm --enable-decoder=atrac3 --enable-decoder=atrac3p --enable-decoder=mp3 --enable-decoder=pcm_s16le --enable-decoder=pcm_s8 --enable-decoder=h264 --enable-decoder=mpeg4 --enable-decoder=mpeg2video --enable-decoder=mjpeg --enable-decoder=mjpegb --enable-encoder=pcm_s16le --enable-encoder=ffv1 --enable-encoder=mpeg4 --enable-parser=h264 --enable-parser=mpeg4video --enable-parser=mpegaudio --enable-parser=mpegvideo --enable-parser=mjpeg --enable-parser=aac --enable-parser=aac_latm --enable-muxer=avi --enable-demuxer=h264 --enable-demuxer=m4v --enable-demuxer=mp3 --enable-demuxer=mpegvideo --enable-demuxer=mpegps --enable-demuxer=mjpeg --enable-demuxer=avi --enable-demuxer=aac --enable-demuxer=pmp --enable-demuxer=oma --enable-demuxer=pcm_s16le --enable-demuxer=pcm_s8 --enable-demuxer=wav --enable-hwaccel=h264_dxva2 --enable-indev=dshow --enable-protocol=file
|
||||
BUILD_COMMAND make -j 4
|
||||
INSTALL_COMMAND make install
|
||||
)
|
||||
include_directories("${CMAKE_CURRENT_BINARY_DIR}/ffmpeg/${PLATFORM_ARCH}/include")
|
||||
link_directories("${CMAKE_CURRENT_BINARY_DIR}/ffmpeg/${PLATFORM_ARCH}/lib")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Build discord-rpc for mingw
|
||||
if(WIN32 AND NOT MSVC)
|
||||
ExternalProject_Add(discord-rpc
|
||||
GIT_REPOSITORY https://github.com/discordapp/discord-rpc
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/discord-rpc
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
link_directories(rpcs3 "${CMAKE_CURRENT_BINARY_DIR}/discord-rpc/src/")
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
${OPENAL_INCLUDE_DIR}
|
||||
${LLVM_INCLUDE_DIRS}
|
||||
"${RPCS3_SRC_DIR}"
|
||||
"${RPCS3_SRC_DIR}/Loader"
|
||||
"${RPCS3_SRC_DIR}/Crypto"
|
||||
"${RPCS3_SRC_DIR}/.."
|
||||
"${RPCS3_SRC_DIR}/../3rdparty/GSL/include"
|
||||
"${RPCS3_SRC_DIR}/../3rdparty/hidapi/hidapi"
|
||||
# Includes 3rdparty stuff that isn't included yet
|
||||
"${RPCS3_SRC_DIR}/../3rdparty/GL"
|
||||
"${RPCS3_SRC_DIR}/../3rdparty/stblib"
|
||||
"${RPCS3_SRC_DIR}/../3rdparty/cereal/include"
|
||||
"${RPCS3_SRC_DIR}/../3rdparty/discord-rpc/include"
|
||||
"${RPCS3_SRC_DIR}/../3rdparty/xxHash"
|
||||
"${RPCS3_SRC_DIR}/../3rdparty/GPUOpen/include"
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
# Slimmed down version of minidx9 for XAudio2_7 only
|
||||
include_directories(BEFORE "${RPCS3_SRC_DIR}/../3rdparty/XAudio2_7")
|
||||
include_directories(BEFORE "${RPCS3_SRC_DIR}/../3rdparty/minidx12/Include")
|
||||
endif()
|
||||
|
||||
if(NOT LLVM_FOUND)
|
||||
message("LLVM submodule not found. RPCS3 will be compiled without LLVM support.")
|
||||
else()
|
||||
add_definitions(${LLVM_DEFINITIONS})
|
||||
add_definitions(-DLLVM_AVAILABLE)
|
||||
set(LLVM_LIBS LLVMMCJIT LLVMX86CodeGen)
|
||||
|
||||
if(NOT MSVC)
|
||||
set_source_files_properties(${RPCS3_SRC_DIR}/../Utilities/JIT.cpp PROPERTIES COMPILE_FLAGS -fno-rtti)
|
||||
set_source_files_properties(${RPCS3_SRC_DIR}/Emu/Cell/PPUTranslator.cpp PROPERTIES COMPILE_FLAGS -fno-rtti)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
link_directories("${RPCS3_SRC_DIR}/../3rdparty/minidx12/")
|
||||
|
||||
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
|
||||
foreach (dir ${dirs})
|
||||
message(STATUS "dir='${dir}'")
|
||||
endforeach()
|
||||
|
||||
file(
|
||||
GLOB_RECURSE
|
||||
RPCS3_SRC
|
||||
"${RPCS3_SRC_DIR}/*.cpp"
|
||||
"${RPCS3_SRC_DIR}/../Utilities/*.cpp"
|
||||
)
|
||||
|
||||
#File exclusion section
|
||||
|
||||
if(NOT WIN32 AND NOT VULKAN_FOUND)
|
||||
set(EXCLUDE_FILES "/RSX/VK/")
|
||||
endif()
|
||||
|
||||
# Ignore autogenerated moc_* files if present
|
||||
set(EXCLUDE_FILES ${EXCLUDE_FILES} "moc_")
|
||||
set(EXCLUDE_FILES ${EXCLUDE_FILES} "rpcs3_automoc")
|
||||
set(EXCLUDE_FILES ${EXCLUDE_FILES} "qrc_")
|
||||
|
||||
foreach (TMP_PATH ${RPCS3_SRC})
|
||||
foreach (EXCLUDE_PATH ${EXCLUDE_FILES})
|
||||
string(FIND ${TMP_PATH} ${EXCLUDE_PATH} EXCLUDE_FILE_FOUND)
|
||||
if(NOT ${EXCLUDE_FILE_FOUND} EQUAL -1)
|
||||
list(REMOVE_ITEM RPCS3_SRC ${TMP_PATH})
|
||||
endif ()
|
||||
endforeach(EXCLUDE_PATH)
|
||||
endforeach(TMP_PATH)
|
||||
|
||||
# Remove the Qt moc files as part of clean, they are compiled when generating automoc
|
||||
file(GLOB_RECURSE TMP_MOC "${RPCS3_SRC_DIR}/moc_*.cpp" "${RPCS3_SRC_DIR}/rpcs3_automoc.cpp" "${RPCS3_SRC_DIR}/qrc_*.cpp")
|
||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${TMP_MOC}")
|
||||
file(GLOB RPCS3_SRC "*.cpp")
|
||||
|
||||
if(WIN32)
|
||||
add_executable(rpcs3 WIN32 ${RPCS3_SRC} ${RES_FILES} resources.qrc windows.qrc)
|
||||
@ -397,109 +56,38 @@ else()
|
||||
endif()
|
||||
|
||||
add_dependencies(rpcs3 GitVersion)
|
||||
set_target_properties(rpcs3
|
||||
PROPERTIES
|
||||
AUTOMOC ON
|
||||
AUTOUIC ON)
|
||||
|
||||
target_sources(rpcs3 PUBLIC ${ASMJIT_SRC})
|
||||
target_include_directories(rpcs3 PUBLIC ${ASMJIT_INCLUDE_DIR})
|
||||
target_link_libraries(rpcs3 ${ASMJIT_DEPS})
|
||||
target_link_libraries(rpcs3 ${ADDITIONAL_LIBS})
|
||||
target_link_libraries(rpcs3 rpcs3_emu rpcs3_ui)
|
||||
target_link_libraries(rpcs3 3rdparty::discord-rpc 3rdparty::qt5 3rdparty::hidapi)
|
||||
|
||||
if(NOT MSVC)
|
||||
find_package(GLEW 1.13.0 REQUIRED)
|
||||
target_link_libraries(rpcs3 GLEW::GLEW)
|
||||
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD 1)
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(rpcs3 Threads::Threads)
|
||||
endif()
|
||||
|
||||
if(NOT APPLE AND UNIX)
|
||||
if(UNIX)
|
||||
find_package(X11 REQUIRED)
|
||||
target_include_directories(rpcs3 PUBLIC ${X11_INCLUDE_DIR})
|
||||
target_link_libraries(rpcs3 ${X11_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(VULKAN_FOUND)
|
||||
target_link_libraries(rpcs3 SPIRV Vulkan::Vulkan)
|
||||
endif()
|
||||
|
||||
target_link_libraries(rpcs3 pugixml xxhash yaml-cpp)
|
||||
|
||||
find_package(ZLIB REQUIRED)
|
||||
target_include_directories(rpcs3 PUBLIC ${ZLIB_INCLUDE_DIRS})
|
||||
target_link_libraries(rpcs3 ${ZLIB_LIBRARIES})
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(rpcs3 ws2_32.lib Winmm.lib Psapi.lib gdi32.lib Shlwapi.lib)
|
||||
if(MSVC)
|
||||
target_link_libraries(rpcs3 dxgi.lib d2d1.lib dwrite.lib hidapi-hid setupapi.lib)
|
||||
# Link Discord Rich Presence
|
||||
target_link_libraries(rpcs3 "${RPCS3_SRC_DIR}/../3rdparty/discord-rpc/lib/discord-rpc.lib")
|
||||
else()
|
||||
target_link_libraries(rpcs3 ${OPENGL_LIBRARIES} opengl32.lib glu32.lib hidapi-hid libsetupapi.a libdiscord-rpc.a)
|
||||
endif()
|
||||
target_link_libraries(rpcs3 avformat.lib avcodec.lib avutil.lib swscale.lib png_static ${OPENAL_LIBRARY} ${ADDITIONAL_LIBS})
|
||||
target_link_libraries(rpcs3 ws2_32.lib Winmm.lib Psapi.lib gdi32.lib setupapi.lib)
|
||||
else()
|
||||
target_link_libraries(rpcs3 ${OPENAL_LIBRARY} ${OPENGL_LIBRARIES})
|
||||
if(APPLE)
|
||||
target_link_libraries(rpcs3 hidapi-mac "-framework CoreFoundation" "-framework IOKit")
|
||||
elseif(CMAKE_SYSTEM MATCHES "Linux")
|
||||
target_link_libraries(rpcs3 hidapi-hidraw udev)
|
||||
else()
|
||||
target_link_libraries(rpcs3 hidapi-libusb usb)
|
||||
endif()
|
||||
target_link_libraries(rpcs3 ${CMAKE_DL_LIBS} ${ADDITIONAL_LIBS})
|
||||
if(USE_SYSTEM_FFMPEG)
|
||||
target_link_libraries(rpcs3 ${FFMPEG_LIBRARIES})
|
||||
else()
|
||||
target_link_libraries(rpcs3 libavformat.a libavcodec.a libavutil.a libswscale.a)
|
||||
endif()
|
||||
if(USE_SYSTEM_LIBPNG)
|
||||
target_link_libraries(rpcs3 ${PNG_LIBRARIES})
|
||||
else()
|
||||
target_link_libraries(rpcs3 png_static)
|
||||
endif()
|
||||
# Link Discord Rich Presence, but only on Linux
|
||||
if(CMAKE_SYSTEM MATCHES "Linux")
|
||||
target_link_libraries(rpcs3 "${RPCS3_SRC_DIR}/../3rdparty/discord-rpc/lib/libdiscord-rpc-linux.a")
|
||||
elseif(APPLE)
|
||||
target_link_libraries(rpcs3 "${RPCS3_SRC_DIR}/../3rdparty/discord-rpc/lib/libdiscord-rpc-mac.a" objc "-framework Foundation" "-framework CoreServices")
|
||||
endif()
|
||||
target_link_libraries(rpcs3 ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
|
||||
# For some reason GCC 7 requires manually linking with -latomic
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 7))
|
||||
target_link_libraries(rpcs3 -latomic)
|
||||
endif()
|
||||
|
||||
if(LLVM_FOUND)
|
||||
target_link_libraries(rpcs3 ${LLVM_LIBS})
|
||||
endif()
|
||||
|
||||
target_link_libraries(rpcs3 ${RPCS3_QT_LIBS})
|
||||
|
||||
set_target_properties(rpcs3 PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "${RPCS3_SRC_DIR}/stdafx.h")
|
||||
|
||||
if(MSVC)
|
||||
# Under Windows, some QT DLLs need to be in the same directory of the compiled
|
||||
# RPCS3 binary, so call the windeployqt tool that will take care of copying
|
||||
# them from the local QT installation at the end of the build.
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
add_custom_command(TARGET rpcs3 POST_BUILD
|
||||
COMMAND $ENV{QTDIR}/bin/windeployqt --no-angle --no-opengl-sw --no-svg --no-translations --no-quick --plugindir "${CMAKE_BINARY_DIR}/bin/qt/plugins" --debug "${CMAKE_BINARY_DIR}/bin"
|
||||
)
|
||||
else()
|
||||
add_custom_command(TARGET rpcs3 POST_BUILD
|
||||
COMMAND $ENV{QTDIR}/bin/windeployqt --no-angle --no-opengl-sw --no-svg --no-translations --no-quick --plugindir "${CMAKE_BINARY_DIR}/bin/qt/plugins" "${CMAKE_BINARY_DIR}/bin"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
set_target_properties(rpcs3 PROPERTIES
|
||||
COTIRE_CXX_PREFIX_HEADER_INIT "${RPCS3_SRC_DIR}/stdafx.h"
|
||||
COTIRE_ADD_UNITY_BUILD OFF)
|
||||
|
||||
cotire(rpcs3)
|
||||
|
||||
if (UNIX)
|
||||
# Copy icons to executable directory
|
||||
add_custom_command( TARGET rpcs3 POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${CMAKE_SOURCE_DIR}/bin/Icons $<TARGET_FILE_DIR:rpcs3>/Icons)
|
||||
# Copy icons to executable directory
|
||||
add_custom_command(TARGET rpcs3 POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${CMAKE_SOURCE_DIR}/bin/Icons $<TARGET_FILE_DIR:rpcs3>/Icons)
|
||||
endif()
|
||||
|
||||
# Unix installation
|
||||
|
125
rpcs3/Emu/CMakeLists.txt
Normal file
125
rpcs3/Emu/CMakeLists.txt
Normal file
@ -0,0 +1,125 @@
|
||||
file(GLOB SRC_FILES "*.cpp")
|
||||
|
||||
add_library(rpcs3_emu ${SRC_FILES})
|
||||
|
||||
target_link_libraries(rpcs3_emu
|
||||
PRIVATE
|
||||
3rdparty::zlib 3rdparty::yaml-cpp)
|
||||
|
||||
# For stdafx.h
|
||||
target_include_directories(rpcs3_emu
|
||||
PUBLIC
|
||||
${RPCS3_SRC_DIR})
|
||||
|
||||
|
||||
# Utilities
|
||||
file(GLOB UTILITIES_SRC_FILES "../../Utilities/*.cpp")
|
||||
target_sources(rpcs3_emu PRIVATE ${UTILITIES_SRC_FILES})
|
||||
|
||||
target_include_directories(rpcs3_emu PUBLIC "${CMAKE_SOURCE_DIR}")
|
||||
|
||||
target_link_libraries(rpcs3_emu
|
||||
PUBLIC
|
||||
3rdparty::pugixml
|
||||
3rdparty::gsl)
|
||||
|
||||
set_source_files_properties("../../Utilities/JIT.cpp" PROPERTIES COMPILE_FLAGS -fno-rtti)
|
||||
|
||||
|
||||
# Crypto
|
||||
file(GLOB CRYPTO_SRC_FILES "../Crypto/*.cpp")
|
||||
target_sources(rpcs3_emu PRIVATE ${CRYPTO_SRC_FILES})
|
||||
|
||||
# Loader
|
||||
file(GLOB LOADER_SRC_FILES "../Loader/*.cpp")
|
||||
target_sources(rpcs3_emu PRIVATE ${LOADER_SRC_FILES})
|
||||
|
||||
|
||||
# Audio
|
||||
file(GLOB_RECURSE AUDIO_SRC_FILES "Audio/*.cpp")
|
||||
target_sources(rpcs3_emu PRIVATE ${AUDIO_SRC_FILES})
|
||||
|
||||
if(WIN32)
|
||||
# Slimmed down version of minidx9 for XAudio2_7 only
|
||||
include_directories(BEFORE "${RPCS3_SRC_DIR}/../3rdparty/XAudio2_7")
|
||||
endif()
|
||||
|
||||
target_link_libraries(rpcs3_emu
|
||||
PRIVATE
|
||||
3rdparty::alsa 3rdparty::pulse 3rdparty::openal)
|
||||
|
||||
|
||||
# Cell
|
||||
file(GLOB_RECURSE CELL_SRC_FILES "Cell/*.cpp")
|
||||
target_sources(rpcs3_emu PRIVATE ${CELL_SRC_FILES})
|
||||
|
||||
if(NOT MSVC)
|
||||
set_source_files_properties(Cell/PPUTranslator.cpp PROPERTIES COMPILE_FLAGS -fno-rtti)
|
||||
endif()
|
||||
|
||||
target_link_libraries(rpcs3_emu
|
||||
PRIVATE
|
||||
3rdparty::stblib 3rdparty::libpng)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 7))
|
||||
target_link_libraries(rpcs3_emu PUBLIC -latomic)
|
||||
endif()
|
||||
|
||||
|
||||
# CPU
|
||||
file(GLOB_RECURSE CPU_SRC_FILES "CPU/*.cpp")
|
||||
target_sources(rpcs3_emu PRIVATE ${CPU_SRC_FILES})
|
||||
|
||||
target_link_libraries(rpcs3_emu
|
||||
PRIVATE 3rdparty::llvm 3rdparty::asmjit)
|
||||
|
||||
|
||||
# Io
|
||||
file(GLOB_RECURSE IO_SRC_FILES "Io/*.cpp")
|
||||
target_sources(rpcs3_emu PRIVATE ${IO_SRC_FILES})
|
||||
|
||||
|
||||
# Memory
|
||||
file(GLOB_RECURSE MEMORY_SRC_FILES "Memory/*.cpp")
|
||||
target_sources(rpcs3_emu PRIVATE ${MEMORY_SRC_FILES})
|
||||
|
||||
|
||||
# RSX
|
||||
file(GLOB RSX_SRC_FILES
|
||||
"RSX/*.cpp"
|
||||
"RSX/Common/*.cpp"
|
||||
"RSX/Null/*.cpp"
|
||||
"RSX/Overlays/*.cpp"
|
||||
"RSX/Capture/*.cpp"
|
||||
"RSX/GL/*.cpp")
|
||||
|
||||
if(TARGET 3rdparty_vulkan)
|
||||
file(GLOB VULKAN_SRCS "RSX/VK/*.cpp")
|
||||
list(APPEND RSX_SRC_FILES ${VULKAN_SRCS})
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
file(GLOB DX12_SRCS "RSX/D3D12/*.cpp")
|
||||
list(APPEND RSX_SRC_FILES ${DX12_SRCS})
|
||||
endif()
|
||||
|
||||
target_sources(rpcs3_emu PRIVATE ${RSX_SRC_FILES})
|
||||
|
||||
target_link_libraries(rpcs3_emu
|
||||
PUBLIC
|
||||
3rdparty::ffmpeg 3rdparty::cereal
|
||||
3rdparty::opengl 3rdparty::stblib
|
||||
3rdparty::vulkan
|
||||
PRIVATE
|
||||
3rdparty::gsl 3rdparty::xxhash
|
||||
3rdparty::dx12 3rdparty::glew)
|
||||
|
||||
|
||||
# Setup cotire
|
||||
option(UNITY_BUILD_EMU "Use unity build for rpcs3_emu target" OFF)
|
||||
|
||||
set_target_properties(rpcs3_emu PROPERTIES
|
||||
COTIRE_CXX_PREFIX_HEADER_INIT "${RPCS3_SRC_DIR}/stdafx.h"
|
||||
COTIRE_ADD_UNITY_BUILD ${UNITY_BUILD_EMU})
|
||||
|
||||
cotire(rpcs3_emu)
|
@ -4,8 +4,8 @@
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include "stdafx.h"
|
||||
#include "../../Utilities/Config.h"
|
||||
#include "../../Utilities/types.h"
|
||||
#include "Utilities/Config.h"
|
||||
#include "Utilities/types.h"
|
||||
#include "Emu/System.h"
|
||||
|
||||
// TODO: HLE info (constants, structs, etc.) should not be available here
|
||||
|
6
rpcs3/Emu/RSX/D3D12/CMakeLists.txt
Normal file
6
rpcs3/Emu/RSX/D3D12/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
file(GLOB SRC_FILES "*.cpp")
|
||||
|
||||
add_library(rpcs3_rsx_dx12 ${SRC_FILES})
|
||||
target_link_libraries(rpcs3_rsx_dx12
|
||||
PRIVATE
|
||||
rpcs3_stdafx 3rdparty::gsl 3rdparty::optional)
|
6
rpcs3/Emu/RSX/GL/CMakeLists.txt
Normal file
6
rpcs3/Emu/RSX/GL/CMakeLists.txt
Normal file
@ -0,0 +1,6 @@
|
||||
file(GLOB SRC_FILES "*.cpp")
|
||||
|
||||
add_library(rpcs3_rsx_gl ${SRC_FILES})
|
||||
target_link_libraries(rpcs3_rsx_gl
|
||||
PRIVATE
|
||||
rpcs3_stdafx 3rdparty::opengl 3rdparty::gsl 3rdparty::optional 3rdparty::cereal)
|
@ -14,7 +14,6 @@
|
||||
#include "rsx_methods.h"
|
||||
#include "rsx_utils.h"
|
||||
#include "Overlays/overlays.h"
|
||||
#include <Utilities/GSL.h>
|
||||
|
||||
#include "Utilities/Thread.h"
|
||||
#include "Utilities/geometry.h"
|
||||
|
@ -1,4 +1,3 @@
|
||||
cmake_minimum_required(VERSION 3.8.2)
|
||||
# Check and configure compiler options for RPCS3
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
@ -25,3 +24,65 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
||||
add_compile_options(-stdlib=libc++)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-pch -fexceptions")
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-command-line-argument")
|
||||
endif()
|
||||
|
||||
# This hides our LLVM from mesa's LLVM, otherwise we get some unresolvable conflicts.
|
||||
if(NOT APPLE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--exclude-libs,ALL")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(CMAKE_RC_COMPILER_INIT windres)
|
||||
enable_language(RC)
|
||||
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
|
||||
|
||||
# Workaround for mingw64 (MSYS2)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--allow-multiple-definition")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_FORMAT_MACROS=1")
|
||||
endif()
|
||||
|
||||
add_compile_options(-msse -msse2 -mcx16)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
# This fixes 'some' of the st11range issues. See issue #2516
|
||||
if(APPLE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-image_base,0x10000 -Wl,-pagezero_size,0x10000")
|
||||
else()
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -image-base=0x10000")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Some distros have the compilers set to use PIE by default, but RPCS3 doesn't work with PIE, so we need to disable it.
|
||||
if(APPLE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-no_pie")
|
||||
else()
|
||||
CHECK_CXX_COMPILER_FLAG("-no-pie" HAS_NO_PIE)
|
||||
CHECK_CXX_COMPILER_FLAG("-nopie" HAS_NOPIE)
|
||||
|
||||
if(HAS_NO_PIE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie")
|
||||
elseif(HAS_NOPIE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -nopie")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:throwingNew /D _CRT_SECURE_NO_DEPRECATE=1 /D _CRT_NON_CONFORMING_SWPRINTFS=1 /D _SCL_SECURE_NO_WARNINGS=1")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D _ENABLE_EXTENDED_ALIGNED_STORAGE=1")
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS /DYNAMICBASE:NO /BASE:0x10000 /FIXED")
|
||||
endif()
|
||||
|
||||
if(USE_NATIVE_INSTRUCTIONS)
|
||||
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||
if(COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||
add_compile_options(-march=native)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -1,13 +1,13 @@
|
||||
#include "pad_thread.h"
|
||||
#include "../ds4_pad_handler.h"
|
||||
#include "ds4_pad_handler.h"
|
||||
#ifdef _WIN32
|
||||
#include "../xinput_pad_handler.h"
|
||||
#include "../mm_joystick_handler.h"
|
||||
#include "xinput_pad_handler.h"
|
||||
#include "mm_joystick_handler.h"
|
||||
#elif HAVE_LIBEVDEV
|
||||
#include "../evdev_joystick_handler.h"
|
||||
#include "evdev_joystick_handler.h"
|
||||
#endif
|
||||
#include "../keyboard_pad_handler.h"
|
||||
#include "../Emu/Io/Null/NullPadHandler.h"
|
||||
#include "keyboard_pad_handler.h"
|
||||
#include "Emu/Io/Null/NullPadHandler.h"
|
||||
|
||||
|
||||
pad_thread::pad_thread(void *_curthread, void *_curwindow) : curthread(_curthread), curwindow(_curwindow)
|
||||
|
21
rpcs3/rpcs3qt/CMakeLists.txt
Normal file
21
rpcs3/rpcs3qt/CMakeLists.txt
Normal file
@ -0,0 +1,21 @@
|
||||
file(GLOB SRC_FILES "*.cpp")
|
||||
|
||||
file(GLOB UI_FILES "*.ui")
|
||||
|
||||
add_library(rpcs3_ui ${SRC_FILES} ${UI_FILES})
|
||||
|
||||
set_target_properties(rpcs3_ui
|
||||
PROPERTIES
|
||||
AUTOMOC ON
|
||||
AUTOUIC ON)
|
||||
|
||||
target_link_libraries(rpcs3_ui
|
||||
PUBLIC
|
||||
3rdparty::qt5 3rdparty::yaml-cpp
|
||||
|
||||
PRIVATE
|
||||
rpcs3_emu
|
||||
3rdparty::zlib 3rdparty::pugixml
|
||||
3rdparty::discord-rpc
|
||||
3rdparty::hidapi)
|
||||
|
Loading…
Reference in New Issue
Block a user