startup code & cmake stuff for ppc

This commit is contained in:
Wolfgang Thaller 2015-09-01 00:04:20 +02:00
parent 1c9617daeb
commit 4ae36b70fb
7 changed files with 91 additions and 14 deletions

View File

@ -35,6 +35,7 @@ link_directories(${CMAKE_CURRENT_BINARY_DIR}/libretro)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libretro)
set(REZ_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/libretro:${CMAKE_INSTALL_PREFIX}/RIncludes" )
if(CMAKE_SYSTEM_NAME MATCHES Retro68)
add_subdirectory(Console)
add_subdirectory(TestApps)
add_subdirectory(Samples/HelloWorld)
@ -42,6 +43,9 @@ add_subdirectory(Samples/Raytracer)
add_subdirectory(Samples/Launcher)
add_subdirectory(Samples/Dialog)
add_subdirectory(Samples/SystemExtension)
else()
add_subdirectory(Samples/Dialog)
endif()
else()

View File

@ -27,3 +27,6 @@ add_application(Dialog
dialog.c
dialog.r
)
if(CMAKE_SYSTEM_NAME MATCHES RetroPPC)
target_link_libraries(Dialog InterfaceLib)
endif()

View File

@ -22,7 +22,8 @@ add_application(ExceptionTest CONSOLE ExceptionTest.cc)
add_application(InitTest CONSOLE InitTest.cc)
add_application(EmptyTest EmptyTest.c)
if(CMAKE_SYSTEM_NAME MATCHES Retro68)
enable_language(ASM)
add_application(AsmTest AsmTest.s)
set_target_properties(AsmTest PROPERTIES LINKER_LANGUAGE C)
endif()

View File

@ -61,19 +61,40 @@ function(add_application name)
set_target_properties(${name} PROPERTIES LINK_DEPENDS libretro)
endif(TARGET libretro)
set_target_properties(${name} PROPERTIES OUTPUT_NAME ${name}.flt)
if(CMAKE_SYSTEM_NAME MATCHES Retro68)
set_target_properties(${name} PROPERTIES OUTPUT_NAME ${name}.flt)
add_custom_command(
OUTPUT ${name}.bin ${name}.APPL ${name}.dsk
COMMAND ${REZ} ${REZ_TEMPLATES_PATH}/Retro68APPL.r
-I${REZ_INCLUDE_PATH}
-DFLT_FILE_NAME="\\"${name}.flt\\""
-o "${name}.bin" --cc "${name}.dsk" --cc "${name}.APPL"
-t ${ARGS_TYPE} -c ${ARGS_CREATOR}
${ARGS_MAKEAPPL_ARGS}
DEPENDS ${name} ${rsrc_files})
add_custom_target(${name}_APPL ALL DEPENDS ${name}.bin)
elseif(CMAKE_SYSTEM_NAME MATCHES RetroPPC)
set_target_properties(${name} PROPERTIES OUTPUT_NAME ${name}.xcoff)
add_custom_command(
OUTPUT ${name}.pef
COMMAND ${MAKE_PEF} "${name}.xcoff" -o "${name}.pef"
DEPENDS ${name})
add_custom_command(
OUTPUT ${name}.bin ${name}.APPL ${name}.dsk
COMMAND ${REZ} ${REZ_TEMPLATES_PATH}/RetroPPCcfrg.r
-I${REZ_INCLUDE_PATH}
-o "${name}.bin" --cc "${name}.dsk" --cc "${name}.APPL"
-t ${ARGS_TYPE} -c ${ARGS_CREATOR}
--data ${name}.pef
${ARGS_MAKEAPPL_ARGS}
DEPENDS ${name}.pef ${rsrc_files})
add_custom_target(${name}_APPL ALL DEPENDS ${name}.bin)
endif()
add_custom_command(
OUTPUT ${name}.bin ${name}.APPL ${name}.dsk
#COMMAND ${MAKE_APPL} ${ARGS_MAKEAPPL_ARGS} -c "${name}.flt" -o "${name}"
COMMAND ${REZ} ${REZ_TEMPLATES_PATH}/Retro68APPL.r
-I${REZ_INCLUDE_PATH}
-DFLT_FILE_NAME="\\"${name}.flt\\""
-o "${name}.bin" --cc "${name}.dsk" --cc "${name}.APPL"
-t ${ARGS_TYPE} -c ${ARGS_CREATOR}
${ARGS_MAKEAPPL_ARGS}
DEPENDS ${name} ${rsrc_files})
add_custom_target(${name}_APPL ALL DEPENDS ${name}.bin)
endfunction()
cmake_policy(POP)

View File

@ -35,7 +35,7 @@ if(CMAKE_SYSTEM_NAME MATCHES Retro68)
install(FILES Retro68Runtime.h DESTINATION include)
install(FILES Retro68.r Retro68APPL.r DESTINATION RIncludes)
else()
set(ARCH_FILES)
set(ARCH_FILES ppcstart.c)
endif()
add_library(retrocrt

9
libretro/RetroPPCcfrg.r Executable file
View File

@ -0,0 +1,9 @@
data 'cfrg' (0) {
$"0000 0000 0000 0000 0000 0001 0000 0000" /* ................ */
$"0000 0000 0000 0000 0000 0000 0000 0001" /* ................ */
$"7077 7063 0000 0000 0000 0000 0000 0000" /* pwpc............ */
$"0000 0000 0000 0101 0000 0000 0000 0000" /* ................ */
$"0000 0000 0000 0000 0038 0366 6F6F 0000" /* .........8.foo.. */
};

39
libretro/ppcstart.c Normal file
View File

@ -0,0 +1,39 @@
/*
Copyright 2015 Wolfgang Thaller.
This file is part of Retro68.
Retro68 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Retro68 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <stdlib.h>
int main(int argc, char* argv[]);
void __start()
{
int result;
{
char *argv[2] = { "./a.out", NULL };
result = main(1, argv);
}
exit(result);
}