Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ elseif(PDC_X11_BUILD)
# set(PDC_WIDE ON)
add_subdirectory(x11new)

elseif(CMAKE_SYSTEM_NAME MATCHES "^Retro")

add_subdirectory(mac)

else()

add_subdirectory(ncurses)
Expand Down
10 changes: 8 additions & 2 deletions cmake/project_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,21 @@ macro (demo_app dir targ)
set(src_files ${CMAKE_CURRENT_SOURCE_DIR}/${dir}/${targ}.c)
endif()

add_executable(${bin_name} ${ARGV2} ${src_files})
if(CMAKE_SYSTEM_NAME MATCHES "^Retro")
set(bin_name ${targ})
add_application(${bin_name} ${src_files} ${PDC_MAC_RESOURCES})
add_dependencies(${bin_name} ${PROJECT_NAME}_resources)
else()
add_executable(${bin_name} ${ARGV2} ${src_files})
set_target_properties(${bin_name} PROPERTIES OUTPUT_NAME ${targ})
endif()

target_link_libraries(${bin_name} PRIVATE ${PDCURSE_PROJ} ${EXTRA_LIBS})
if((${PROJECT_NAME} STREQUAL "wincon") OR (${PROJECT_NAME} STREQUAL "wingui") OR (${PROJECT_NAME} STREQUAL "vt"))
target_link_libraries(${bin_name} PRIVATE ${WINCON_WINGUI_DEP_LIBS})
endif()

add_dependencies(${bin_name} ${PDCURSE_PROJ})
set_target_properties(${bin_name} PROPERTIES OUTPUT_NAME ${targ})

install(TARGETS ${bin_name} RUNTIME DESTINATION ${PDCURSES_DIST}/bin/${PROJECT_NAME} COMPONENT applications)
endmacro ()
3 changes: 2 additions & 1 deletion curses.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ enum PDC_port
PDC_PORT_LINUX_FB = 10,
PDC_PORT_OPENGL = 11,
PDC_PORT_OS2GUI = 12,
PDC_PORT_SDL3 = 13
PDC_PORT_SDL3 = 13,
PDC_PORT_MAC = 14
};

/* Use this structure with PDC_get_version() for run-time info about the
Expand Down
6 changes: 5 additions & 1 deletion demos/testcurs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1918,6 +1918,7 @@ void colorTest(WINDOW *win)
#if HAVE_WIDE
void wideTest(WINDOW *win)
{
wint_t input[513];
wchar_t tmp[513];
size_t i;

Expand All @@ -1930,7 +1931,10 @@ void wideTest(WINDOW *win)

echo();

get_wstr((wint_t *)tmp);
get_wstr(input);
for (i = 0; input[i]; i++)
tmp[i] = (wchar_t)input[i];
tmp[i] = 0;
addstr("\n\n String:\n\n ");
addwstr(tmp);
addstr("\n\n\n Hex:\n\n ");
Expand Down
41 changes: 41 additions & 0 deletions mac/CMakeLists.txt
Comment thread
GitMensch marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
cmake_minimum_required(VERSION 3.11)

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "MinSizeRel" CACHE STRING "Choose the type of build, options are: Debug, Release, or MinSizeRel." FORCE)
message(STATUS "No build type specified, defaulting to MinSizeRel.")
endif()

PROJECT(mac VERSION "${PROJECT_VERSION}" LANGUAGES C)

INCLUDE(project_common)

target_include_directories(${PDCURSE_PROJ} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../common)

if(CMAKE_SYSTEM_NAME MATCHES "^Retro")
set(PDC_MAC_RESOURCES ${CMAKE_CURRENT_BINARY_DIR}/pdcurses.rsrc.bin)
set(PDC_MAC_REZ_INCLUDES ${REZ_INCLUDE_PATH})
list(TRANSFORM PDC_MAC_REZ_INCLUDES PREPEND -I)
add_custom_command(OUTPUT ${PDC_MAC_RESOURCES}
COMMAND ${REZ} ${CMAKE_CURRENT_SOURCE_DIR}/pdcurses.r ${PDC_MAC_REZ_INCLUDES} -o ${PDC_MAC_RESOURCES}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/pdcurses.r)
add_custom_target(${PROJECT_NAME}_resources DEPENDS ${PDC_MAC_RESOURCES})
endif()

demo_app(../demos calendar)
demo_app(../demos firework)
demo_app(../demos init_col)
demo_app(../demos mbrot)
demo_app(../demos newtest)
demo_app(../demos ozdemo)
demo_app(../demos picsview)
demo_app(../demos ptest)
demo_app(../demos rain)
demo_app(../demos speed)
demo_app(../demos test_pan)
demo_app(../demos testcurs)
demo_app(../demos version)
demo_app(../demos widetest)
demo_app(../demos worm)
demo_app(../demos xmas)

SET(CPACK_COMPONENTS_ALL applications)
92 changes: 92 additions & 0 deletions mac/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
PDCursesMod for Macintosh Classic/Carbon
=========================================

This directory contains PDCursesMod source code files
specific to the Macintosh classic/carbon graphics mode
(Macintosh classic has no command line, so this is the only
mode there). This will work with System 7 and early OSX with
CarbonLib on either 68k or PowerPC.

Building
--------

- You can cross-compile with Retro68 using CMake. This is
the main way to do it as you get a modern compiler with
modern optimizations. Some Linux distros have a package
for Retro68, but for those that don't there are a couple
options:

1) The main Retro68 repo at https://github.com/autc04/Retro68/
2) Matthewdeaves's fork at https://github.com/matthewdeaves/Retro68 which includes a more hands-free setup script

- A CodeWarrior 8 file is included for native compilation
and debugging. The non-CMake options include:

pdcursescw8mac.sit - Macintosh CodeWarrior 8 (non-Pro) 68k project file

- Use Stuffit Expander to extract the native Macintosh CodeWarrior 8
project. It is compressed to preserve its resources.

- The CodeWarrior project files include only the library itself.
If you want compile a demo, test, or your own application,
either add it as a target to the project or make your own
project file and add PDCursesMod as a library.

- If making an application include pdcurses.r or your own resource file.

- As mentioned above this port supports several architectures:

68k - Builds for early Macintosh Classic non-PowerPC
PowerPC - Builds for Macintosh Classic PowerPC
FAT - Builds for Macintosh Classic 68k/PowerPC hybrid
Carbon - Builds for Macintosh Carbon 1.0

- Carbon requires System 8+ with the CarbonLib extension on
Macintosh Classic or early PowerPC-based Mac OSX.

Retro68 CMake Information
------------------------------

Using Retro68 with CMake generally requires its own cmake
toolchain file. Typically you'd have this already set up. For
example if Retro68 was setup in /home/user/Retro68-build your
toolchain would look something like:

if(RETROPOWERPCOPT OR RETROCARBONOPT)
set(CMAKE_AR /home/user/Retro68-build/toolchain/bin/powerpc-apple-macos-ar)
set(CMAKE_RANLIB /home/user/Retro68-build/toolchain/bin/powerpc-apple-macos-ranlib)
set(CMAKE_LINKER /home/user/Retro68-build/toolchain/bin/powerpc-apple-macos-ld)
set(CMAKE_C_COMPILER /home/user/Retro68-build/toolchain/bin/powerpc-apple-macos-gcc)
set(CMAKE_CXX_COMPILER /home/user/Retro68-build/toolchain/bin/powerpc-apple-macos-g++)
if(RETROCARBONOPT)
set(CMAKE_EXE_LINKER_FLAGS_INIT "-carbon")
add_definitions(-DTARGET_API_MAC_CARBON=1)
set(CMAKE_SYSTEM_NAME RetroCarbon)
else()
set(CMAKE_SYSTEM_NAME RetroPPC)
endif()
else()
set(CMAKE_AR /home/user/Retro68-build/toolchain/bin/m68k-apple-macos-ar)
set(CMAKE_RANLIB /home/user/Retro68-build/toolchain/bin/m68k-apple-macos-ranlib)
set(CMAKE_LINKER /home/user/Retro68-build/toolchain/bin/m68k-apple-macos-ld)
set(CMAKE_C_COMPILER /home/user/Retro68-build/toolchain/bin/m68k-apple-macos-gcc)
set(CMAKE_CXX_COMPILER /home/user/Retro68-build/toolchain/bin/m68k-apple-macos-g++)
set(CMAKE_SYSTEM_NAME Retro68)
endif()

set(REZ /home/user/Retro68-build/toolchain/bin/Rez)

Once you have that set up you'd either pass it to the commandline or
add it to the cmake files via:

set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/retro68-gcc-toolchain.cmake)

Distribution Status
-------------------

The files in this directory are released to the Public Domain.

Acknowledgements
----------------

Structure based on the Win32 GUI port by Bill Gray.
Loading
Loading