Skip to content
This repository was archived by the owner on Feb 17, 2022. It is now read-only.

Latest commit

 

History

History
72 lines (54 loc) · 2.21 KB

Compile.md

File metadata and controls

72 lines (54 loc) · 2.21 KB

How to compile Puma from source

Normally you should just use the TestPuma inside Example folder to quickly test drive Puma. But if you want to compile it from source using Swift Package Manager command line tool, then follow

Head over to Swift Package Manager usage to create an executable.

There's an already created ManualCompile for your reference.

Step 1: In your project folder, run these to create Swift Package Manager structure. Create another folder called, for example ManualCompile to keep our script.

mkdir ManualCompile
cd ManualCompile
swift package init --type executable

Step 2: Edit the newly generated Package.swift to include Puma

// swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "ManualCompile",
    platforms: [.macOS("10.14")],
    dependencies: [
        .package(
            url: "https://github.com/pumaSwift/Puma.git",
            .upToNextMajor(from: "0.0.1")
        ),
    ],
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages which this package depends on.
        .target(
            name: "ManualCompile",
            dependencies: [
                "Puma"
            ]
        ),
        .testTarget(
            name: "ManualCompileTests",
            dependencies: ["ManualCompile"]),
    ]
)

Step 3: Go to ManualCompile/Sources/ManualCompile/main.swift, import Puma and declare the tasks.

Step 4: Run

swift build

This will fetch dependencies and build our executable.

Step 5: Copy the built ManualCompile executable from Example/TestApp/ManualCompile/.build/debug/ManualCompile to our TestApp folder

cp -f ./.build/debug/ManualCompile ../puma

Now we should have the executable puma in our project folder.

Step 6: In our project folder, run ./puma to see Puma in action

./puma