Repository: incubator-weex
Updated Branches:
  refs/heads/cmake [created] d43f3660c


* [Core] Reorganized the CMake build files.

This patch fixed some of the issues in CMake build config and related
files, which includes:

1. Renamed the project as "WeexCore", also renamed the corresponding
  libraries as libweexcore and libweexipc, which better described
  the project current status.
2. Splitted the source files into COMMON_SRCS which are platform
  irrelevant, as well as ANDROID_SRCS which are platform relevant.
3. Removed some unnecessary includes and links.


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/d43f3660
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/d43f3660
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/d43f3660

Branch: refs/heads/cmake
Commit: d43f3660c06885de82721bc9dd389308d2e121e7
Parents: fe1dc0a
Author: Jonathan Dong <[email protected]>
Authored: Tue May 22 21:34:48 2018 +0800
Committer: Jonathan Dong <[email protected]>
Committed: Tue May 22 21:40:29 2018 +0800

----------------------------------------------------------------------
 android/sdk/build.gradle                        |  18 ++--
 android/sdk/libs/armeabi/libweexjsc.so          | Bin 620328 -> 0 bytes
 .../main/java/com/taobao/weex/WXSDKEngine.java  |   6 +-
 .../com/taobao/weex/bridge/WXBridgeManager.java |   8 +-
 weex_core/CMakeLists.txt                        |   4 +-
 weex_core/Source/CMakeLists.txt                 | 101 ++++++++-----------
 weex_core/Source/IPC/CMakeLists.txt             |  35 +++----
 7 files changed, 77 insertions(+), 95 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d43f3660/android/sdk/build.gradle
----------------------------------------------------------------------
diff --git a/android/sdk/build.gradle b/android/sdk/build.gradle
index 833597e..85df919 100755
--- a/android/sdk/build.gradle
+++ b/android/sdk/build.gradle
@@ -45,7 +45,7 @@ android {
     buildToolsVersion project.buildToolsVersion
     resourcePrefix "weex"
 
-    delete 'libs/armeabi/libweexjsc.so'
+    delete 'libs/armeabi/libweexcore.so'
     useLibrary 'org.apache.http.legacy'
     copy {
         from '../../pre-build'
@@ -81,20 +81,20 @@ android {
     if(project.hasProperty('asfRelease')){
         //download so file if not exist, when compile in source release
         download{
-            src 
'https://git-wip-us.apache.org/repos/asf?p=incubator-weex.git;a=blob_plain;f=android/sdk/libs/armeabi/libweexjsc.so;hb=refs/heads/master'
-            dest "${projectDir}/libs/armeabi/libweexjsc.so"
+            src 
'https://git-wip-us.apache.org/repos/asf?p=incubator-weex.git;a=blob_plain;f=android/sdk/libs/armeabi/libweexcore.so;hb=refs/heads/master'
+            dest "${projectDir}/libs/armeabi/libweexcore.so"
             overwrite false
         }
         download{
-            src 
'https://git-wip-us.apache.org/repos/asf?p=incubator-weex.git;a=blob_plain;f=android/sdk/libs/x86/libweexjsc.so;hb=refs/heads/master'
-            dest "${projectDir}/libs/x86/libweexjsc.so"
+            src 
'https://git-wip-us.apache.org/repos/asf?p=incubator-weex.git;a=blob_plain;f=android/sdk/libs/x86/libweexcore.so;hb=refs/heads/master'
+            dest "${projectDir}/libs/x86/libweexcore.so"
             overwrite false
         }
     }
 
-    def ARMEABI_Size = new 
File(projectDir,"libs/armeabi/libweexjsc.so").length();
-    def ARMEABIV7_Size = new 
File(projectDir,"libs/armeabi-v7/libweexjsc.so").length();
-    def X86_Size = new File(projectDir,"libs/x86/libweexjsc.so").length();
+    def ARMEABI_Size = new 
File(projectDir,"libs/armeabi/libweexcore.so").length();
+    def ARMEABIV7_Size = new 
File(projectDir,"libs/armeabi-v7/libweexcore.so").length();
+    def X86_Size = new File(projectDir,"libs/x86/libweexcore.so").length();
     println "ARMEABI_Size: "+ARMEABI_Size;
     println "ARMEABIV7_Size:" + ARMEABIV7_Size;
     println "X86_Size:" + X86_Size;
@@ -218,4 +218,4 @@ if(file('../license/LICENSE').exists()){
                          'Source/IPC/**/*.h','Source/IPC/**/*.cpp'])
     }
     preBuild.dependsOn licenseFormat
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d43f3660/android/sdk/libs/armeabi/libweexjsc.so
----------------------------------------------------------------------
diff --git a/android/sdk/libs/armeabi/libweexjsc.so 
b/android/sdk/libs/armeabi/libweexjsc.so
deleted file mode 100644
index 3eba4c5..0000000
Binary files a/android/sdk/libs/armeabi/libweexjsc.so and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d43f3660/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java 
b/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
index 4fef0c3..65c540d 100644
--- a/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
+++ b/android/sdk/src/main/java/com/taobao/weex/WXSDKEngine.java
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -102,7 +102,7 @@ public class WXSDKEngine implements Serializable {
 
   public static final String JS_FRAMEWORK_RELOAD="js_framework_reload";
 
-  private static final String V8_SO_NAME = "weexjsc";
+  private static final String V8_SO_NAME = "weexcore";
   private volatile static boolean mIsInit = false;
   private static final Object mLock = new Object();
   private static final String TAG = "WXSDKEngine";

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d43f3660/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java
----------------------------------------------------------------------
diff --git 
a/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java 
b/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java
index 93bf0b8..d42f059 100644
--- a/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java
+++ b/android/sdk/src/main/java/com/taobao/weex/bridge/WXBridgeManager.java
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -753,7 +753,7 @@ public class WXBridgeManager implements Callback, 
BactchExecutor {
   }
 
   public void callReportCrash(String crashFile, final String instanceId, final 
String url) {
-    // statistic weexjsc process crash
+    // statistic weex core process crash
     Date date = new Date();
     DateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
     String time = format.format(date);
@@ -1176,7 +1176,7 @@ public class WXBridgeManager implements Callback, 
BactchExecutor {
     }
 
     String method = "callReportCrash";
-    String exception = "weexjsc process crash and restart exception";
+    String exception = "weex core process crash and restart exception";
     Map<String, String> extParams = new HashMap<String, String>();
     extParams.put("jscCrashStack", errMsg);
     IWXJSExceptionAdapter adapter = 
WXSDKManager.getInstance().getIWXJSExceptionAdapter();

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d43f3660/weex_core/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/weex_core/CMakeLists.txt b/weex_core/CMakeLists.txt
index 83d128e..2894e59 100644
--- a/weex_core/CMakeLists.txt
+++ b/weex_core/CMakeLists.txt
@@ -1,5 +1,3 @@
 cmake_minimum_required(VERSION 3.4.1)
-project(weexv8)
-set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
-#include(Android)
+project(WeexCore)
 add_subdirectory(Source)

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d43f3660/weex_core/Source/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/weex_core/Source/CMakeLists.txt b/weex_core/Source/CMakeLists.txt
index 77ba922..93e9d1f 100644
--- a/weex_core/Source/CMakeLists.txt
+++ b/weex_core/Source/CMakeLists.txt
@@ -1,9 +1,9 @@
 cmake_minimum_required(VERSION 3.4.1)
+set(WEEXCORE_LIBRARY_NAME weexcore)
 
 add_compile_options(-std=c++11)
 add_compile_options(-fexceptions)
 
-add_definitions(-DOS_ANDROID=1)
 add_definitions(-DGNU_SUPPORT=1)
 add_definitions(-DJSONCPP_NO_LOCALE_SUPPORT=1)
 add_definitions(-DDEBUG=1)
@@ -15,15 +15,44 @@ add_definitions(-DJSAPI_LOG=0)
 add_definitions(-DDOM_PARSER_LOG=0)
 
 ## add_subdirectory for subdirectory has a CMakeLists.txt
-add_subdirectory(${CMAKE_SOURCE_DIR}/Source/IPC)
+add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/IPC)
 
 ## include_directories for include head file
-## include_directories(${CMAKE_SOURCE_DIR}/Source/IPC)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/IPC)
 
-include_directories("include")
+set(COMMON_SRCS
+  ./core/api/WeexJSCoreApi.cpp
 
-add_library(weexjsc SHARED
+  ./core/render/manager/render_manager.cpp
+  ./core/render/page/render_page.cpp
+  ./core/render/node/render_object.cpp
+  ./core/render/node/factory/render_creator.cpp
+  ./core/render/action/render_action_add_event.cpp
+  ./core/render/action/render_action_remove_event.cpp
+  ./core/render/action/render_action_add_element.cpp
+  ./core/render/action/render_action_remove_element.cpp
+  ./core/render/action/render_action_move_element.cpp
+  ./core/render/action/render_action_createbody.cpp
+  ./core/render/action/render_action_createfinish.cpp
+  ./core/render/action/render_action_appendtree_createfinish.cpp
+  ./core/render/action/render_action_layout.cpp
+  ./core/render/action/render_action_update_attr.cpp
+  ./core/render/action/render_action_update_style.cpp
 
+  ./core/parser/dom_parser.cpp
+
+  ./core/layout/layout.cpp
+  ./core/layout/style.cpp
+
+  ./core/css/css_value_getter.cpp
+
+  ./core/config/core_environment.cpp
+
+  ./core/moniter/render_performance.cpp
+)
+
+if (ANDROID)
+  set (ANDROID_SRCS
     ./android/jniprebuild/jni_load.cc
     ./android/base/jni/android_jni.cpp
     ./android/base/jni/scoped_java_ref.cpp
@@ -41,56 +70,14 @@ add_library(weexjsc SHARED
     ./android/jsengine/multiprocess/WeexJSConnection.cpp
     ./android/jsengine/multiprocess/WeexProxy.cpp
     ./android/jsengine/multiprocess/ExtendJSApi.cpp
+  )
+
+  add_library(${WEEXCORE_LIBRARY_NAME} SHARED
+    ${COMMON_SRCS}
+    ${ANDROID_SRCS}
+  )
+
+  target_include_directories(${WEEXCORE_LIBRARY_NAME} PUBLIC .)
 
-    ./core/api/WeexJSCoreApi.cpp
-
-    ./core/render/manager/render_manager.cpp
-    ./core/render/page/render_page.cpp
-    ./core/render/node/render_object.cpp
-    ./core/render/node/factory/render_creator.cpp
-    ./core/render/action/render_action_add_event.cpp
-    ./core/render/action/render_action_remove_event.cpp
-    ./core/render/action/render_action_add_element.cpp
-    ./core/render/action/render_action_remove_element.cpp
-    ./core/render/action/render_action_move_element.cpp
-    ./core/render/action/render_action_createbody.cpp
-    ./core/render/action/render_action_createfinish.cpp
-    ./core/render/action/render_action_appendtree_createfinish.cpp
-    ./core/render/action/render_action_layout.cpp
-    ./core/render/action/render_action_update_attr.cpp
-    ./core/render/action/render_action_update_style.cpp
-
-    ./core/parser/dom_parser.cpp
-
-    ./core/layout/layout.cpp
-    ./core/layout/style.cpp
-
-    ./core/css/css_value_getter.cpp
-
-    ./core/config/core_environment.cpp
-    ./core/moniter/render_performance.cpp
-    )
-
- #    set(weexjsc_LIBRARY_TYPE SHARED)
-
- #   set_target_properties(weexjsc
- #   PROPERTIES
- #   LINK_FLAGS 
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}//weexjsc_version_script.txt 
-Wl,--no-undefined -Wl,-soname,libweexjsc.so"
- #   )
-
- #   add_custom_command(
- #       TARGET weexjsc
- #       POST_BUILD
- #       COMMAND ${CMAKE_STRIP} $<TARGET_FILE:weexjsc> -o 
${CMAKE_SOURCE_DIR}/libweexjsc.so
- #       VERBATIM
- #   )
-
-    target_include_directories(weexjsc
-                               PUBLIC
-                               .)
-
-    target_link_libraries(weexjsc 
-                          android
-                          IPC
-                          log
-                          z)
+  target_link_libraries(${WEEXCORE_LIBRARY_NAME} android weexipc log z)
+endif (ANDROID)

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d43f3660/weex_core/Source/IPC/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/weex_core/Source/IPC/CMakeLists.txt 
b/weex_core/Source/IPC/CMakeLists.txt
index 6087009..f95e0b3 100644
--- a/weex_core/Source/IPC/CMakeLists.txt
+++ b/weex_core/Source/IPC/CMakeLists.txt
@@ -1,22 +1,19 @@
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.4.1)
 
-add_library(IPC
-STATIC
-./Serializing/IPCSerializer.cpp
-./IPCResult.cpp
-./IPCSender.cpp
-./IPCException.cpp
-./IPCCommunicator.cpp
-./IPCHandler.cpp
-./IPCListener.cpp
-./IPCFutexPageQueue.cpp
-./IPCFutexPageQueue.cpp
-./ashmem.c
-./IPCCheck.cpp)
+set(IPC_LIBRARY_NAME weexipc)
 
-#target_link_libraries(IPC
-#JavaScriptCore)
+add_library(${IPC_LIBRARY_NAME} STATIC
+  ./Serializing/IPCSerializer.cpp
+  ./IPCResult.cpp
+  ./IPCSender.cpp
+  ./IPCException.cpp
+  ./IPCCommunicator.cpp
+  ./IPCHandler.cpp
+  ./IPCListener.cpp
+  ./IPCFutexPageQueue.cpp
+  ./IPCFutexPageQueue.cpp
+  ./ashmem.c
+  ./IPCCheck.cpp
+)
 
-target_include_directories(IPC
-PUBLIC
-.)
+target_include_directories(${IPC_LIBRARY_NAME} PUBLIC .)

Reply via email to