Closed KonstantinDjairo closed 1 year ago
I'm not opposed but I am curious as to why using package.env is insufficient for this?
as you can see in th cemu guide for compiling with clang, it's a different process
If you put this setup:
/etc/portage/env/compiler-clang
(hardening is optional):
LDFLAGS="${LDFLAGS} -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,--as-needed"
# Hardening
_HARDENING_FLAGS="-fPIC -fstack-protector-strong -D_FORTIFY_SOURCE=2"
CFLAGS="${CFLAGS} ${_HARDENING_FLAGS}"
CXXFLAGS="${CXXFLAGS} ${_HARDENING_FLAGS}"
LDFLAGS="${LDFLAGS} -Wl,-z,relro,-z,now -pie"
CC="clang"
CXX="clang++"
/etc/portage/package.env/build-with-clang
:
games-emulation/cemu
Then in the build log:
cmake -C /var/tmp/portage/games-emulation/cemu-2.0_p20221126/work/Cemu-523a0e1706d5c400103ef00172b9923a943954b3_build/gentoo_common_config.cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=OFF -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=yes -DENABLE_CUBEB=ON -DENABLE_DISCORD_RPC=OFF -DENABLE_OPENGL=ON -DENABLE_SDL=ON -DENABLE_VULKAN=ON -DENABLE_WXWIDGETS=ON -DPORTABLE=OFF -DwxWidgets_CONFIG_EXECUTABLE=/usr/lib64/wx/config/gtk3-unicode-3.2-gtk3 -Wno-dev -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=/var/tmp/portage/games-emulation/cemu-2.0_p20221126/work/Cemu-523a0e1706d5c400103ef00172b9923a943954b3_build/gentoo_toolchain.cmake /var/tmp/portage/games-emulation/cemu-2.0_p20221126/work/Cemu-523a0e1706d5c400103ef00172b9923a943954b3
loading initial cache file /var/tmp/portage/games-emulation/cemu-2.0_p20221126/work/Cemu-523a0e1706d5c400103ef00172b9923a943954b3_build/gentoo_common_config.cmake
-- The C compiler identification is Clang 15.0.5
-- The CXX compiler identification is Clang 15.0.5
Gentoo ebuilds do not use the CMAKE_C_COMPILER
/CMAKE_CXX_COMPILER
options directly. The CMake eclass generates a tooolchain file based on environment variables.
$ cat /var/tmp/portage/games-emulation/cemu-2.0_p20221126/work/Cemu-523a0e1706d5c400103ef00172b9923a943954b3_build/gentoo_toolchain.cmake
set(CMAKE_ASM_COMPILER "clang")
set(CMAKE_ASM-ATT_COMPILER "clang")
set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang++")
thank you
there is a detailed instruction in the cemu's wiki about building with clang it could be really useful to build cemu with clang because it becomes easier to play with build flags using the compiler itself, such as testing static builds which would improve performance and also, some users prefer using clang