diff --git a/CMakeLists.txt b/CMakeLists.txt index d4211f8b43..23f7390d30 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/Samples/Dialog/dialog.c b/Samples/Dialog/dialog.c index d9e02b4689..7e23ebcee1 100644 --- a/Samples/Dialog/dialog.c +++ b/Samples/Dialog/dialog.c @@ -21,8 +21,6 @@ #include #include -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); diff --git a/Samples/Dialog/dialog.r b/Samples/Dialog/dialog.r index 118b379bcc..07dad66873 100644 --- a/Samples/Dialog/dialog.r +++ b/Samples/Dialog/dialog.r @@ -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 }; diff --git a/TestApps/CMakeLists.txt b/TestApps/CMakeLists.txt index 95bcab6631..3e064b7138 100644 --- a/TestApps/CMakeLists.txt +++ b/TestApps/CMakeLists.txt @@ -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) diff --git a/cmake/Platform/RetroCarbon.cmake b/cmake/Platform/RetroCarbon.cmake new file mode 100644 index 0000000000..006270a4e3 --- /dev/null +++ b/cmake/Platform/RetroCarbon.cmake @@ -0,0 +1,2 @@ +# Nothing platform-specific to do for now. +# All the basic setup is in retrocarbon.toolchain.cmake diff --git a/cmake/add_application.cmake b/cmake/add_application.cmake index 7840fec744..6c708cec84 100644 --- a/cmake/add_application.cmake +++ b/cmake/add_application.cmake @@ -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" diff --git a/cmake/retrocarbon.toolchain.cmake.in b/cmake/retrocarbon.toolchain.cmake.in new file mode 100644 index 0000000000..54c2d5180b --- /dev/null +++ b/cmake/retrocarbon.toolchain.cmake.in @@ -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 . + +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) diff --git a/cmake/retroppc.toolchain.cmake.in b/cmake/retroppc.toolchain.cmake.in new file mode 100644 index 0000000000..95c0a8315b --- /dev/null +++ b/cmake/retroppc.toolchain.cmake.in @@ -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 . + +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)