Closed ExoSkye closed 2 years ago
Awesome!
I ended up adding another macro, setupPSL1GHTLibrary, that doesn't do any of the elf file manipulation stuff at the end; that allowed some of my code to be built as a static library (.a file) for linking by a latter (S)ELF.
` macro(setupPSL1GHTLibrary target)
if(NOT PSL1GHT)
message(FATAL_ERROR "Location of PSL1GHT SDK not set")
endif()
set(CMAKE_C_COMPILER ${PSL1GHT}/ppu/bin/powerpc64-ps3-elf-gcc)
set(CMAKE_CXX_COMPILER ${PSL1GHT}/ppu/bin/powerpc64-ps3-elf-g++)
target_link_directories(${target} PUBLIC ${PSL1GHT}/ppu/lib ${PSL1GHT}/spu/lib ${PSL1GHT}/portlibs/ppu/lib)
target_include_directories(${target} PUBLIC ${PSL1GHT}/ppu/include ${PSL1GHT}/spu/spu/include ${PSL1GHT}/portlibs/ppu/include)
target_compile_options(${target} PUBLIC -mcpu=cell)
target_link_libraries(${target} PUBLIC gcm_sys simdmath rsx sysutil io lv2 rt audio m)
endmacro()
`
I think I might've added that functionality locally but I probably forgot to commit it
I was going to comment before that last revert 🤣
Oh shit, sorry
I forgot about this PR and I've recently had issues with the Makefile using ?=
and not :=
when setting LD
so I just changed it on my fork
Should I close this?
Should I close this?
No I think if it leaves the original functionality in ace and adds cmake as an alternative build mechanism it is a fine addition. I'll have to look over it and check your conditionals and other changes when I'm at a PC.
No I think if it leaves the original functionality in ace.
The bigger issue is that currently it doesn't, it's replaced the ?=
in the base_rules
file with a :=
because I was having issues with it trying to use my system ld
which gave me errors about the .o
file being in the wrong format
Wrong button :/
Anyway if I were to do it now I'd probably make a lot of changes since right now it uses a lot of weirdness (ie the fact that CMAKE_C_COMPILER
is set in the function)
I need to look into how nxdk
does it since they recently switched to cmake and from what I've seen it looks really good
No I think if it leaves the original functionality in ace.
The bigger issue is that currently it doesn't, it's replaced the
?=
in thebase_rules
file with a:=
because I was having issues with it trying to use my systemld
which gave me errors about the.o
file being in the wrong format
I'm not sure if that is what the issue is/was? I don't see how immediate vs deferred variable assignment would change which ld was used, unless your cmake sets it incorrectly somehow. Maybe we can figure out a different way to handle that issue.
No I think if it leaves the original functionality in ace.
The bigger issue is that currently it doesn't, it's replaced the
?=
in thebase_rules
file with a:=
because I was having issues with it trying to use my systemld
which gave me errors about the.o
file being in the wrong formatI'm not sure if that is what the issue is/was? I don't see how immediate vs deferred variable assignment would change which ld was used, unless your cmake sets it incorrectly somehow. Maybe we can figure out a different way to handle that issue.
Oh, I wasn't using CMake for this, I was using the 'trivial' template project. I was just saying that, that's a change I made unrelated to CMake, so I would need to close the PR and make a new branch and do it from there.
You probably need an spu.cmake and ppu.cmake, which sets the prefix and adds it to the linker arguments?
For ppu PREFIX=ppu-
and for spu PREFIX=spu-
, they are set in spu_rules and ppu_rules in the project root. I don't think you included those anywhere.
set(CMAKE_CXX_LINK_EXECUTABLE "${PREFIX}${CMAKE_CXX_LINK_EXECUTABLE}")
set(CMAKE_C_LINK_EXECUTABLE "${PREFIX}${CMAKE_C_LINK_EXECUTABLE}")
Or maybe:
set(CMAKE_CXX_LINK_EXECUTABLE "${LD}")
set(CMAKE_C_LINK_EXECUTABLE "${LD}")
Maybe also for the compiler:
set(CMAKE_CXX_COMPILER "${PREFIX}${CMAKE_CXX_COMPILER}")
set(CMAKE_C_COMPILER "${PREFIX}${CMAKE_C_COMPILER}")
Or:
set(CMAKE_CXX_COMPILER "${CXX}")
set(CMAKE_C_COMPILER "${CC}")
Edit: I see you set the compiler but not your linker in the psl1ght.cmake, see comments below.
So, I'm going to close this and make a CMake build system for PSL1GHT, once I've finished, I'll open a new PR Does that sound good?
Sure does, so far we have had unity in psl1ght build systems, but maybe a new build system as an option will stir up some new contributions.
Ok, closing
This PR contains a CMake Script that I wrote for my game engine (which uses CMake) which pratically converts what is done in the ppu_rules makefile into CMake
I've tested this successfully with the VideoTest sample (both running via the .self file and via the .pkg file)
I hope this is useful :)