-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to CMake for native mac build
- Added build docs - Hopefully works on M1 Closes GH-7
- Loading branch information
1 parent
23ec85f
commit a0ac780
Showing
8 changed files
with
198 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
|
||
Building | ||
======== | ||
|
||
This doc covers building through command line. | ||
IDE setup should be relatively straightforward, though I have had occasional issues with setting `JAVA_HOME` properly for cmake. | ||
|
||
Common TLDR Guide | ||
----------------- | ||
Try this before wasting your time reading the rest of this docs. | ||
|
||
- Make sure `JAVA_HOME` is JDK 17 | ||
- Run `mvn clean package` | ||
- Fix anything it complains about (i.e. missing tools) | ||
- Try again | ||
|
||
The final shimeji folder will be in `target/ShimejiEE` | ||
|
||
To skip native build, disable the `cmake` profile in maven | ||
|
||
macOS | ||
----- | ||
|
||
This guide uses [Homebrew](https://brew.sh/) to install dependencies. | ||
|
||
### Install Dependencies | ||
|
||
```shell | ||
# java | ||
brew install maven | ||
brew install openjdk@17 | ||
|
||
# symlink java (see https://formulae.brew.sh/formula/openjdk@17) | ||
sudo ln -sfn $HOMEBREW_PREFIX/opt/openjdk@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk | ||
|
||
# native (if you'll be building the JNI libs) | ||
brew install cmake | ||
brew install ninja | ||
``` | ||
|
||
### Setup Java | ||
|
||
Make sure that `JAVA_HOME` is set to the correct version. | ||
If you symlinked java in the previous step here's a nice shortcut ([more info](https://stackoverflow.com/questions/21964709/)). | ||
|
||
```shell | ||
export JAVA_HOME=$(/usr/libexec/java_home -v 17) | ||
``` | ||
|
||
### Build | ||
|
||
The following command cleans any build files and builds ShimejiEE along with the native libraries for macOS. | ||
```shell | ||
mvn clean package | ||
``` | ||
|
||
If you want to skip building native libs, use this command. | ||
```shell | ||
mvn clean package -P '!cmake' | ||
``` | ||
|
||
### Run | ||
```shell | ||
java -jar target/ShimejiEE/ShimejiEE.jar | ||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
cmake_minimum_required(VERSION 3.24) | ||
|
||
set(CMAKE_OSX_ARCHITECTURES arm64 x86_64) | ||
set(ONLY_ACTIVE_ARCH NO) | ||
|
||
enable_language(OBJC) | ||
|
||
project(ShimejiMacJni) | ||
|
||
add_library(ShimejiMacJni SHARED) | ||
|
||
# disable ARC | ||
target_compile_options(ShimejiMacJni PUBLIC -fno-objc-arc) | ||
|
||
# JNI | ||
find_package(Java 17 REQUIRED COMPONENTS Development) | ||
find_package(JNI REQUIRED) | ||
target_include_directories(ShimejiMacJni PUBLIC ${JNI_INCLUDE_DIRS}) | ||
|
||
# Cocoa | ||
find_library(COCOA_LIB Cocoa) | ||
target_link_libraries(ShimejiMacJni ${COCOA_LIB}) | ||
|
||
# sources | ||
target_include_directories(ShimejiMacJni PUBLIC src) | ||
target_include_directories(ShimejiMacJni PUBLIC ../headers) | ||
|
||
target_sources(ShimejiMacJni PRIVATE | ||
src/JdkCode.m | ||
src/JdkCode.h | ||
src/JniHelper.m | ||
src/JniHelper.h | ||
|
||
src/rendering/MacJniNativeImage.m | ||
src/rendering/MacJniShimejiWindow.m | ||
src/rendering/ShimejiWindow.m | ||
src/rendering/ShimejiWindow.h | ||
|
||
src/environment/MacJniEnvironment.m | ||
src/environment/ShimejiEnvironment.m | ||
src/environment/ShimejiEnvironment.h | ||
|
||
src/menu/MacJniMenu.m | ||
src/menu/JniMenuListener.m | ||
src/menu/JniMenuListener.h | ||
src/menu/MacJniMenuItem.m | ||
src/menu/MacJniMenuItem.h | ||
) | ||
|
This file was deleted.
Oops, something went wrong.