Clean up Carbon build

This commit is contained in:
Wolfgang Thaller 2015-10-07 00:03:28 +02:00
parent 5339e2419b
commit 79d23218a9
12 changed files with 124 additions and 32 deletions

View File

@ -18,7 +18,7 @@
cmake_minimum_required(VERSION 2.8)
project(Retro)
if(CMAKE_SYSTEM_NAME MATCHES Retro68 OR CMAKE_SYSTEM_NAME MATCHES RetroPPC)
if(CMAKE_SYSTEM_NAME MATCHES Retro.*)
set( REZ_TEMPLATES_PATH ${CMAKE_CURRENT_SOURCE_DIR}/libretro)
@ -35,11 +35,14 @@ 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(NOT (CMAKE_SYSTEM_NAME MATCHES RetroCarbon))
add_subdirectory(Console)
add_subdirectory(TestApps)
add_subdirectory(Samples/HelloWorld)
add_subdirectory(Samples/Raytracer)
add_subdirectory(Samples/Dialog)
endif()
add_subdirectory(Samples/Raytracer)
if(CMAKE_SYSTEM_NAME MATCHES Retro68)
add_subdirectory(Samples/Launcher)
@ -51,6 +54,7 @@ else()
set(RETRO68_ROOT ${CMAKE_INSTALL_PREFIX})
configure_file(cmake/intree.toolchain.cmake.in cmake/intree.toolchain.cmake @ONLY)
configure_file(cmake/intreeppc.toolchain.cmake.in cmake/intreeppc.toolchain.cmake @ONLY)
configure_file(cmake/intreecarbon.toolchain.cmake.in cmake/intreecarbon.toolchain.cmake @ONLY)
add_subdirectory(ResourceFiles)
add_subdirectory(MakeAPPL)

View File

@ -37,7 +37,7 @@ if(APPLE)
target_link_libraries(Raytracer2 "-framework Carbon")
else()
set(CMAKE_CXX_FLAGS "-std=c++11")
if(FALSE)
# save 200KB of code by removing unused stuff
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-gc-sections")
@ -51,18 +51,10 @@ if(FALSE)
fixed.h
fixed.cc
)
if(NOT (CMAKE_SYSTEM_NAME MATCHES RetroCarbon))
add_application(FixedBenchmark CONSOLE
FILES fixedbenchmark.cc fixed.h fixed.cc)
endif()
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-gc-sections -nostdlib")
add_definitions(-DRETRO_CARBON)
add_application(RaytracerCarbon
raytracer2.cc
fixed.h
fixed.cc
carb.r
)
target_link_libraries(RaytracerCarbon "-lstdc++" "-lc" retrocrt "-lc" "-lgcc" retrocrt "-lc" CarbonLib)
endif()

View File

@ -1,3 +0,0 @@
data 'carb' (0) {
$"00"
};

View File

@ -22,15 +22,16 @@
#include <ApplicationServices/ApplicationServices.h>
#else
#ifdef TARGET_API_MAC_CARBON
#include <math.h>
#include <Carbon.h>
#else
#include <Quickdraw.h>
#include <MacMemory.h>
#include <Sound.h>
#include <Events.h>
#include <Fonts.h>
#include <NumberFormatting.h>
#ifdef __GNUC__
QDGlobals qd;
#endif
#endif

View File

@ -22,8 +22,7 @@
#include <ApplicationServices/ApplicationServices.h>
#else
#ifdef RETRO_CARBON
//#define __FP__
#ifdef TARGET_API_MAC_CARBON
#include <math.h>
#include <Carbon.h>
#else
@ -35,7 +34,6 @@
#include <NumberFormatting.h>
#endif
#endif
#include "fixed.h"

View File

@ -122,3 +122,11 @@ cmake ${SRC} -DCMAKE_TOOLCHAIN_FILE=../build-host/cmake/intreeppc.toolchain.cmak
-DCMAKE_BUILD_TYPE=Release
cd ..
make -C build-target-ppc install
# Build target-based components for Carbon
mkdir -p build-target-carbon
cd build-target-carbon
cmake ${SRC} -DCMAKE_TOOLCHAIN_FILE=../build-host/cmake/intreecarbon.toolchain.cmake \
-DCMAKE_BUILD_TYPE=Release
cd ..
make -C build-target-carbon install

View File

@ -5,7 +5,7 @@ cmake_policy(SET CMP0012 NEW)
function(add_application name)
set(options DEBUGBREAK CONSOLE)
set(options DEBUGBREAK CONSOLE CARBON CLASSIC)
set(oneValueArgs TYPE CREATOR)
set(multiValueArgs FILES MAKEAPPL_ARGS)
@ -76,7 +76,15 @@ function(add_application name)
DEPENDS ${name} ${rsrc_files})
add_custom_target(${name}_APPL ALL DEPENDS ${name}.bin)
elseif(CMAKE_SYSTEM_NAME MATCHES RetroPPC)
elseif(CMAKE_SYSTEM_NAME MATCHES RetroPPC OR CMAKE_SYSTEM_NAME MATCHES RetroCarbon)
if((CMAKE_SYSTEM_NAME MATCHES RetroCarbon OR ARGS_CARBON) AND NOT ARGS_CLASSIC)
set(REZ_TEMPLATE "${REZ_TEMPLATES_PATH}/RetroCarbonAPPL.r")
target_compile_definitions(${name} PUBLIC -DTARGET_API_MAC_CARBON=1)
target_link_libraries(${name} -carbon)
else()
set(REZ_TEMPLATE "${REZ_TEMPLATES_PATH}/RetroPPCAPPL.r")
endif()
set_target_properties(${name} PROPERTIES OUTPUT_NAME ${name}.xcoff)
add_custom_command(
OUTPUT ${name}.pef
@ -85,7 +93,7 @@ function(add_application name)
add_custom_command(
OUTPUT ${name}.bin ${name}.APPL ${name}.dsk
COMMAND ${REZ} ${REZ_TEMPLATES_PATH}/RetroPPCAPPL.r
COMMAND ${REZ} ${REZ_TEMPLATE}
-I${REZ_INCLUDE_PATH}
-DCFRAG_NAME="\\"${name}\\""
-o "${name}.bin" --cc "${name}.dsk" --cc "${name}.APPL"

View File

@ -0,0 +1,34 @@
# Copyright 2012 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.
#
# You should have received a copy of the GNU General Public License
# along with Retro68. If not, see <http://www.gnu.org/licenses/>.
set( CMAKE_SYSTEM_NAME RetroCarbon )
set( CMAKE_SYSTEM_VERSION 1)
set( RETRO68_ROOT "@RETRO68_ROOT@" CACHE PATH "path to root of Retro68 Toolchain" )
set( CMAKE_INSTALL_PREFIX "${RETRO68_ROOT}/powerpc-apple-macos/" CACHE PATH "installation prefix" )
set( MAKE_PEF "@CMAKE_BINARY_DIR@/PEFTools/MakePEF" )
set( MAKE_IMPORT "@CMAKE_BINARY_DIR@/PEFTools/MakeImport" )
set( REZ "@CMAKE_BINARY_DIR@/Rez/Rez" )
set( REZ_INCLUDE_PATH "${CMAKE_INSTALL_PREFIX}/RIncludes" )
set( CMAKE_C_COMPILER "${RETRO68_ROOT}/bin/powerpc-apple-macos-gcc" )
set( CMAKE_CXX_COMPILER "${RETRO68_ROOT}/bin/powerpc-apple-macos-g++" )
list( APPEND CMAKE_MODULE_PATH "@CMAKE_SOURCE_DIR@/cmake" )
add_definitions( -DTARGET_API_MAC_CARBON=1 )

View File

@ -69,7 +69,7 @@
/* Profiled library versions are used by linking with special directories. */
#define LIB_SPEC "-lc"
#define LIBGCC_SPEC "-lretrocrt -lgcc %{carbon: -lCarbonLib} %{!carbon: -lInterfaceLib}"
#define LIBGCC_SPEC "-lgcc -lretrocrt -lgcc %{carbon: -lCarbonLib} %{!carbon: -lInterfaceLib}"
/* Static linking with shared libstdc++ requires libsupc++ as well. */
#define LIBSTDCXX_STATIC "supc++"

View File

@ -29,25 +29,33 @@ if(CMAKE_SYSTEM_NAME MATCHES Retro68)
start.c
relocate.c
glue.c
qdglobals.c
Retro68.r
Retro68APPL.r
)
install(FILES Retro68Runtime.h DESTINATION include)
install(FILES Retro68.r Retro68APPL.r DESTINATION RIncludes)
else()
elseif(CMAKE_SYSTEM_NAME MATCHES RetroPPC)
enable_language(ASM)
set(ARCH_FILES
ppcstart.c
ppcfpsave.s
qdglobals.c
RetroPPCAPPL.r)
install(FILES RetroPPCAPPL.r DESTINATION RIncludes)
elseif(CMAKE_SYSTEM_NAME MATCHES RetroCarbon)
enable_language(ASM)
set(ARCH_FILES
ppcstart.c
ppcfpsave.s
RetroCarbonAPPL.r)
install(FILES RetroCarbonAPPL.r DESTINATION RIncludes)
endif()
add_library(retrocrt
malloc.c
syscalls.c
consolehooks.c
qdglobals.c
${ARCH_FILES}
)

View File

@ -0,0 +1,43 @@
#include "Processes.r"
#include "CodeFragments.r"
#ifndef CFRAG_NAME
#define CFRAG_NAME "RetroPPC Application"
#endif
resource 'cfrg' (0) {
{
kPowerPCCFragArch, kIsCompleteCFrag, kNoVersionNum, kNoVersionNum,
kDefaultStackSize, kNoAppSubFolder,
kApplicationCFrag, kDataForkCFragLocator, kZeroOffset, kCFragGoesToEOF,
CFRAG_NAME
}
};
type 'carb' {
};
resource 'carb' (0) {
};
resource 'SIZE' (-1) {
dontSaveScreen,
acceptSuspendResumeEvents,
enableOptionSwitch,
canBackground,
multiFinderAware,
backgroundAndForeground,
dontGetFrontClicks,
ignoreChildDiedEvents,
is32BitCompatible,
isHighLevelEventAware,
onlyLocalHLEvents,
notStationeryAware,
reserved,
reserved,
reserved,
reserved,
1024 * 1024,
1024 * 1024
};

View File

@ -24,10 +24,9 @@ resource 'SIZE' (-1) {
dontGetFrontClicks,
ignoreChildDiedEvents,
is32BitCompatible,
isHighLevelEventAware,
onlyLocalHLEvents,
notStationeryAware,
reserved,
reserved,
reserved,
reserved,
reserved,
reserved,