Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions webrtc-jni/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@
<option>
-DCMAKE_INSTALL_PREFIX=${project.build.directory}/lib
</option>
<option>
-DOUTPUT_NAME_SUFFIX=${platform.classifier}
</option>
</options>
</configuration>
</execution>
Expand Down
1 change: 1 addition & 0 deletions webrtc-jni/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ target_include_directories(${PROJECT_NAME}
)

set_target_properties(${PROJECT_NAME} PROPERTIES
OUTPUT_NAME "${PROJECT_NAME}-${OUTPUT_NAME_SUFFIX}"
CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ public static void loadLibrary(final String libName) throws Exception {
return;
}

String libFileName = System.mapLibraryName(libName);
String osFamily = getOSFamily();
String osArch = getOSArch();
String libFileName = System.mapLibraryName(libName + "-" + osFamily + "-" + osArch);
String tempName = removeExtension(libFileName);
String ext = getExtension(libFileName);

Expand Down Expand Up @@ -119,4 +121,39 @@ private static int getExtensionIndex(String fileName) {
return extSeparator;
}

private static String getOSFamily() {
String osName = System.getProperty("os.name").toLowerCase();

if (osName.startsWith("mac os")) {
return "macos";
}
if (osName.startsWith("linux")) {
return "linux";
}
if (osName.startsWith("windows")) {
return "windows";
}

throw new RuntimeException("Unsupported operating system: " + osName);
}

private static String getOSArch() {
String osArch = System.getProperty("os.arch").toLowerCase();

switch (osArch) {
case "x86_64":
case "x86-64":
case "amd64":
return "x86_64";
case "aarch32":
case "arm":
return "aarch32";
case "aarch64":
case "arm64":
return "aarch64";
}

throw new RuntimeException("Unsupported CPU architecture: " + osArch);
}

}