More Carbon support (Dialogs example)

This commit is contained in:
Wolfgang Thaller 2015-10-08 22:44:18 +02:00
parent d8065be04b
commit 9866de71bb
8 changed files with 108 additions and 16 deletions

View File

@ -24,9 +24,10 @@ if(CMAKE_SYSTEM_NAME MATCHES Retro.*)
set( REZ_TEMPLATES_PATH ${CMAKE_CURRENT_SOURCE_DIR}/libretro)
include(add_application)
configure_file(cmake/retro68.toolchain.cmake.in cmake/retro68.toolchain.cmake @ONLY)
string(TOLOWER ${CMAKE_SYSTEM_NAME} SYSLOWER)
configure_file(cmake/${SYSLOWER}.toolchain.cmake.in cmake/${SYSLOWER}.toolchain.cmake @ONLY)
install(DIRECTORY cmake/ DESTINATION cmake FILES_MATCHING PATTERN "*.cmake")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cmake/retro68.toolchain.cmake DESTINATION cmake)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cmake/${SYSLOWER}.toolchain.cmake DESTINATION cmake)
add_subdirectory(libretro)
@ -36,12 +37,11 @@ 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/Dialog)
endif()
add_subdirectory(TestApps)
add_subdirectory(Samples/Dialog)
add_subdirectory(Samples/Raytracer)
if(CMAKE_SYSTEM_NAME MATCHES Retro68)

View File

@ -21,8 +21,6 @@
#include <Dialogs.h>
#include <Fonts.h>
QDGlobals qd;
pascal void ButtonFrameProc(DialogRef dlg, DialogItemIndex itemNo)
{
DialogItemType type;
@ -37,13 +35,14 @@ pascal void ButtonFrameProc(DialogRef dlg, DialogItemIndex itemNo)
int main()
{
#if !TARGET_API_MAC_CARBON
InitGraf(&qd.thePort);
InitFonts();
InitWindows();
InitMenus();
TEInit();
InitDialogs(NULL);
#endif
DialogPtr dlg = GetNewDialog(128,0,(WindowPtr)-1);
InitCursor();
SelectDialogItemText(dlg,4,0,32767);
@ -53,7 +52,7 @@ int main()
Rect box;
GetDialogItem(dlg, 2, &type, &itemH, &box);
SetDialogItem(dlg, 2, type, (Handle) NewUserItemProc(&ButtonFrameProc), &box);
SetDialogItem(dlg, 2, type, (Handle) NewUserItemUPP(&ButtonFrameProc), &box);
ControlHandle cb, radio1, radio2;
GetDialogItem(dlg, 5, &type, &itemH, &box);

View File

@ -67,13 +67,18 @@ resource 'SIZE' (-1) {
dontGetFrontClicks,
ignoreChildDiedEvents,
is32BitCompatible,
isHighLevelEventAware,
onlyLocalHLEvents,
notStationeryAware,
reserved,
reserved,
reserved,
reserved,
reserved,
reserved,
reserved,
#ifdef TARGET_API_MAC_CARBON
500 * 1024, // Carbon apparently needs additional memory.
500 * 1024
#else
100 * 1024,
100 * 1024
#endif
};

View File

@ -18,9 +18,13 @@
cmake_minimum_required(VERSION 2.8)
set(CMAKE_CXX_FLAGS "-std=c++11") # -fomit-frame-pointer")
add_application(EmptyTest EmptyTest.c)
if(CMAKE_SYSTEM_NAME MATCHES RetroCarbon)
else()
add_application(ExceptionTest CONSOLE ExceptionTest.cc)
add_application(InitTest CONSOLE InitTest.cc)
add_application(EmptyTest EmptyTest.c)
endif()
if(CMAKE_SYSTEM_NAME MATCHES Retro68)
enable_language(ASM)

View File

@ -0,0 +1,2 @@
# Nothing platform-specific to do for now.
# All the basic setup is in retrocarbon.toolchain.cmake

View File

@ -13,6 +13,13 @@ function(add_application name)
list(APPEND ARGS_FILES ${ARGS_UNPARSED_ARGUMENTS})
set(REZ_FLAGS)
if(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_FLAGS -DTARGET_API_MAC_CARBON=1)
endif()
endif()
set(files)
set(rsrc_files)
set(rez_files)
@ -20,7 +27,7 @@ function(add_application name)
if(${f} MATCHES "\\.r$")
add_custom_command(
OUTPUT ${f}.rsrc.bin
COMMAND ${REZ} ${CMAKE_CURRENT_SOURCE_DIR}/${f} -I ${REZ_INCLUDE_PATH} -o ${f}.rsrc.bin
COMMAND ${REZ} ${REZ_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/${f} -I ${REZ_INCLUDE_PATH} -o ${f}.rsrc.bin
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${f})
list(APPEND rsrc_files "${CMAKE_CURRENT_BINARY_DIR}/${f}.rsrc.bin")
list(APPEND rez_files "${f}")
@ -67,7 +74,8 @@ function(add_application name)
add_custom_command(
OUTPUT ${name}.bin ${name}.APPL ${name}.dsk
COMMAND ${REZ} ${REZ_TEMPLATES_PATH}/Retro68APPL.r
COMMAND ${REZ} ${REZ_FLAGS}
${REZ_TEMPLATES_PATH}/Retro68APPL.r
-I${REZ_INCLUDE_PATH}
-DFLT_FILE_NAME="\\"${name}.flt\\""
-o "${name}.bin" --cc "${name}.dsk" --cc "${name}.APPL"
@ -93,7 +101,9 @@ function(add_application name)
add_custom_command(
OUTPUT ${name}.bin ${name}.APPL ${name}.dsk
COMMAND ${REZ} ${REZ_TEMPLATE}
COMMAND ${REZ}
${REZ_FLAGS}
${REZ_TEMPLATE}
-I${REZ_INCLUDE_PATH}
-DCFRAG_NAME="\\"${name}\\""
-o "${name}.bin" --cc "${name}.dsk" --cc "${name}.APPL"

View File

@ -0,0 +1,37 @@
# 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 "${RETRO68_ROOT}/bin/MakePEF" )
set( MAKE_IMPORT "${RETRO68_ROOT}/bin//MakeImport" )
set( REZ "${RETRO68_ROOT}/bin/Rez" )
set( REZ_INCLUDE_PATH "${RETRO68_ROOT}/m68k-apple-macos/RIncludes" )
set( CMAKE_C_COMPILER "${RETRO68_ROOT}/bin/powerpc-apple-macos-gcc" )
set( CMAKE_CXX_COMPILER "${RETRO68_ROOT}/bin/powerpc-apple-macos-g++" )
set( REZ_TEMPLATES_PATH ${REZ_INCLUDE_PATH})
add_definitions( -DTARGET_API_MAC_CARBON=1 )
list( APPEND CMAKE_MODULE_PATH "${RETRO68_ROOT}/m68k-apple-macos/cmake" )
include(add_application)

View File

@ -0,0 +1,35 @@
# 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 RetroPPC )
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 "${RETRO68_ROOT}/bin/MakePEF" )
set( MAKE_IMPORT "${RETRO68_ROOT}/bin//MakeImport" )
set( REZ "${RETRO68_ROOT}/bin/Rez" )
set( REZ_INCLUDE_PATH "${RETRO68_ROOT}/m68k-apple-macos/RIncludes" )
set( CMAKE_C_COMPILER "${RETRO68_ROOT}/bin/powerpc-apple-macos-gcc" )
set( CMAKE_CXX_COMPILER "${RETRO68_ROOT}/bin/powerpc-apple-macos-g++" )
set( REZ_TEMPLATES_PATH ${REZ_INCLUDE_PATH})
list( APPEND CMAKE_MODULE_PATH "${RETRO68_ROOT}/m68k-apple-macos/cmake" )
include(add_application)