Skip to content
Merged
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
21 changes: 8 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,40 +138,35 @@ jobs:
- uses: actions/setup-python@v7
with:
python-version: '3.12'
cache: 'pip'

- name: Install mbedTLS codegen deps
run: pip install -r deps/mbedtls/scripts/basic.requirements.txt

- name: Build and pack Iris
run: |
git fetch --all --tags
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release "-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64"
cmake --build build
sudo cmake --install build
cmake --install build --prefix dist

- name: Replace bundled symlinks and re-sign
run: |
# Artifact zips flatten symlinks into copies, which breaks the
# bundle's code signature, so bundle real files and sign those
(
cd ./build/iris.app/Contents/Frameworks
cd dist/iris.app/Contents/Frameworks
for f in *; do
if [ -L "$f" ]; then
target=$(readlink "$f")
sudo rm "$f"
sudo cp "$target" "$f"
rm "$f"
cp "$target" "$f"
fi
done
)
sudo codesign --force --deep --sign - ./build/iris.app
codesign --verify --deep --strict ./build/iris.app

- name: Stage artifact
run: |
mkdir -p ./build/dist
cp -R ./build/iris.app ./build/dist
codesign --force --deep --sign - dist/iris.app

- uses: actions/upload-artifact@v7
with:
name: iris-latest-macos-universal
path: ./build/dist
path: ./dist
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,33 +161,33 @@ jobs:
- uses: actions/setup-python@v7
with:
python-version: '3.12'
cache: 'pip'

- name: Install mbedTLS codegen deps
run: pip install -r deps/mbedtls/scripts/basic.requirements.txt

- name: Build and pack Iris
run: |
git fetch --all --tags
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release "-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64"
cmake --build build
sudo cmake --install build
cmake --install build --prefix dist

- name: Replace bundled symlinks and re-sign
run: |
# Artifact zips flatten symlinks into copies, which breaks the
# bundle's code signature, so bundle real files and sign those
(
cd ./build/iris.app/Contents/Frameworks
cd dist/iris.app/Contents/Frameworks
for f in *; do
if [ -L "$f" ]; then
target=$(readlink "$f")
sudo rm "$f"
sudo cp "$target" "$f"
rm "$f"
cp "$target" "$f"
fi
done
)
sudo codesign --force --deep --sign - ./build/iris.app
codesign --verify --deep --strict ./build/iris.app
codesign --force --deep --sign - dist/iris.app

- name: Generate artifact name
id: generate-name
Expand All @@ -196,7 +196,7 @@ jobs:

- name: Zip artifact
run: |
cd build; zip -r ../${{ steps.generate-name.outputs.artifact }}.zip ./iris.app; cd ..
zip -r ${{ steps.generate-name.outputs.artifact }}.zip ./dist/

- name: Upload to release
uses: softprops/action-gh-release@v3
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ tools/
elf/
roms/
.vs/
.venv/
ac/
screens/
imgui.ini
iris.res
*.app
*.AppImage
*.expected
*.dump
Expand Down
71 changes: 30 additions & 41 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ cmake_minimum_required(VERSION 3.25)
project(iris LANGUAGES C CXX)

set(WIN_ICON ${CMAKE_CURRENT_SOURCE_DIR}/res/iris.rc)
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15")
set(CMAKE_OSX_DEPLOYMENT_TARGET "12")
set(OSX_ICON ${CMAKE_CURRENT_SOURCE_DIR}/res/iris.icns)

set_source_files_properties(${OSX_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")

# Normalizing destinations good
if(POLICY CMP0177)
cmake_policy(SET CMP0177 NEW)
endif()

# Statically link SDL3 for Linux targets
set(SDL_STATIC ON)
set(ASMJIT_STATIC ON)
Expand Down Expand Up @@ -469,7 +473,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin")

find_library(MOLTENVK_LIBRARY
NAMES libMoltenVK.dylib
PATHS ENV VULKAN_SDK
PATHS /usr/local/lib ENV VULKAN_SDK
PATH_SUFFIXES /lib
)

Expand Down Expand Up @@ -520,50 +524,35 @@ set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT "
message(STATUS "CMake System Name: ${CMAKE_SYSTEM_NAME}")

if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
# tell Install about the target, otherwise fixup won't know about the transitive dependencies
install(TARGETS iris
BUNDLE DESTINATION ./install COMPONENT Runtime
RUNTIME DESTINATION ./install/bin COMPONENT Runtime
)

set(BUNDLE_PATH "${CMAKE_BINARY_DIR}/iris.app") # where to look for dependencies when fixing up
file(GLOB VULKAN_DYLIBS $ENV{VULKAN_SDK}/lib/libvulkan.*.dylib)
set(VULKAN_DYLIBS ${VULKAN_DYLIBS} $ENV{VULKAN_SDK}/lib/libMoltenVK.dylib)
set(DIRS "/usr/local/lib")
if(DEFINED ENV{VULKAN_SDK})
list(APPEND DIRS $ENV{VULKAN_SDK}/lib)
endif()

# Install prefixes are passed through unnormalized, and fixup_bundle requires a complete path, therefore we need to clobber the bundle in the build folder.
# There's also no way to normalize a path given as a generator expression, like INSTALL_PREFIX.
install(CODE "
execute_process(COMMAND echo \"Preparing to bundle iris...\")
execute_process(COMMAND echo \"Bundle path: ${BUNDLE_PATH}\")
execute_process(COMMAND echo \"Vulkan dylibs: ${VULKAN_DYLIBS}\")
execute_process(COMMAND echo \"Adding local RPATH...\")
execute_process(
COMMAND install_name_tool -add_rpath
\"@executable_path/../Frameworks\"
\"${BUNDLE_PATH}/Contents/MacOS/iris\"
)
execute_process(COMMAND echo \"Creating ICD JSON directory...\")
make_directory(${BUNDLE_PATH}/Contents/Resources/vulkan/icd.d)
execute_process(COMMAND echo \"Creating Frameworks directory...\")
make_directory(${BUNDLE_PATH}/Contents/Frameworks)
execute_process(COMMAND echo \"Copying files...\")
file(COPY
${CMAKE_CURRENT_SOURCE_DIR}/MoltenVK_icd.json
DESTINATION ${BUNDLE_PATH}/Contents/Resources/vulkan/icd.d/
)
file(COPY
${VULKAN_DYLIBS}
DESTINATION ${BUNDLE_PATH}/Contents/Frameworks/
)
execute_process(COMMAND echo \"Signing app bundle...\")
execute_process(COMMAND
codesign --force --deep --sign - ${BUNDLE_PATH}
RESULT_VARIABLE codesign_result
OUTPUT_VARIABLE codesign_output
)
include(BundleUtilities)

make_directory($<TARGET_BUNDLE_DIR:iris>/Contents/Resources/vulkan/icd.d)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/MoltenVK_icd.json DESTINATION $<TARGET_BUNDLE_DIR:iris>/Contents/Resources/vulkan/icd.d/)

fixup_bundle($<TARGET_BUNDLE_DIR:iris> \"\" \"${DIRS}\")

execute_process(COMMAND codesign --force --deep --sign - $<TARGET_BUNDLE_DIR:iris> RESULT_VARIABLE codesign_result OUTPUT_VARIABLE codesign_output)
if (codesign_result)
execute_process(COMMAND echo \"${codesign_output}\")
endif()
")

# BUNDLE installs will try modify the rpath of the bundle, which won't work as fixup_bundle already does so.
install(FILES $<TARGET_BUNDLE_DIR:iris> DESTINATION .)

# FILES installs do not retain the executable flag on binaries.
install(CODE "execute_process(COMMAND /bin/sh -c \"chmod +x $<INSTALL_PREFIX>/iris.app/Contents/Frameworks/* $<INSTALL_PREFIX>/iris.app/Contents/MacOS/*\")")

set(CPACK_GENERATOR "DragNDrop")
include(CPack)
include(CPack)
endif()

if (CMAKE_SYSTEM_NAME MATCHES "Linux")
Expand Down
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,30 @@ cmake --build build
```

### macOS

Install the dependencies, for example with Homebrew:
```sh
brew install cmake ninja python
```
Then clone:
```sh
git clone https://github.com/allkern/iris --recursive
cd iris
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
```
mbedTLS uses a Python source generator, which requires some dependencies. You can use a virtual environment to install these locally:
```sh
python3 -m venv .venv
./.venv/bin/pip install -r deps/mbedtls/scripts/basic.requirements.txt
```
Finally, configure and build:
```sh
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DPython3_EXECUTABLE=$PWD/.venv/bin/python
cmake --build build
```
Optionally run `sudo cmake --install build` to generate a macOS App Bundle
You can also generate a proper Bundle if you'd like:
```sh
cmake --install build --prefix .
```
You'll then find a full `iris.app` in the project directory.

## Progress/Insights
Iris can boot/run a fairly large number of commercial games, playability may be all over the place though, some games run fairly smoothly, while others can't break the 1 digit FPS mark, this is due to the lack of EE/VU JITs which will be addressed soon.
Expand Down
Loading