rpcs3/buildfiles/cmake/ConfigureCompiler.cmake

124 lines
4.5 KiB
CMake
Raw Normal View History

# Check and configure compiler options for RPCS3
2019-06-23 07:54:42 +02:00
if(MSVC)
clang-cl ffmpeg Update rpcs3.yml Update rpcs3.yml Update rpcs3.yml folded scalar with neg newline x64-windows-release x64-windows-rel if: "!cancelled()" vcpkg_build_type Update rpcs3.yml no ccache ${{github.run_id}} zlib vcpkg qt vulkan ffmpeg llvm build with clang-cl Create build-windows-clang-cl.ps1 llvm --keep-going llvm[clang,core,tools,lld,target-x86]:x64-windows-release llvm:x64-windows-release@17.0.2 llvm with debug on Create vcpkg.json Update rpcs3.yml ffmpeg features vcpkg nuget minimal vcpkg.json Update rpcs3.yml fetch nuget more packages vcpkg.json libpng vcpkg classic cmake 3.29.0 Rename vcpkg.json to x_vcpkg.json Update rpcs3.yml Update rpcs3.yml llvm Update rpcs3.yml git llvm LLVM with cache Update rpcs3.yml Update rpcs3.yml build llvm LLVM_TARGETS_TO_BUILD="X86" llvm binary set path build rpcs3 DIA SDK Update rpcs3.yml Update rpcs3.yml Update rpcs3.yml fix conditionals fix conditionals set shell VCPKG env vars DIA SDK Update asm.hpp Update types.hpp Update aesni.cpp Update CMakeLists.txt Update ConfigureCompiler.cmake Update StrFmt.cpp Update CMakeLists.txt Update CMakeLists.txt Build with changes Update CMakeLists.txt D:\a\rpcs3\rpcs3\llvm D:\a\rpcs3\rpcs3\llvm llvm-* llvm-${{ matrix.llvmver }} clangpath llvm-* $llvmver $clangPath $clangPath include bin rm duplicate "add_compile_options" USE_SYSTEM_ZSTD USE_SYSTEM_ZSTD USE_SYSTEM_ZSTD USE_SYSTEM_ZSTD zstd Update CMakeLists.txt PkgConfig zstd zstd::zstd ALIAS PkgConfig::libzstd clang-cl only cache hit Update CMakeLists.txt cache-hit cache vcpkg/vcpkg.exe NOT USE_SYSTEM_ZSTD vcpkg_root revert zstd Update CMakeLists.txt Update CMakeLists.txt Update CMakeLists.txt /defaultlib:zstd_static.lib Remove else /defaultlib:zstd.lib Zstd ahared Nodefaultlib Create Findzstd.cmake zstd CMakeLists.txt not use zstd system CMakeLists.txt dont add 3rdparty::libzstd add_library(PkgConfig::libzstd ALIAS 3rdparty::zstd) add_library(PkgConfig::libzstd ALIAS 3rdparty::zstd) add_library(3rdparty::libzstd ALIAS PkgConfig::zstd) add_library(3rdparty::zstd ALIAS PkgConfig::zstd) Update Findzstd.cmake zstd::zstd Update CMakeLists.txt zstd::zstd zstd::zstd CMakeLists.txt PkgConfig::libzstd CMakeLists.txt zstd::libzstd Update CMakeLists.txt Update CMakeLists.txt vcpkg zstd CMakeLists.txt MODULES CMakeLists.txt zstd::libzstd add_library(3rdparty::7zip ALIAS 3rdparty_7zip) LLVM Static-link on set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Release>:Release>") set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded") Update CMakeLists.txt message(STATUS "MSVC Runtime Library: ${CMAKE_MSVC_RUNTIME_LIBRARY}") revert CMakeLists.txt DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" rpcs3_emu SHARED STATIC CMakeLists.txt cmake_policy(SET CMP0091 NEW) LLVM_AVAILABLE=ON add_compile_definitions(LLVM_AVAILABLE=true) add_compile_options(/MT) LLVM_AVAILABLE=1 add_compile_definitions(_DISABLE_STRING_ANNOTATION=1 _DISABLE_VECTOR_ANNOTATION=1) Update build-windows-clang-cl.ps1 clang msvc17-msvcrt rm compressed archve cachee name cache name again builtin clang-rt build all set $llvmPath extract into llvm copy with -verbose mv destination path build llvm cache $clangPath full build LLVM static LLVM -> LLVMCore STATIC_LINK_LLVM=OFF no lookup llvm bin dir revert revert revert LLVMCore -> LLVM LLVM -> LLVM-C llvm_map_components_to_libnames Update CMakeLists.txt LLVM CMakeLists.txt LLVM_DIR=$llvmPath MultiThreadedDLL CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON clang-cl version cmake -v --log-level=VERBOSE built-in LLVM llvm lib folder PF short name built-in LLVM/Clang 20.1.8 mt.exe path Use llvm-mt "$clangPath/llvm-mt.exe" fix terminator Add winqtdeploy to PATH Test windeployqt6.exe with version Missing ) No winqtdeploy Build no quotes prep artifacts no winqtdeploy $VcpkgWindeployqt --version $($VcpkgWindeployqt) --version --version Invoke-Expression Update build-windows-clang-cl.ps1 rpcs3_win_clang.7z rpcs3 artifacts dir cp artifacts build/bin dir clone recent asmjit Update build-windows-clang-cl.ps1 CMAKE_CXX_SCAN_FOR_MODULES=ON default-openal USE_NATIVE_INSTRUCTIONS=ON Update ConfigureCompiler.cmake USE_NATIVE_INSTRUCTIONS=OFF / rm 512 instuctions revert set(LLVM_LIBS LLVM) COMPILER_X86 only add_compile_options(-msse -msse2 -mcx16 -mavx512f -mavx -mavx2 -maes -mrtm -mpclmul -mmwaitx -mwaitpkg) avx512 flags add_compile_options(-march=native) check_cxx_compiler_flag("-march=native" add_compile_options(-maes -mrtm -mpclmul -mmwaitx -mwaitpkg) COMMAND Qt6::windeployqt --version COMMAND Qt6::windeployqt $<TARGET_FILE:rpcs3> add vcpkg bin to PATH check vcpkg is added to PATH update PATH cache [System.EnvironmentVariableTarget]::Machine display all paths cmd.exe /c "echo %PATH%" make windeployqt verbose verbose 2 Invoke-Expression "cmd.exe /c "set PATH=%PATH%;$VcpkgBin"" Update build-windows-clang-cl.ps1 no invoke cmd.exe /c "set PATH=$VcpkgBin;%PATH%" --ignore-library-errors -DQTPATH_EXE="$VcpkgQtpath" no --ignore-library-errors Update CMakeLists.txt Update CMakeLists.txt Update CMakeLists.txt Update CMakeLists.txt Update CMakeLists.txt Update CMakeLists.txt Update CMakeLists.txt Update CMakeLists.txt change \ to / ${WINDEPLOYQT_EXECUTABLE} Qt6::windeployqt gci vcpkg tools bin --ignore-library-errors x64-windows/tools VCPKG_TRIPLET: x64-windows Save vcpkg cache revert revert remove MSVC runtime message revert rm dupes revert Delete buildfiles/cmake/Findzstd.cmake WINDEPLOYQT_EXECUTABLE Delete x_vcpkg.json add AVX512 compile options Wno-deprecated-anon-enum-enum-conversion clean-up silence warnings terminate properly set PRIVATE CFLAGS --no-vulkan rm vulkan lib at package step override cflags remove OpenGL_GL_PREFERENCE=LEGACY rm --no-vulkan switch Update CMakeLists.txt restore LLVM dir ASMJIT_CMAKE_FLAGS revert order check_cxx_compiler_flag Wno-unused-value revert revert Update CMakeLists.txt Update llvm_build_clang_cl.vcxproj Update llvm_build_clang_cl.vcxproj Update rpcs3.yml go to deploy if successful Create deploy-windows-clang-cl.sh build then deploy Update build-windows-clang-cl.ps1 deploy step test Update ProgramStateCache.cpp remove AVX512 Update JITLLVM.cpp FFMPEG 8.0 FFMPEG 8.0 LLVM 21 LLVM 21 set CMAKE_MSVC_RUNTIME_LIBRARY update OpenAL msys2 clang git openal-soft reset update yaml reset to master reset to master "Build succeeded" ALSOFT_ENABLE_MODULES OFF Build All Jobs Run Builds when not on Main branch Win Qt 6.9.3 Update build-mac-arm64.sh Update build-mac.sh Create TCDarwinX86_64.cmake
2025-07-20 06:02:56 +02:00
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
check_cxx_compiler_flag("-msse -msse2 -mcx16" COMPILER_X86)
check_cxx_compiler_flag("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
if (COMPILER_X86)
2025-10-31 15:37:56 +01:00
add_compile_options(-msse -msse2 -mcx16)
clang-cl ffmpeg Update rpcs3.yml Update rpcs3.yml Update rpcs3.yml folded scalar with neg newline x64-windows-release x64-windows-rel if: "!cancelled()" vcpkg_build_type Update rpcs3.yml no ccache ${{github.run_id}} zlib vcpkg qt vulkan ffmpeg llvm build with clang-cl Create build-windows-clang-cl.ps1 llvm --keep-going llvm[clang,core,tools,lld,target-x86]:x64-windows-release llvm:x64-windows-release@17.0.2 llvm with debug on Create vcpkg.json Update rpcs3.yml ffmpeg features vcpkg nuget minimal vcpkg.json Update rpcs3.yml fetch nuget more packages vcpkg.json libpng vcpkg classic cmake 3.29.0 Rename vcpkg.json to x_vcpkg.json Update rpcs3.yml Update rpcs3.yml llvm Update rpcs3.yml git llvm LLVM with cache Update rpcs3.yml Update rpcs3.yml build llvm LLVM_TARGETS_TO_BUILD="X86" llvm binary set path build rpcs3 DIA SDK Update rpcs3.yml Update rpcs3.yml Update rpcs3.yml fix conditionals fix conditionals set shell VCPKG env vars DIA SDK Update asm.hpp Update types.hpp Update aesni.cpp Update CMakeLists.txt Update ConfigureCompiler.cmake Update StrFmt.cpp Update CMakeLists.txt Update CMakeLists.txt Build with changes Update CMakeLists.txt D:\a\rpcs3\rpcs3\llvm D:\a\rpcs3\rpcs3\llvm llvm-* llvm-${{ matrix.llvmver }} clangpath llvm-* $llvmver $clangPath $clangPath include bin rm duplicate "add_compile_options" USE_SYSTEM_ZSTD USE_SYSTEM_ZSTD USE_SYSTEM_ZSTD USE_SYSTEM_ZSTD zstd Update CMakeLists.txt PkgConfig zstd zstd::zstd ALIAS PkgConfig::libzstd clang-cl only cache hit Update CMakeLists.txt cache-hit cache vcpkg/vcpkg.exe NOT USE_SYSTEM_ZSTD vcpkg_root revert zstd Update CMakeLists.txt Update CMakeLists.txt Update CMakeLists.txt /defaultlib:zstd_static.lib Remove else /defaultlib:zstd.lib Zstd ahared Nodefaultlib Create Findzstd.cmake zstd CMakeLists.txt not use zstd system CMakeLists.txt dont add 3rdparty::libzstd add_library(PkgConfig::libzstd ALIAS 3rdparty::zstd) add_library(PkgConfig::libzstd ALIAS 3rdparty::zstd) add_library(3rdparty::libzstd ALIAS PkgConfig::zstd) add_library(3rdparty::zstd ALIAS PkgConfig::zstd) Update Findzstd.cmake zstd::zstd Update CMakeLists.txt zstd::zstd zstd::zstd CMakeLists.txt PkgConfig::libzstd CMakeLists.txt zstd::libzstd Update CMakeLists.txt Update CMakeLists.txt vcpkg zstd CMakeLists.txt MODULES CMakeLists.txt zstd::libzstd add_library(3rdparty::7zip ALIAS 3rdparty_7zip) LLVM Static-link on set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Release>:Release>") set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded") Update CMakeLists.txt message(STATUS "MSVC Runtime Library: ${CMAKE_MSVC_RUNTIME_LIBRARY}") revert CMakeLists.txt DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" rpcs3_emu SHARED STATIC CMakeLists.txt cmake_policy(SET CMP0091 NEW) LLVM_AVAILABLE=ON add_compile_definitions(LLVM_AVAILABLE=true) add_compile_options(/MT) LLVM_AVAILABLE=1 add_compile_definitions(_DISABLE_STRING_ANNOTATION=1 _DISABLE_VECTOR_ANNOTATION=1) Update build-windows-clang-cl.ps1 clang msvc17-msvcrt rm compressed archve cachee name cache name again builtin clang-rt build all set $llvmPath extract into llvm copy with -verbose mv destination path build llvm cache $clangPath full build LLVM static LLVM -> LLVMCore STATIC_LINK_LLVM=OFF no lookup llvm bin dir revert revert revert LLVMCore -> LLVM LLVM -> LLVM-C llvm_map_components_to_libnames Update CMakeLists.txt LLVM CMakeLists.txt LLVM_DIR=$llvmPath MultiThreadedDLL CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON clang-cl version cmake -v --log-level=VERBOSE built-in LLVM llvm lib folder PF short name built-in LLVM/Clang 20.1.8 mt.exe path Use llvm-mt "$clangPath/llvm-mt.exe" fix terminator Add winqtdeploy to PATH Test windeployqt6.exe with version Missing ) No winqtdeploy Build no quotes prep artifacts no winqtdeploy $VcpkgWindeployqt --version $($VcpkgWindeployqt) --version --version Invoke-Expression Update build-windows-clang-cl.ps1 rpcs3_win_clang.7z rpcs3 artifacts dir cp artifacts build/bin dir clone recent asmjit Update build-windows-clang-cl.ps1 CMAKE_CXX_SCAN_FOR_MODULES=ON default-openal USE_NATIVE_INSTRUCTIONS=ON Update ConfigureCompiler.cmake USE_NATIVE_INSTRUCTIONS=OFF / rm 512 instuctions revert set(LLVM_LIBS LLVM) COMPILER_X86 only add_compile_options(-msse -msse2 -mcx16 -mavx512f -mavx -mavx2 -maes -mrtm -mpclmul -mmwaitx -mwaitpkg) avx512 flags add_compile_options(-march=native) check_cxx_compiler_flag("-march=native" add_compile_options(-maes -mrtm -mpclmul -mmwaitx -mwaitpkg) COMMAND Qt6::windeployqt --version COMMAND Qt6::windeployqt $<TARGET_FILE:rpcs3> add vcpkg bin to PATH check vcpkg is added to PATH update PATH cache [System.EnvironmentVariableTarget]::Machine display all paths cmd.exe /c "echo %PATH%" make windeployqt verbose verbose 2 Invoke-Expression "cmd.exe /c "set PATH=%PATH%;$VcpkgBin"" Update build-windows-clang-cl.ps1 no invoke cmd.exe /c "set PATH=$VcpkgBin;%PATH%" --ignore-library-errors -DQTPATH_EXE="$VcpkgQtpath" no --ignore-library-errors Update CMakeLists.txt Update CMakeLists.txt Update CMakeLists.txt Update CMakeLists.txt Update CMakeLists.txt Update CMakeLists.txt Update CMakeLists.txt Update CMakeLists.txt change \ to / ${WINDEPLOYQT_EXECUTABLE} Qt6::windeployqt gci vcpkg tools bin --ignore-library-errors x64-windows/tools VCPKG_TRIPLET: x64-windows Save vcpkg cache revert revert remove MSVC runtime message revert rm dupes revert Delete buildfiles/cmake/Findzstd.cmake WINDEPLOYQT_EXECUTABLE Delete x_vcpkg.json add AVX512 compile options Wno-deprecated-anon-enum-enum-conversion clean-up silence warnings terminate properly set PRIVATE CFLAGS --no-vulkan rm vulkan lib at package step override cflags remove OpenGL_GL_PREFERENCE=LEGACY rm --no-vulkan switch Update CMakeLists.txt restore LLVM dir ASMJIT_CMAKE_FLAGS revert order check_cxx_compiler_flag Wno-unused-value revert revert Update CMakeLists.txt Update llvm_build_clang_cl.vcxproj Update llvm_build_clang_cl.vcxproj Update rpcs3.yml go to deploy if successful Create deploy-windows-clang-cl.sh build then deploy Update build-windows-clang-cl.ps1 deploy step test Update ProgramStateCache.cpp remove AVX512 Update JITLLVM.cpp FFMPEG 8.0 FFMPEG 8.0 LLVM 21 LLVM 21 set CMAKE_MSVC_RUNTIME_LIBRARY update OpenAL msys2 clang git openal-soft reset update yaml reset to master reset to master "Build succeeded" ALSOFT_ENABLE_MODULES OFF Build All Jobs Run Builds when not on Main branch Win Qt 6.9.3 Update build-mac-arm64.sh Update build-mac.sh Create TCDarwinX86_64.cmake
2025-07-20 06:02:56 +02:00
endif()
if(COMPILER_SUPPORTS_MARCH_NATIVE)
add_compile_options(-march=native)
endif()
else()
add_compile_options(/Zc:throwingNew- /constexpr:steps16777216)
endif()
add_compile_definitions(
_CRT_SECURE_NO_DEPRECATE=1 _CRT_NON_CONFORMING_SWPRINTFS=1 _SCL_SECURE_NO_WARNINGS=1
NOMINMAX _ENABLE_EXTENDED_ALIGNED_STORAGE=1 _HAS_EXCEPTIONS=0)
#TODO: Some of these could be cleaned up
add_compile_options(/wd4805) # Comparing boolean and int
add_compile_options(/wd4804) # Using integer operators with booleans
add_compile_options(/wd4200) # Zero-sized array in struct/union
# MSVC 2017 uses iterator as base class internally, causing a lot of warning spam
add_compile_definitions(_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING=1)
2019-06-23 07:54:42 +02:00
# Increase stack limit to 8 MB
add_link_options(/STACK:8388608,1048576)
2019-06-23 07:54:42 +02:00
else()
check_cxx_compiler_flag("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
check_cxx_compiler_flag("-msse -msse2 -mcx16" COMPILER_X86)
if (APPLE)
check_cxx_compiler_flag("-march=armv8.4-a" COMPILER_ARM)
else()
check_cxx_compiler_flag("-march=armv8.1-a" COMPILER_ARM)
endif()
2019-05-10 19:24:14 +02:00
add_compile_options(-Wall)
add_compile_options(-fno-exceptions)
2021-02-08 16:47:03 +01:00
add_compile_options(-fstack-protector)
if(USE_NATIVE_INSTRUCTIONS AND COMPILER_SUPPORTS_MARCH_NATIVE)
add_compile_options(-march=native)
elseif(COMPILER_ARM)
2024-02-11 00:15:06 +01:00
# This section needs a review. Apple claims armv8.5-a on M-series but doesn't support SVE.
# Note that compared to the rest of the 8.x family, 8.1 is very restrictive and we'll have to bump the requirement in future to get anything meaningful.
if (APPLE)
add_compile_options(-march=armv8.4-a)
else()
add_compile_options(-march=armv8.1-a)
endif()
2024-02-11 00:15:06 +01:00
elseif(COMPILER_X86)
# Some compilers will set both X86 and ARM, so check explicitly for ARM first
add_compile_options(-msse -msse2 -mcx16)
endif()
2019-12-04 21:56:19 +01:00
add_compile_options(-Werror=old-style-cast)
add_compile_options(-Werror=sign-compare)
add_compile_options(-Werror=reorder)
add_compile_options(-Werror=return-type)
add_compile_options(-Werror=overloaded-virtual)
add_compile_options(-Werror=missing-noreturn)
add_compile_options(-Werror=implicit-fallthrough)
2021-03-05 20:05:37 +01:00
add_compile_options(-Wunused-parameter)
add_compile_options(-Wignored-qualifiers)
2021-03-21 16:02:21 +01:00
add_compile_options(-Wredundant-move)
add_compile_options(-Wcast-qual)
add_compile_options(-Wdeprecated-copy)
2021-03-13 21:01:37 +01:00
add_compile_options(-Wtautological-compare)
#add_compile_options(-Wshadow)
#add_compile_options(-Wconversion)
#add_compile_options(-Wpadded)
add_compile_options(-Wempty-body)
2021-03-23 20:32:50 +01:00
add_compile_options(-Wredundant-decls)
2021-04-19 10:11:24 +02:00
#add_compile_options(-Weffc++)
add_compile_options(-Wstrict-aliasing=1)
2021-03-01 13:03:00 +01:00
#add_compile_options(-Wnull-dereference)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Werror=inconsistent-missing-override)
add_compile_options(-Werror=delete-non-virtual-dtor)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-Werror=suggest-override)
add_compile_options(-Wclobbered)
# add_compile_options(-Wcast-function-type)
2021-03-13 16:03:08 +01:00
add_compile_options(-Wduplicated-branches)
2021-03-13 16:46:59 +01:00
add_compile_options(-Wduplicated-cond)
endif()
2019-06-23 07:54:42 +02:00
#TODO Clean the code so these are removed
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-fconstexpr-steps=16777216)
2019-06-23 07:54:42 +02:00
add_compile_options(-Wno-unused-lambda-capture)
add_compile_options(-Wno-unused-private-field)
add_compile_options(-Wno-unused-command-line-argument)
add_compile_options(-Wno-elaborated-enum-base)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
2019-06-23 07:54:42 +02:00
add_compile_options(-Wno-class-memaccess)
endif()
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
2018-09-18 12:07:33 +02:00
# Note that this refers to binary size optimization during linking, it differs from optimization compiler level
add_link_options(-Wl,-O2)
2019-06-23 07:54:42 +02:00
if(NOT APPLE AND NOT WIN32)
# This hides our LLVM from mesa's LLVM, otherwise we get some unresolvable conflicts.
add_link_options(-Wl,--exclude-libs,ALL)
2019-06-23 07:54:42 +02:00
elseif(WIN32)
add_compile_definitions(__STDC_FORMAT_MACROS=1)
2019-06-23 07:54:42 +02: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
2018-09-18 12:07:33 +02:00
# Workaround for mingw64 (MSYS2)
add_link_options(-Wl,--allow-multiple-definition)
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
2018-09-18 12:07:33 +02:00
# Increase stack limit to 8 MB
add_link_options(-Wl,--stack -Wl,8388608)
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
2018-09-18 12:07:33 +02:00
endif()
2024-09-07 17:17:12 +02:00
2024-09-08 13:50:36 +02:00
# Specify C++ library to use as standard C++ when using clang (not required on linux due to GNU)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND (APPLE OR WIN32))
2024-09-07 17:17:12 +02:00
add_compile_options(-stdlib=libc++)
endif()
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
2018-09-18 12:07:33 +02:00
endif()