Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

DevX-Cipher/WinToMacApps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

58 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧰 Cross-Compile macOS Apps on Windows β€” C, Objective-C, Qt, Cocoa (No Mac Needed)

Platform: Windows Builds macOS Apps License: MIT (Non-Commercial)

Build native macOS applications β€” including Cocoa and Qt-based GUI apps β€” entirely on Windows, using Clang, CMake, and Ninja.

xar archive coming to windows soon

βœ… No Mac required to build. Just transfer and run the output on a real Mac.

πŸ–±οΈ New: Use the built-in Toolchain GUI to select your macOS SDK, configure deployment targets, and generate CMake projects.

πŸ“‚ Find the Toolchain GUI in the tool/ folder of this repo.

✨ Features

  • Build real macOS .app and CLI binaries from Windows
  • Full support for C, Objective-C, and Qt (QtWidgets)
  • Cocoa GUI support (AppDelegate, XIB-style)
  • Works with CMake + Ninja or Visual Studio
  • Automatically detects macOS SDK from SDK/ folder
  • Includes working examples: CLI, Cocoa, and Qt GUI
  • No VM or Hackintosh required

πŸ“¦ Overview

This project provides a cross-compilation toolchain that allows you to build native macOS executables β€” including GUI apps β€” from a Windows system. It supports:

  • Clang + macOS SDK
  • Objective-C, C, and C++ (Qt)
  • Cocoa GUI (with AppDelegate)
  • Qt Widgets-based GUI

πŸ“ Project Structure

MacCross/
β”œβ”€β”€ CMakeLists.txt
β”œβ”€β”€ SDK/
β”‚   └── MacOSX14.5.sdk/             # <--- Place SDK here
β”œβ”€β”€ C-Example/
β”‚   └── hello.c
β”œβ”€β”€ ObjC-Example/
β”‚   β”œβ”€β”€ main.m
β”‚   β”œβ”€β”€ AppDelegate.h
β”‚   └── AppDelegate.m
β”œβ”€β”€ Qt-Example/
β”‚   β”œβ”€β”€ main.cpp
β”œβ”€β”€ macosx-toolchain.cmake
β”œβ”€β”€ build-Qt.bat                    # Optional manual script
β”œβ”€β”€ build/

πŸ”§ Requirements


πŸ› οΈ How to Build

You can build using either CMake + Ninja (CLI) or Visual Studio (GUI). Both methods work with this project.

πŸ”§ Option 1: CMake + Ninja (Recommended for automation or scripting)

mkdir build
cd build
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=../macosx-toolchain.cmake ..
cmake --build .

πŸ–₯️ Option 2: Visual Studio (Recommended for GUI users)

  1. Open Visual Studio
  2. Select "Open a local folder"
  3. Choose the project root (where CMakeLists.txt is located)
  4. When prompted, select a CMake configuration (e.g., x64-Release)
  5. Visual Studio will detect the CMake project and automatically configure it
  6. Ensure macosx-toolchain.cmake is being used:
    • Go to CMake Settings or CMakePresets.json
    • Set the toolchain file path under CMake toolchain file
  7. Build via Build > Build All

βœ… Make sure the toolchain file is set, or builds will fail.


πŸ“Œ Environment Variables (Static Qt Builds Only)

If you're using Qt (especially static builds), set the following environment variables before building:

set QT_DIR=F:\Qt\6.7.3\macos
set QT_FRAMEWORKS=%QT_DIR%\lib

βœ… MACOSX_SDK_PATH and MACOSX_DEPLOYMENT_TARGET are automatically handled by the toolchain (SDK is detected from the SDK/ folder, deployment target is set to 11.0 by default).


βœ… Verifying the Output

Transfer the built binaries to a Mac and run:

./hello         # From C-Example
./ObjCExample   # From Cocoa app
./QtExample     # From Qt app

Expected output:

Hello, world!

⚠️ Note: Binaries are unsigned. You may need to bypass Gatekeeper to run them.


πŸ“š Examples Included

  • βœ… CLI C Hello World
  • βœ… Cocoa GUI App (Objective-C + AppDelegate)
  • βœ… Qt Widgets GUI App

Want Swift support? Coming soon.



πŸ› οΈ Tools

  • Image to ICNS: Convert PNG or JPEG images to macOS .icns files on Windows.

πŸ“œ License & Legal Note

This project is licensed under the MIT License (with a non-commercial use clause).
See the LICENSE file for more details.


πŸ’¬ Feedback

If you found this project helpful, please open an issue with suggestions or improvements.
Contributions are welcome β€” feel free to submit a pull request!