mirror of https://github.com/axmolengine/axmol.git
Improve shared library for android, remove mojoal,sdl2, still use OpenAL.framework on apple platform, alsoft on other platforms.
This commit is contained in:
parent
bda3a720b4
commit
d084d9f61a
|
@ -35,31 +35,6 @@ set(COCOS_CORE_LIB cocos2d)
|
||||||
|
|
||||||
project(cocos2d_libs)
|
project(cocos2d_libs)
|
||||||
|
|
||||||
option(CC_USE_MOJOAL "Use mojoAL for all platforms" OFF)
|
|
||||||
option(CC_USE_ALSOFT "Use openal-soft on apple platform" OFF)
|
|
||||||
|
|
||||||
# checking MojoAL first
|
|
||||||
if(CC_USE_MOJOAL)
|
|
||||||
add_definitions(-DCC_USE_MOJOAL=1)
|
|
||||||
else() # choose openal-soft or apple openal framework
|
|
||||||
if(NOT APPLE)
|
|
||||||
set(CC_USE_ALSOFT ON CACHE BOOL "Use openal-soft on apple platform" FORCE)
|
|
||||||
else()
|
|
||||||
set(CC_USE_ALSOFT ${CC_USE_ALSOFT} CACHE BOOL "Use openal-soft on apple platform" FORCE)
|
|
||||||
endif()
|
|
||||||
if(CC_USE_ALSOFT)
|
|
||||||
add_definitions(-DCC_USE_ALSOFT=1)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# store al choice to cache
|
|
||||||
set(CC_USE_MOJOAL ${CC_USE_MOJOAL} CACHE BOOL "Use mojoAL platform" FORCE)
|
|
||||||
set(CC_USE_ALSOFT ${CC_USE_ALSOFT} CACHE BOOL "Use OpenAL-soft platform" FORCE)
|
|
||||||
|
|
||||||
# print al backend
|
|
||||||
message(STATUS "CC_USE_MOJOAL:${CC_USE_MOJOAL}")
|
|
||||||
message(STATUS "CC_USE_ALSOFT:${CC_USE_ALSOFT}")
|
|
||||||
|
|
||||||
include(2d/CMakeLists.txt)
|
include(2d/CMakeLists.txt)
|
||||||
include(3d/CMakeLists.txt)
|
include(3d/CMakeLists.txt)
|
||||||
include(platform/CMakeLists.txt)
|
include(platform/CMakeLists.txt)
|
||||||
|
|
|
@ -127,6 +127,8 @@ else()
|
||||||
add_library(${APP_NAME} SHARED ${all_code_files})
|
add_library(${APP_NAME} SHARED ${all_code_files})
|
||||||
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/platform/android ${ENGINE_BINARY_PATH}/cocos/platform)
|
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/platform/android ${ENGINE_BINARY_PATH}/cocos/platform)
|
||||||
target_link_libraries(${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive)
|
target_link_libraries(${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive)
|
||||||
|
|
||||||
|
config_android_shared_libs("org.cocos2dx.${APP_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/src")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(${APP_NAME} cocos2d)
|
target_link_libraries(${APP_NAME} cocos2d)
|
||||||
|
|
|
@ -31,6 +31,10 @@ import android.view.WindowManager;
|
||||||
import android.view.WindowManager.LayoutParams;
|
import android.view.WindowManager.LayoutParams;
|
||||||
|
|
||||||
public class AppActivity extends Cocos2dxActivity {
|
public class AppActivity extends Cocos2dxActivity {
|
||||||
|
static {
|
||||||
|
// DNT remove, some android simulator require explicit load shared libraries, otherwise will crash
|
||||||
|
SharedLoader.load();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ buildscript {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.4.0'
|
classpath 'com.android.tools.build:gradle:4.0.1'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
|
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip
|
||||||
|
|
|
@ -119,6 +119,8 @@ else()
|
||||||
target_link_libraries(${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive)
|
target_link_libraries(${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive)
|
||||||
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/scripting/lua-bindings/proj.android ${ENGINE_BINARY_PATH}/cocos/lua-android)
|
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/scripting/lua-bindings/proj.android ${ENGINE_BINARY_PATH}/cocos/lua-android)
|
||||||
target_link_libraries(${APP_NAME} -Wl,--whole-archive lua_android_spec -Wl,--no-whole-archive)
|
target_link_libraries(${APP_NAME} -Wl,--whole-archive lua_android_spec -Wl,--no-whole-archive)
|
||||||
|
|
||||||
|
config_android_shared_libs("org.cocos2dx.${APP_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/src")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(${APP_NAME} luacocos2d)
|
target_link_libraries(${APP_NAME} luacocos2d)
|
||||||
|
|
|
@ -30,6 +30,11 @@ import android.os.Bundle;
|
||||||
import org.cocos2dx.lib.Cocos2dxActivity;
|
import org.cocos2dx.lib.Cocos2dxActivity;
|
||||||
|
|
||||||
public class AppActivity extends Cocos2dxActivity{
|
public class AppActivity extends Cocos2dxActivity{
|
||||||
|
static {
|
||||||
|
// DNT remove, some android simulator require explicit load shared libraries, otherwise will crash
|
||||||
|
SharedLoader.load();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.setEnableVirtualButton(false);
|
super.setEnableVirtualButton(false);
|
||||||
|
|
|
@ -7,7 +7,7 @@ buildscript {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.4.0'
|
classpath 'com.android.tools.build:gradle:4.0.1'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
|
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip
|
||||||
|
|
|
@ -388,8 +388,8 @@ else()
|
||||||
add_library(${APP_NAME} SHARED ${all_code_files})
|
add_library(${APP_NAME} SHARED ${all_code_files})
|
||||||
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/platform/android ${ENGINE_BINARY_PATH}/cocos/platform)
|
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/platform/android ${ENGINE_BINARY_PATH}/cocos/platform)
|
||||||
target_link_libraries(${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive)
|
target_link_libraries(${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive)
|
||||||
configure_file(${OPENAL_SO_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/src/main/jniLibs/${ANDROID_ABI}/${OPENAL_SO_NAME} COPYONLY)
|
|
||||||
configure_file(${MPG123_SO_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/src/main/jniLibs/${ANDROID_ABI}/${MPG123_SO_NAME} COPYONLY)
|
config_android_shared_libs("org.cocos2dx.${APP_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/src")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(${APP_NAME} cocos2d)
|
target_link_libraries(${APP_NAME} cocos2d)
|
||||||
|
|
|
@ -30,9 +30,10 @@ import org.cocos2dx.lib.Cocos2dxActivity;
|
||||||
|
|
||||||
public class AppActivity extends Cocos2dxActivity {
|
public class AppActivity extends Cocos2dxActivity {
|
||||||
static {
|
static {
|
||||||
System.loadLibrary("mpg123");
|
// DNT remove, some android simulator require explicit load shared libraries, otherwise will crash
|
||||||
System.loadLibrary("openal");
|
SharedLoader.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.setEnableVirtualButton(false);
|
super.setEnableVirtualButton(false);
|
||||||
|
@ -46,6 +47,5 @@ public class AppActivity extends Cocos2dxActivity {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// DO OTHER INITIALIZATION BELOW
|
// DO OTHER INITIALIZATION BELOW
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,7 +7,7 @@ buildscript {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.4.0'
|
classpath 'com.android.tools.build:gradle:4.0.1'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
|
|
@ -31,7 +31,7 @@ PROP_TARGET_SDK_VERSION=28
|
||||||
# Available architextures (armeabi-v7a | arm64-v8a | x86)
|
# Available architextures (armeabi-v7a | arm64-v8a | x86)
|
||||||
# To build for multiple architexture, use the `:` between them
|
# To build for multiple architexture, use the `:` between them
|
||||||
# Example - PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86
|
# Example - PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86
|
||||||
PROP_APP_ABI=armeabi-v7a
|
PROP_APP_ABI=arm64-v8a
|
||||||
|
|
||||||
# uncomment it and fill in sign information for release mode
|
# uncomment it and fill in sign information for release mode
|
||||||
#RELEASE_STORE_FILE=file path of keystore
|
#RELEASE_STORE_FILE=file path of keystore
|
||||||
|
|
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip
|
||||||
|
|
|
@ -114,8 +114,7 @@ else()
|
||||||
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/platform/android ${ENGINE_BINARY_PATH}/cocos/platform)
|
add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/platform/android ${ENGINE_BINARY_PATH}/cocos/platform)
|
||||||
target_link_libraries(${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive)
|
target_link_libraries(${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive)
|
||||||
|
|
||||||
configure_file(${OPENAL_SO_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/src/main/jniLibs/${ANDROID_ABI}/${OPENAL_SO_NAME} COPYONLY)
|
config_android_shared_libs("org.cocos2dx.${APP_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/src")
|
||||||
configure_file(${MPG123_SO_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/src/main/jniLibs/${ANDROID_ABI}/${MPG123_SO_NAME} COPYONLY)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(${APP_NAME} cocos2d)
|
target_link_libraries(${APP_NAME} cocos2d)
|
||||||
|
|
|
@ -30,9 +30,9 @@ import org.cocos2dx.lib.Cocos2dxActivity;
|
||||||
|
|
||||||
public class AppActivity extends Cocos2dxActivity {
|
public class AppActivity extends Cocos2dxActivity {
|
||||||
static {
|
static {
|
||||||
System.loadLibrary("mpg123");
|
SharedLoader.load();
|
||||||
System.loadLibrary("openal");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.setEnableVirtualButton(false);
|
super.setEnableVirtualButton(false);
|
||||||
|
|
|
@ -7,7 +7,7 @@ buildscript {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.4.0'
|
classpath 'com.android.tools.build:gradle:4.0.1'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
|
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip
|
|
@ -111,8 +111,7 @@ else()
|
||||||
target_link_libraries(${APP_NAME} -Wl,--whole-archive lua_android_spec -Wl,--no-whole-archive)
|
target_link_libraries(${APP_NAME} -Wl,--whole-archive lua_android_spec -Wl,--no-whole-archive)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
configure_file(${OPENAL_SO_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/src/main/jniLibs/${ANDROID_ABI}/${OPENAL_SO_NAME} COPYONLY)
|
config_android_shared_libs("org.cocos2dx.${APP_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/src")
|
||||||
configure_file(${MPG123_SO_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/proj.android/app/src/main/jniLibs/${ANDROID_ABI}/${MPG123_SO_NAME} COPYONLY)
|
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(${APP_NAME} luacocos2d)
|
target_link_libraries(${APP_NAME} luacocos2d)
|
||||||
target_include_directories(${APP_NAME} PRIVATE Classes)
|
target_include_directories(${APP_NAME} PRIVATE Classes)
|
||||||
|
|
|
@ -31,9 +31,10 @@ import org.cocos2dx.lib.Cocos2dxGLSurfaceView;
|
||||||
|
|
||||||
public class AppActivity extends Cocos2dxActivity{
|
public class AppActivity extends Cocos2dxActivity{
|
||||||
static {
|
static {
|
||||||
System.loadLibrary("mpg123");
|
// DNT remove, some android simulator require explicit load shared libraries, otherwise will crash
|
||||||
System.loadLibrary("openal");
|
SharedLoader.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.setEnableVirtualButton(false);
|
super.setEnableVirtualButton(false);
|
||||||
|
|
|
@ -7,7 +7,7 @@ buildscript {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.4.0'
|
classpath 'com.android.tools.build:gradle:4.0.1'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
|
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip
|
||||||
|
|
Loading…
Reference in New Issue