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
62 changes: 62 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build on macOS

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

env:
BUILD_TYPE: Release

jobs:
build:
runs-on: macos-latest

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install dependencies via Homebrew
run: |
brew install cmake opencv dylibbundler create-dmg

- name: Verify CMake version
run: cmake --version

- name: Configure CMake
run: |
cmake -B ${{github.workspace}}/build \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DFREEGLUT_COCOA=ON \
-DHD_CPU_OPTIMIZATION=AUTO

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j$(sysctl -n hw.ncpu)

- name: List built binaries
run: |
echo "Built binaries:"
find ${{github.workspace}}/build/bin -type f -perm +111 2>/dev/null || true
ls -lh ${{github.workspace}}/build/bin/

- name: Create App Bundle
run: |
chmod +x ${{github.workspace}}/macos_bundle_toolkit/create_dir_bundle.sh
cd ${{github.workspace}}
./macos_bundle_toolkit/create_dir_bundle.sh

- name: Create DMG Package
run: |
chmod +x ${{github.workspace}}/macos_bundle_toolkit/create_dir_bundle_dmg.sh
cd ${{github.workspace}}
./macos_bundle_toolkit/create_dir_bundle_dmg.sh

- name: Upload DMG Artifact
uses: actions/upload-artifact@v4
with:
name: hdmapping-macos-dmg
path: ${{github.workspace}}/build/HDMapping.dmg
retention-days: 90
compression-level: 0
14 changes: 12 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ else()
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2 -march=x86-64 -mtune=intel -DNDEBUG")
message(STATUS "Enabling Intel-optimized build for GCC/Clang")
elseif(HD_CPU_OPTIMIZATION STREQUAL "ARM")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
if(APPLE)
# On Apple Silicon (macOS), compiler natively targets ARM64, no -march flag needed
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -DNDEBUG")
message(STATUS "Enabling ARM64 native optimizations for Apple Silicon")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -march=armv8-a -DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -march=armv8-a -DNDEBUG")
message(STATUS "Enabling ARM64/AArch64 optimizations for GCC/Clang")
Expand All @@ -98,7 +103,12 @@ else()
elseif(HD_CPU_OPTIMIZATION STREQUAL "AUTO")
# Auto-detect based on processor
cmake_host_system_information(RESULT CPU_VENDOR QUERY PROCESSOR_DESCRIPTION)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm" OR CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
if(APPLE AND (CMAKE_SYSTEM_PROCESSOR MATCHES "arm" OR CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "arm64" OR CPU_VENDOR MATCHES "Apple"))
# On Apple Silicon (macOS), compiler natively targets ARM64, no -march flag needed
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -DNDEBUG")
message(STATUS "Auto-detected Apple Silicon - enabling native ARM64 optimizations")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm" OR CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -march=armv8-a -DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -march=armv8-a -DNDEBUG")
Expand Down
58 changes: 58 additions & 0 deletions macos_bundle_toolkit/bundle_README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
HDMapping Toolset for macOS
============================

This directory contains the complete HDMapping toolset with all required
dependencies bundled together.

INSTALLATION
------------

Option 1: Copy to Applications (recommended)
1. Copy the entire HDMapping folder to /Applications:
cp -r HDMapping /Applications/

2. Add to PATH (optional, for easy command-line access):
echo 'export PATH="/Applications/HDMapping/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Option 2: Keep in any location
Simply copy the HDMapping folder wherever you like. All dependencies
are bundled, so it will work from any location.

USAGE
-----

Run tools directly:
./HDMapping/bin/tool_name

Or if added to PATH:
tool_name

Available tools are located in the bin/ directory. Use:
ls ./HDMapping/bin/

To see all available commands.

STRUCTURE
---------

HDMapping/
├── bin/ All executable tools
├── lib/ Bundled dynamic libraries (dependencies)
└── README.txt This file

All required libraries are in the lib/ directory and are automatically
found by the executables using relative paths.

TROUBLESHOOTING
---------------

If you encounter "command not found" errors:
- Make sure you're using the full path to the executable
- Or add HDMapping/bin to your PATH as described above

If you encounter "library not found" errors:
- Ensure the lib/ directory is in the same parent folder as bin/
- Do not separate bin/ and lib/ directories

For more information, visit: https://github.com/MapsHD/HDMapping
Loading
Loading