Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 50663002197a
Choose a base ref
...
head repository: mockingbirdnest/Principia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 9123004b3530
Choose a head ref
  • 10 commits
  • 3 files changed
  • 2 contributors

Commits on Oct 3, 2020

  1. Copy the full SHA
    16b53ce View commit details
  2. Define AGENT_OS if not present in make script.

    AGENT_OS is defined automatically in the Azure pipeline, but not for
    users compiling by hand.
    rnlahaye committed Oct 3, 2020
    Copy the full SHA
    7f636b9 View commit details
  3. Added a MacOS script to find KSP assemblies.

    The script automatically builds a KSP Assemblies dir using all copies of
    KSP installed on the user's machine.
    rnlahaye committed Oct 3, 2020
    Copy the full SHA
    22c736b View commit details
  4. Use msbuild instead of mdtool for adapter builds.

    This only affects MacOS/Linux adapter builds. The release pipeline
    uses Windows to generate adapter builds and is unaffected.
    rnlahaye committed Oct 3, 2020
    Copy the full SHA
    e7be41d View commit details
  5. Copy the full SHA
    26496a7 View commit details
  6. Revert "Define AGENT_OS if not present in make script."

    This reverts commit 7f636b9.
    rnlahaye committed Oct 3, 2020
    Copy the full SHA
    e36587a View commit details
  7. Revert "Made principia_make.sh executable."

    This reverts commit 16b53ce.
    rnlahaye committed Oct 3, 2020
    Copy the full SHA
    d2e3d95 View commit details
  8. Added trailing newline.

    rnlahaye committed Oct 3, 2020
    Copy the full SHA
    f9551f6 View commit details
  9. Copy the full SHA
    648ade0 View commit details
  10. Merge pull request #2745 from rnlahaye/macos-fixes

    Minor fixes for local macOS build
    eggrobin authored Oct 3, 2020
    Copy the full SHA
    9123004 View commit details
Showing with 60 additions and 5 deletions.
  1. +2 −3 Makefile
  2. +33 −0 add_ksp_assemblies_macos.sh
  3. +25 −2 documentation/Setup.md
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)

CXX := clang++
MSBUILD := msbuild

VERSION_TRANSLATION_UNIT := base/version.generated.cc

@@ -100,15 +101,13 @@ ifeq ($(UNAME_S),Linux)
else
SHARED_ARGS += -m32
endif
MDTOOL := mdtool
LIBS += -lsupc++ -lc++fs
TEST_LIBS += -lsupc++
SHAREDFLAG := -shared
endif
ifeq ($(UNAME_S),Darwin)
INCLUDES += -I$(DEP_DIR)compatibility/filesystem -I$(DEP_DIR)compatibility/optional -I$(DEP_DIR)Optional
SHARED_ARGS += -mmacosx-version-min=10.12 -arch x86_64 -D_LIBCPP_STD_VER=16
MDTOOL ?= "/Applications/Xamarin Studio.app/Contents/MacOS/mdtool"
SHAREDFLAG := -dynamiclib
endif

@@ -289,7 +288,7 @@ benchmark: $(PRINCIPIA_BENCHMARK_BIN)
########## Adapter

$(ADAPTER): $(GENERATED_PROFILES)
$(MDTOOL) build -c:$(ADAPTER_CONFIGURATION) ksp_plugin_adapter/ksp_plugin_adapter.csproj
$(MSBUILD) -p:Configuration=$(ADAPTER_CONFIGURATION) ksp_plugin_adapter/ksp_plugin_adapter.csproj

######### Distribution

33 changes: 33 additions & 0 deletions add_ksp_assemblies_macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This script searches for all copies of KSP on your MacOS computer and adds
# references to them in ../KSP Assemblies. This will allow you to build the C#
# project.

# The script utilizes MacOS's metadata utilities and its application structure.
# It does not work on other OSes.
AGENT_OS=$(uname -s)
if [[ "${AGENT_OS}" != "Darwin" ]]; then
echo "This script only supports MacOS."
exit 1
fi

# Create the KSP Assemblies dir if not present.
BASE_DIR=$(dirname $0)
KSP_ASSEMBLIES_DIR="${BASE_DIR}/../KSP Assemblies"
mkdir -p "${KSP_ASSEMBLIES_DIR}"

# Get all installed copies of KSP.
KSP_BUNDLE_IDENTIFIER="unity.Squad.Kerbal Space Program"
IFS=$'\n' KSP_APPS=($(mdfind "kMDItemCFBundleIdentifier == '${KSP_BUNDLE_IDENTIFIER}'"))

for KSP_APP in "${KSP_APPS[@]}"; do
echo "Found ${KSP_APP}"

# Get the KSP version.
KSP_VERSION=$(mdls -name=kMDItemVersion -raw "${KSP_APP}")
echo "Version: ${KSP_VERSION}"

# Link the KSP app's dlls to the KSP Assemblies dir.
SOURCE_DIR="${KSP_APP}/Contents/Resources/Data/Managed"
TARGET_DIR="${KSP_ASSEMBLIES_DIR}/${KSP_VERSION}"
ln -s "${SOURCE_DIR}" "${TARGET_DIR}"
done
27 changes: 25 additions & 2 deletions documentation/Setup.md
Original file line number Diff line number Diff line change
@@ -80,9 +80,21 @@ In `<root>`, run the following command:

*Note that the released binaries for Linux and macOS are built using [Azure pipelines](https://dev.azure.com/mockingbirdnest/Principia/_build). The instructions below are best effort.*

## Build Prerequisites
Before starting, make sure the following are installed on your machine:
* Build prerequisites: `build-essential`, `clang`, `libc++-dev`, `libc++abi-dev`, `monodevelop`, `subversion`, and `git`;
### Linux
* Plugin build prerequisites: `build-essential`, `clang`, `libc++-dev`, `libc++abi-dev`, `subversion`, and `git`;
* Adapter build prequisites: `msbuild`
* Runtime dependencies: `libc++1`.
### macOS
* You will need `clang` version 8 and the Xcode command-line tools.
Clang 8 is included as part of Xcode versions 11.0 through 11.3.1.
If you can't install Xcode 11 (possibly because you are using a macOS version prior to 10.14.4),
you can install clang manually using [MacPorts](https://www.macports.org) or [Homebrew](https://brew.sh).
You will still need to install some version of Xcode for its command-line tools.
* To build the adapter, you will need `msbuild`. It is included as part of [Mono](https://www.mono-project.com/download/stable/), and can alternatively be installed directly using a package manager.
You might be able to build it using [Visual Studio for Mac](https://visualstudio.microsoft.com/vs/mac/),
but this is untested.

## Installing the dependencies

@@ -92,10 +104,21 @@ In `<root>/Principia`, run the following command:
```
This will install and compile all the third-party components that Principia uses. Don't proceed with the next step unless this step has completed without errors.

### KSP and Unity assemblies
In order to build the adapter, you will need references to the KSP and Unity assemblies.
Principia expects to find these in a directory adjacent to the principia directory.
For example, in order to build for KSP 1.10.1, the assembly directory should be linked to `../KSP Assemblies/1.10.1` (relative to the Principia directory).

A shell script is provided that will do this automatically on macOS:
```
./add_ksp_assemblies_macos.sh
```

## Building Principia

In `<root>/Principia`, run the following command:
```bash
./principia_make.sh
make
```
See the Makefile for more options.
If some of the unit tests fail, you may or may not be able to run the resulting version of Principia.