cmake+ps2: create .elf files

This commit is contained in:
Anonymous Maarten 2021-06-22 21:17:05 +02:00
parent afdc14776b
commit acda80c112
4 changed files with 34 additions and 10 deletions

View File

@ -13,10 +13,15 @@ if(WIN32)
elseif(NINTENDO_SWITCH)
set(LIBRW_PLATFORMS "NULL" "GL3")
set(LIBRW_PLATFORM_GL3_REQUIRES_OPENGL OFF)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/nxtoolchain")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/nx")
include(NXFunctions)
elseif(PS2)
set(LIBRW_PLATFORMS "NULL" "PS2")
set(LIBRW_PLATFORM_GL3_REQUIRES_OPENGL OFF)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/ps2")
include(PS2Functions)
else()
set(LIBRW_PLATFORMS "NULL" "GL3" "PS2")
set(LIBRW_PLATFORMS "NULL" "GL3")
set(LIBRW_PLATFORM_GL3_REQUIRES_OPENGL ON)
endif()
set(LIBRW_PLATFORM "NULL" CACHE STRING "Platform")

View File

@ -24,7 +24,12 @@ function(librw_platform_target TARGET)
)
if(LIBRW_INSTALL AND LPT_INSTALL)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.nro"
get_target_property(TARGET_OUTPUT_NAME ${TARGET} OUTPUT_NAME)
if(NOT TARGET_OUTPUT_NAME)
set(TARGET_OUTPUT_NAME "${TARGET}")
endif()
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_OUTPUT_NAME}.nro"
DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
endif()

View File

@ -0,0 +1,18 @@
if(NOT COMMAND add_erl_executable)
message(FATAL_ERROR "The `add_erl_executable` cmake command is not available. Please use an appropriate Playstation 2 toolchain.")
endif()
function(librw_platform_target TARGET)
cmake_parse_arguments(LPT "INSTALL" "" "" ${ARGN})
get_target_property(TARGET_TYPE "${TARGET}" TYPE)
if(TARGET_TYPE STREQUAL "EXECUTABLE")
add_erl_executable(${TARGET} OUTPUT_VAR ERL_FILE)
if(LIBRW_INSTALL AND LPT_INSTALL)
install(FILES "${ERL_FILE}"
DESTINATION "${CMAKE_INSTALL_BINDIR}"
)
endif()
endif()
endfunction()

View File

@ -46,12 +46,9 @@ class LibrwConan(ConanFile):
def validate(self):
if self.options.platform == "d3d9" and self.settings.os != "Windows":
raise ConanInvalidConfiguration("d3d9 can only be built for Windows")
if self.options.platform == "ps2":
if not self._os_is_playstation2:
raise ConanInvalidConfiguration("platform=ps2 is only valid for os=Playstation2")
else:
if self._os_is_playstation2:
raise ConanInvalidConfiguration("os=Playstation2 only supports platform=ps2")
if self._os_is_playstation2:
if self.options.platform not in ("null", "ps2"):
raise ConanInvalidConfiguration("os=Playstation2 only supports platform=(null,ps2)")
def requirements(self):
if self.options.platform == "gl3":
@ -115,7 +112,6 @@ class LibrwConan(ConanFile):
if self.options.platform == "gl3":
cmake.definitions["LIBRW_GL3_GFXLIB"] = str(self.options.gl3_gfxlib).upper()
if self._os_is_playstation2:
cmake.definitions["CMAKE_TOOLCHAIN_FILE"] = self.deps_user_info["ps2dev-cmaketoolchain"].cmake_toolchain_file
env["PS2SDK"] = self.deps_cpp_info["ps2dev-ps2sdk"].rootpath
with tools.environment_append(env):
cmake.configure(source_folder=self.build_folder)