Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8361bb0
Update all Makefiles in the project to use gcc/g++-14 on MacOS (Darwi…
seclorum Jul 31, 2026
3687efa
readme.OSX: explain homebrew dependencies
seclorum Jul 31, 2026
e2ffdb5
rules.mk: cleanup, fix HACK bug, make rules more coherent.
seclorum Jul 31, 2026
38bc716
Makefile: MacOS tooling assert.
seclorum Jul 31, 2026
596ae29
Address dbug's formatting rule: ({}'s not withstanding..) ..
seclorum Jul 31, 2026
26c9d01
Address dbug's formatting rule: ({}'s not withstanding..) ..
seclorum Jul 31, 2026
8b7ff18
Merge branch 'macos-tahoe-build-fixups' of github.com:seclorum/osdk i…
seclorum Jul 31, 2026
a1756db
.gitignore: exclude *.o and *.a files, as well as build MacOS/Linux b…
seclorum Jul 31, 2026
e925704
readme.OSX: use of OSDK environment variable
seclorum Aug 1, 2026
f26359e
readme.OSX note re: OSDK unset requirement
seclorum Aug 1, 2026
31e69e8
Linux: use gcc-/g++-14 for Linux builds - same as MacOS.
Aug 3, 2026
98093a6
Initial conversion of all OSDK Makefile/rules.mk infrastructure to CM…
seclorum Aug 5, 2026
72cf0d6
rm -rf spurious build/ dir from repo
seclorum Aug 5, 2026
4bcc857
.gitignore: do not include typical cmake build product directories in…
seclorum Aug 5, 2026
3b80a74
.gitignore: .idea administrivia dir from CLion.
seclorum Aug 5, 2026
3cbc776
build_and_install target now resolves its target directory at executi…
seclorum Aug 5, 2026
59ebb7e
samples: all samples get a CMakeLists.txt file for building purposes.
seclorum Aug 5, 2026
0b8585b
CMake: root samples target, depends on build_and_install target, conf…
seclorum Aug 5, 2026
31a99b2
Fix tap2dsk argument handling.
seclorum Aug 5, 2026
5ab5532
Update docs: BUILDING.md contains details for devs who favor CMake as…
seclorum Aug 5, 2026
068e3a6
BUILDING.md: OSDK Developers can use either traditional Makefile-styl…
seclorum Aug 5, 2026
387b239
CMake: if no OSDK variable is exported by the user to set the desired…
seclorum Aug 6, 2026
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
37 changes: 32 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
################################################################################
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
################################################################################
# see: https://github.com/github/gitignore/blob/main/VisualStudio.gitignore

*.user
*.vcxproj.FileListAbsolute.txt
*.vcxproj.filter
*.pdb
*.idb
*.tmp
*.obj
*.o
*.a
*.db
*.tlog
*.recipe
Expand All @@ -20,6 +17,7 @@
*.mp4
*.sna
*.txt
!CMakeLists.txt
# The blanket *.txt above is aimed at build output, but the release tree ships a
# few genuine text files. They stay tracked once added, however a delete followed
# by a restore is silently dropped again, so name them explicitly.
Expand Down Expand Up @@ -53,3 +51,32 @@ osdk/main/Osdk/_final_/Oricutron/videos/
osdk/OldVersions/
osdk/main/Osdk/_final_/sample/assembly/known_issues/
osdk/main/osdk_issues.md

euphoric_tools/4k8/4k8totap
euphoric_tools/4k8/4k8towav
euphoric_tools/txt2bas/txt2bas
osdk/main/DskTool/DskTool
osdk/main/FloppyBuilder/FloppyBuilder
osdk/main/MemMap/memmap
osdk/main/TapTool/TapTool
osdk/main/Ym2Mym/Ym2Mym
osdk/main/bas2tap/bas2tap
osdk/main/bin2txt/bin2txt
osdk/main/common/libcommon.a
osdk/main/compiler/compiler
osdk/main/filepack/filepack
osdk/main/header/header
osdk/main/link65/link65
osdk/main/macrosplitter/macrosplitter
osdk/main/old2mfm/old2mfm
osdk/main/opt65/opt65
osdk/main/pictconv/pictconv
osdk/main/tap2cd/tap2cd
osdk/main/tap2dsk/tap2dsk
osdk/main/xa/xa


cmake-build-release/
cmake-build-debug/
build/
.idea/
74 changes: 74 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Building OSDK

OSDK developers can use CMake to build the toolchain, install it, and build the sample programs with the installed tools.

It is also possible to build the OSDK with 'plain old make' and the master Makefile.

## Dependencies

Either way, you must install a C/C++ compiler, CMake, Curses, and FreeImage development files.

On Debian or Ubuntu:

```sh
sudo apt install build-essential cmake libfreeimage-dev libncurses-dev
```

On Fedora or Red Hat:

```sh
sudo dnf install gcc-c++ cmake freeimage-devel ncurses-devel
```

On macOS, install Xcode Command Line Tools and Homebrew, then:

```sh
xcode-select --install
brew install cmake freeimage
```

## Build and install

From the repository root, choose an installation directory and configure the project:

```sh
export OSDK="$PWD/.osdk"
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
```

`OSDK` is optional. Without it, pass an explicit install prefix instead:

```sh
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$PWD/.osdk"
```

Build the complete toolchain and install it:

```sh
cmake --build build --target build_and_install
```

The `build_and_install` target builds all OSDK components before installing them into the selected prefix.

## Build all samples

After configuring the project, build every sample with the newly installed toolchain:

```sh
cmake --build build --target samples
```

The `samples` target automatically runs `build_and_install` first, discovers the installed sample CMake projects, and builds them with that installation. Sample build directories and generated `.tap`/`.dsk` files are written below `build/samples/`.

To build one installed sample manually, configure its installed directory and point it at the same OSDK prefix:

```sh
cmake -S "$OSDK/sample/c/hello_world_simple" \
-B sample-build \
-DOSDK_ROOT="$OSDK"
cmake --build sample-build
```

Installed samples can also infer their OSDK location from the installed `sample/cmake` helper, but setting `OSDK_ROOT` explicitly is useful when building from a copied sample tree.
162 changes: 162 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# CMakeLists.txt (Root of OSDK Project)
# =============================================================
# Cross-platform CMake configuration for OSDK.
# Supports Linux, macOS and Windows while automatically locating
# dependencies like FreeImage and Curses.
# =============================================================

cmake_minimum_required(VERSION 3.15)

project(OSDK LANGUAGES C CXX)

# =============================================================
# Installation Directory (OSDK Environment Variable Support)
# =============================================================

if(DEFINED ENV{OSDK} AND NOT "$ENV{OSDK}" STREQUAL "")
set(CMAKE_INSTALL_PREFIX "$ENV{OSDK}" CACHE PATH "OSDK Installation Directory" FORCE)
elseif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/distributable/OSDK2.0/" CACHE PATH "OSDK Installation Directory" FORCE)
endif()

message(STATUS "OSDK Installation Prefix: ${CMAKE_INSTALL_PREFIX}")

# =============================================================
# Compiler Configuration
# =============================================================

set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if(MSVC)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS __cdecl=)
add_compile_options(/W4)
else()
add_compile_options(-Wall)
add_compile_definitions(POSIX __cdecl=)
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wno-implicit-function-declaration>)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-implicit-function-declaration>)
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR NOT CMAKE_BUILD_TYPE)
add_compile_definitions(_DEBUG)
else()
add_compile_definitions(NDEBUG)
endif()
endif()

# =============================================================
# Dependencies: Curses & FreeImage
# =============================================================

if(NOT WIN32)
find_package(Curses REQUIRED)
endif()

find_package(FreeImage QUIET CONFIG)

if(TARGET FreeImage::FreeImage)
message(STATUS "Found FreeImage via CMake package.")
else()
find_package(PkgConfig QUIET)
if(PkgConfig_FOUND)
pkg_check_modules(PC_FREEIMAGE QUIET FreeImage)
endif()

find_path(FREEIMAGE_INCLUDE_DIR
NAMES
FreeImage.h
HINTS
${PC_FREEIMAGE_INCLUDEDIR}
${PC_FREEIMAGE_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/shared_libraries/freeimage/v3.12.0
${CMAKE_SOURCE_DIR}/shared_libraries/freeimage/v3.12.0/Source
PATH_SUFFIXES
include
Source
)

find_library(FREEIMAGE_LIBRARY
NAMES
FreeImage
freeimage
HINTS
${PC_FREEIMAGE_LIBDIR}
${PC_FREEIMAGE_LIBRARY_DIRS}
${CMAKE_SOURCE_DIR}/shared_libraries/freeimage/v3.12.0
${CMAKE_SOURCE_DIR}/shared_libraries/freeimage/v3.12.0/Dist
PATH_SUFFIXES
lib
lib64
Dist
)

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(
FreeImage
REQUIRED_VARS
FREEIMAGE_INCLUDE_DIR
FREEIMAGE_LIBRARY
)

if(FreeImage_FOUND)
add_library(FreeImage::FreeImage UNKNOWN IMPORTED)
set_target_properties(FreeImage::FreeImage PROPERTIES
IMPORTED_LOCATION "${FREEIMAGE_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${FREEIMAGE_INCLUDE_DIR}"
)
message(STATUS "FreeImage found:")
message(STATUS " Include: ${FREEIMAGE_INCLUDE_DIR}")
message(STATUS " Library: ${FREEIMAGE_LIBRARY}")
endif()
endif()

if(NOT TARGET FreeImage::FreeImage)
message(FATAL_ERROR
"FreeImage could not be located.\n"
"Install the FreeImage development package or specify:\n"
" FREEIMAGE_INCLUDE_DIR\n"
" FREEIMAGE_LIBRARY"
)
endif()

# =============================================================
# Subdirectories
# =============================================================

add_subdirectory(shared_libraries)
add_subdirectory(euphoric_tools)
add_subdirectory(osdk)

# Build the complete project, then install it. The generated script resolves
# DESTINATION and OSDK when this target is invoked, so an existing build tree
# never falls back to its cached /tmp/osdk prefix when the environment changes.
configure_file(
"${CMAKE_SOURCE_DIR}/cmake/BuildAndInstall.cmake.in"
"${CMAKE_BINARY_DIR}/BuildAndInstall.cmake"
@ONLY
)
configure_file(
"${CMAKE_SOURCE_DIR}/cmake/BuildSamples.cmake.in"
"${CMAKE_BINARY_DIR}/BuildSamples.cmake"
@ONLY
)

# Invoke with: cmake --build <build-dir> --target build_and_install
add_custom_target(build_and_install
COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/BuildAndInstall.cmake"
COMMENT "Building all targets and installing OSDK"
VERBATIM
)

# Build every CMake-based example from the toolchain just installed by the
# target above. Invoke with: cmake --build <build-dir> --target samples
add_custom_target(samples
COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/BuildSamples.cmake"
COMMENT "Configuring and building installed OSDK samples"
VERBATIM
)
add_dependencies(samples build_and_install)
51 changes: 49 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,54 @@
# ---------------------------------------------------------------
# Compiler selection
# ---------------------------------------------------------------
CXX ?= g++-14
CC ?= gcc-14

# ---------------------------------------------------------------
# Base flags
# ---------------------------------------------------------------
CFLAGS = -Wall -D_DEBUG -D__cdecl= -DPOSIX -Iincludes
CXXFLAGS = -Wall -D_DEBUG -D__cdecl= -DPOSIX -Iincludes
LDFLAGS =

# ---------------------------------------------------------------
# macOS-specific adjustments
# ---------------------------------------------------------------
UNAME_S := $(shell uname -s)

ifeq ($(UNAME_S),Darwin)

ifeq (, $(shell which g++-14))
$(error g++-14 not found. Run: brew install gcc@14 freeimage)
endif

# Force C++14 (required for multi-statement constexpr)
CXXFLAGS += -std=c++14

# Optional but useful for older codebases on modern macOS
CFLAGS += -Wno-implicit-function-declaration
CXXFLAGS += -Wno-implicit-function-declaration

# Uncomment if you still hit C23 keyword problems in C files
# CFLAGS += -std=gnu99
endif

# Linux also:
ifeq ($(UNAME_S),Linux)
# Force C++14 (required for multi-statement constexpr)
CXXFLAGS += -std=c++14

# Optional but useful for older codebases on modern macOS
CFLAGS += -Wno-implicit-function-declaration
CXXFLAGS += -Wno-implicit-function-declaration
endif

# Make sure the sub-makes see the flags
export CC CXX CFLAGS CXXFLAGS LDFLAGS

SUBDIRS := shared_libraries euphoric_tools osdk

all install clean:
@for d in $(SUBDIRS); do \
$(MAKE) -C "$$d" $(MAKECMDGOALS) || exit $?; \
$(MAKE) -C "$$d" $(MAKECMDGOALS) || exit $$?; \
done

27 changes: 27 additions & 0 deletions cmake/BuildAndInstall.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Resolve the install directory at target execution time. This allows an
# existing build tree to be installed with a newly supplied environment value.
if(DEFINED ENV{DESTINATION} AND NOT "$ENV{DESTINATION}" STREQUAL "")
set(_osdk_install_prefix "$ENV{DESTINATION}")
elseif(DEFINED ENV{OSDK} AND NOT "$ENV{OSDK}" STREQUAL "")
set(_osdk_install_prefix "$ENV{OSDK}")
else()
set(_osdk_install_prefix "@CMAKE_INSTALL_PREFIX@")
endif()

message(STATUS "OSDK installation prefix: ${_osdk_install_prefix}")

execute_process(
COMMAND "@CMAKE_COMMAND@" --build "@CMAKE_BINARY_DIR@"
RESULT_VARIABLE _osdk_build_result
)
if(NOT _osdk_build_result EQUAL 0)
message(FATAL_ERROR "OSDK build failed with exit code ${_osdk_build_result}")
endif()

execute_process(
COMMAND "@CMAKE_COMMAND@" --install "@CMAKE_BINARY_DIR@" --prefix "${_osdk_install_prefix}"
RESULT_VARIABLE _osdk_install_result
)
if(NOT _osdk_install_result EQUAL 0)
message(FATAL_ERROR "OSDK installation failed with exit code ${_osdk_install_result}")
endif()
Loading