Build Alice 3 and Nebulous jni libraries on Windows

Build Alice 3

IDE

IntelliJ IDEA is recommended for coding/building Alice 3 on windows.
A JetBrain product pack for students can be applied using carnegie mellon email address here.

Java version and System variables

Openjdk-14.0.1 is installed along with the fresh version of IntelliJ IDEA. But that is not the right version we should use to build Alice 3. Alice 3 builds with Java 8. Find JDK 8 here.

Having the right Java version, the system variables for Java and Maven should then be set. IntelliJ IDEA has a bundled maven. Open IntelliJ IDEA and go File -> Settings -> Build, Execution, Deployment -> Build Tools -> Maven to find the directory of the bundled Maven.

After the system variables are correctly set, you should be able to see some information without errors by entering:
mvn -help
and
java -version
in cmd.exe.

Build the project

Before you building the project, check the folder:
%Alice root dir%/tweedle-lang
and make sure it is not empty.
If it is, try switch between branches.
(I met with some compile issues when I was on the master branch and this folder was empty. When I switched to develop branch, the folder was not empty and the issues were fixed)

Then you can start to build the project.
A Maven build/compile is recommonded as a first try, since Maven will help deal with the dependencies.
There are two ways to do a maven build/compile:

  • Enter mvn install in the Terminal window of the IntelliJ IDEA.
  • Open IntelliJ IDEA and go File -> Settings -> Build, Execution, Deployment -> Build Tools -> Maven -> Runner and check the "Delegate IDE build/run actions to Maven" option. And then build project in IDE.

Run the project

After the project is built successfully. We can create a Run/Debug Configuration and run the project.
In the Run/Debug Configurations window, create a new Application configuration and entry required lines as bellow.

New Application Configuration

Note that the working directory should be the root directory where you check the Alice 3 project out.

And the VM options are here:
-ea -splash:"./core/resources/target/distribution/application/SplashScreen.png" -Xmx1024m -Dswing.aatext=true -Dorg.alice.ide.rootDirectory="./core/resources/target/distribution" -Dcom.apple.mrj.application.apple.menu.about.name=Alice3 -Dedu.cmu.cs.dennisc.java.util.logging.Logger.Level=WARNING -Dorg.alice.ide.internalTesting=true -Dorg.lgna.croquet.Element.isIdCheckDesired=true -Djogamp.gluegen.UseTempJarCache=false -Dorg.alice.stageide.isCrashDetectionDesired=false -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider
Double check or re-enter the quotation marks to make sure they are not changed into something fancy.

Then the project should be ready to run.
Final note: If you were delegating IDE build/run actions to Maven in previous step, please uncheck that option. Or you might run into some graphics errors running Alice.

Build nebulous jni libraries

Build the .dll file

I'm using Visual Studio 2019 Community to build the nebulous jni libraries. Not sure whether other versions will work or not.
Use Visual Studio to open the solution file:
%nebulous root dir%/build/windows/jni_nebulous.sln
Right click and build the jni_nebulous project in the solution explorer.
Note that it should be built using x64 instead of x86.

Test the .dll file in Alice 3 project

After building the jni_nebulous.dll file, we should pack it into the Alice 3 project.
Go to:
%alice root dir%/core-nonfree/resources-nonfree/src/platform/win64/nebulous
And replace the existing one with the one you just built.
Then run a mvn compile or mvn install in the Alice 3 project.

The jni_nebulous.dll file should be copied to:
%alice root dir%/core/resources/target/distribution/platform/win64/nebulous/jni_nebulous.dll
Check this one's size and timestamp to make sure it is the one you just built.

Then run Alice 3 and test whether the Sims models can be loaded.

你可能感兴趣的:(Build Alice 3 and Nebulous jni libraries on Windows)