Skip to content

Commit 170d8e3

Browse files
author
Greg Cockroft
committed
Modernize build: Replace CDep with direct Freetype, upgrade to Gradle 8.13/AGP 8.13.2
- Bundle Freetype 2.13.3 source directly - Remove CDep dependency manager - Update to Java/Kotlin target 17 - Fix JVM target compatibility - Update README installation instructions
1 parent 82734ba commit 170d8e3

852 files changed

Lines changed: 562935 additions & 43 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
/build
2+
/.gradle/
3+
/.idea/
4+
local.properties
5+
*.iml
6+
.cxx/

README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,13 @@ cd AndroidMath
2222
Installation for Android Studio
2323
----------------------------------
2424

25-
Clone this project, run CDep.
26-
CDep pulls in the freetype dependency.
27-
25+
Clone this project and open in Android Studio.
2826

2927
```
3028
git clone https://github.com/gregcockroft/AndroidMath.git
31-
cd AndroidMath/mathdisplaylib
32-
./cdep
3329
```
3430

35-
Open the project in Android Studio
31+
Open the `AndroidMath` folder in Android Studio and sync Gradle.
3632

3733

3834
Using library in your app
@@ -56,9 +52,8 @@ Add below lines to apps's build.gradle
5652

5753
```groovy
5854
dependencies {
59-
implementation 'com.github.gregcockroft:AndroidMath:ALPHA'
55+
implementation 'com.github.gregcockroft:AndroidMath:v1.1.0'
6056
}
61-
6257
```
6358

6459
```xml

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ buildscript {
88
jcenter()
99
}
1010
dependencies {
11-
classpath 'com.android.tools.build:gradle:7.4.2'
11+
classpath 'com.android.tools.build:gradle:8.13.2'
1212
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1313

1414
// NOTE: Do not place your application dependencies here; they belong
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

mathdisplaylib/build.gradle

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ android {
1616
multiDexEnabled true
1717
externalNativeBuild {
1818
cmake {
19-
arguments "-Dcdep-dependencies_DIR=../../../.cdep/modules"
2019
arguments "-DANDROID_STL=c++_shared"
2120
}
2221
}
@@ -42,6 +41,14 @@ android {
4241
}
4342
ndkVersion "28.2.13676358"
4443
namespace 'com.agog.mathdisplay'
44+
45+
compileOptions {
46+
sourceCompatibility JavaVersion.VERSION_17
47+
targetCompatibility JavaVersion.VERSION_17
48+
}
49+
kotlinOptions {
50+
jvmTarget = '17'
51+
}
4552
}
4653

4754
dependencies {
@@ -61,20 +68,6 @@ repositories {
6168
maven { url "https://jitpack.io" }
6269
}
6370

64-
// This pulls in freetype. Dependencies are in cdep.yml
65-
// This only needs to run once but is being run before every build right now so that gradle command line builds will work
66-
67-
task runcdep(type:Exec) {
68-
commandLine './cdep'
69-
}
70-
71-
preBuild.dependsOn(runcdep)
72-
73-
74-
// For Android Studio this needs to be run once from the command line
75-
//
76-
// cd mathdisplaylib
77-
// ./cdep
7871
afterEvaluate {
7972
publishing {
8073
publications {
@@ -83,7 +76,7 @@ afterEvaluate {
8376
from components.release
8477
groupId = 'com.github.gregcockroft'
8578
artifactId = 'AndroidMath'
86-
version = 'v1.0.0'
79+
version = 'v1.1.0'
8780
}
8881
}
8982
}
Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
1-
2-
3-
41
cmake_minimum_required(VERSION 3.4.1)
52

6-
add_library( # Sets the name of the library.
7-
main
8-
9-
# Sets the library as a shared library.
10-
SHARED
11-
12-
# Provides a relative path to your source file(s).
13-
# Associated headers in the same location as their source
14-
# file are automatically included.
15-
freetype_jni.cpp
16-
)
3+
# Build Freetype as a subdirectory (disable optional dependencies)
4+
set(FT_DISABLE_ZLIB ON CACHE BOOL "" FORCE)
5+
set(FT_DISABLE_BZIP2 ON CACHE BOOL "" FORCE)
6+
set(FT_DISABLE_PNG ON CACHE BOOL "" FORCE)
7+
set(FT_DISABLE_HARFBUZZ ON CACHE BOOL "" FORCE)
8+
set(FT_DISABLE_BROTLI ON CACHE BOOL "" FORCE)
9+
add_subdirectory(freetype)
1710

18-
find_package(cdep-dependencies REQUIRED)
19-
add_all_cdep_dependencies(main)
11+
add_library(main SHARED freetype_jni.cpp)
2012

21-
target_link_libraries(main log android)
13+
target_include_directories(main PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/freetype/include)
14+
target_link_libraries(main freetype log android)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
BasedOnStyle: Chromium
2+
AlignAfterOpenBracket: Align
3+
AlignConsecutiveAssignments: true
4+
AlignConsecutiveDeclarations: true
5+
AlignConsecutiveMacros: true
6+
AlignEscapedNewlines: true
7+
# AlignOperands: Align
8+
AlignTrailingComments: true
9+
AlwaysBreakAfterReturnType: AllDefinitions
10+
BreakBeforeBraces: Allman
11+
ColumnLimit: 80
12+
DerivePointerAlignment: false
13+
IndentCaseLabels: false
14+
PointerAlignment: Left
15+
SpaceBeforeParens: ControlStatements
16+
SpacesInParentheses: true

0 commit comments

Comments
 (0)