diff --git a/.ci/build-linux.sh b/.ci/build-linux.sh index 4e80f532a7..656707f0b7 100755 --- a/.ci/build-linux.sh +++ b/.ci/build-linux.sh @@ -46,6 +46,8 @@ cmake .. \ -DUSE_SYSTEM_CURL=ON \ -DUSE_SDL=OFF \ -DOpenGL_GL_PREFERENCE=LEGACY \ + -DLLVM_DIR=/opt/llvm/lib/cmake/llvm \ + -DSTATIC_LINK_LLVM=ON \ -G Ninja ninja; build_status=$?; diff --git a/.cirrus.yml b/.cirrus.yml index 0fbfebf180..a94da7435d 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -61,7 +61,7 @@ windows_task: linux_task: container: - image: rpcs3/rpcs3-ci-bionic:1.7 + image: rpcs3/rpcs3-ci-bionic:1.8 cpu: 4 memory: 16G env: diff --git a/3rdparty/llvm.cmake b/3rdparty/llvm.cmake index 77f8169099..1b4e20c181 100644 --- a/3rdparty/llvm.cmake +++ b/3rdparty/llvm.cmake @@ -36,21 +36,13 @@ if(WITH_LLVM) set(LLVM_DIR "${CMAKE_BINARY_DIR}/3rdparty/llvm/llvm_build/lib/cmake/llvm/") set(CMAKE_CXX_FLAGS ${CXX_FLAGS_OLD}) + option(STATIC_LINK_LLVM "" ON) # now tries to find LLVM again find_package(LLVM 16.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() - - llvm_map_components_to_libnames(LLVM_LIBS - ${LLVM_TARGETS_TO_BUILD} - Core - ExecutionEngine - IntelJITEvents - MCJIT - ) - else() message(STATUS "Using prebuilt or system LLVM") @@ -70,7 +62,30 @@ if(WITH_LLVM) message(FATAL_ERROR "Can't find LLVM libraries from the CMAKE_PREFIX_PATH path or LLVM_DIR. \ Enable BUILD_LLVM option to build LLVM from included as a git submodule.") endif() + endif() + if (STATIC_LINK_LLVM) + if (NOT DEFINED LLVM_TARGETS_TO_BUILD) + if(COMPILER_ARM) + set(LLVM_TARGETS_TO_BUILD "AArch64;X86" CACHE STRING "Semicolon-separated list of targets to build, or \"all\".") + else() + set(LLVM_TARGETS_TO_BUILD "X86" CACHE STRING "Semicolon-separated list of targets to build, or \"all\".") + endif() + endif() + if(WIN32 OR CMAKE_SYSTEM MATCHES "Linux") + set (LLVM_ADDITIONAL_LIBS ${LLVM_ADDITIONAL_LIBS} IntelJITEvents) + endif() + if(CMAKE_SYSTEM MATCHES "Linux") + set (LLVM_ADDITIONAL_LIBS ${LLVM_ADDITIONAL_LIBS} PerfJITEvents) + endif() + llvm_map_components_to_libnames(LLVM_LIBS + ${LLVM_TARGETS_TO_BUILD} + ${LLVM_ADDITIONAL_LIBS} + Core + ExecutionEngine + MCJIT + ) + else() set(LLVM_LIBS LLVM) endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index f9f20d2b4d..94f3925b7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ endif() 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 "Build LLVM from git submodule" OFF) +option(STATIC_LINK_LLVM "Link against LLVM statically. This will get set to ON if you build LLVM from the submodule." OFF) option(USE_FAUDIO "FAudio audio backend" ON) option(USE_LIBEVDEV "libevdev-based joystick support" ON) option(USE_DISCORD_RPC "Discord rich presence integration" OFF)