VSand icon indicating copy to clipboard operation
VSand copied to clipboard

MacOS build

Open Ealrann opened this issue 3 years ago • 0 comments

Here the steps required to compile under MacOS (thanks a lot to @kvark #23 ) :

1. Clone the repo

git clone --recursive --single-branch --branch root https://github.com/Ealrann/VSand.git
cd VSand/
git checkout 7fa5a9d
git submodule update

Note : The head version appears to be currently broken on MacOS. After some digging, it looks like some bugs inside GLFW. They fixed some stuf recently related to the MacOS support, but the last LWJGL Snapshot is older than these fix. I'll update the macos compilation when LWJGL will be updated.

2. Use the Snapshot version of LWJGL

The last LWJGL Snapshot contains some mandatory fix for GLFW. Edit the file Lily-vulkan/gradle.properties and change the Lwjgl version :

lwjglVersion = 3.2.4-SNAPSHOT

3. Edit the run configuration

Macos requires some UI library to run inside the native thread, so we need to pass a special argument to the JVM. More information here and here.

Edit the file Vsand/VSand/org.sheepy.vsand/build.gradle and add the -XstartOnFirstThread arg :

application {
	mainModule = 'org.sheepy.vsand'
	mainClass = 'org.sheepy.vsand.VSandApplicationLauncher'

        applicationDefaultJvmArgs = ["-XstartOnFirstThread"]
}

4. Run

Go to the directory Vsand/VSand and run :

./gradlew run

5. Extra steps if you don't want to use MoltenVk

You need to specify the path to the library libvulkan.dylib. To do so, an extra jvmarg is required. See this post for more information.

Edit the file Vsand/VSand/org.sheepy.vsand and add the -Dorg.lwjgl.vulkan.libname arg :

application {
	mainModule = 'org.sheepy.vsand'
	mainClass = 'org.sheepy.vsand.VSandApplicationLauncher'

        applicationDefaultJvmArgs = ["-XstartOnFirstThread", "-Dorg.lwjgl.vulkan.libname=<path_to_vulkan_sdk>/macOS/lib/libvulkan.dylib"]
}

Ealrann avatar Aug 31 '20 16:08 Ealrann