-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
【Hackathon No.65】Refactor and modernize for emscripten #8985
Changes from all commits
9c67c29
481ddf6
82c3eeb
d9ada68
13891db
c7847dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
if(NOT LITE_WITH_ARM) | ||
if(LITE_WITH_X86) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个属于 bugfix |
||
include(external/xbyak) # download xbyak package | ||
include(external/xxhash) # download install xxhash | ||
include(external/libxsmm) # download, build, install libxsmm | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,9 +12,10 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
if (NOT EMSCRIPTEN) | ||
INCLUDE(ExternalProject) | ||
|
||
SET(GFLAGS_SOURCES_DIR ${CMAKE_SOURCE_DIR}/third-party/gflags) | ||
SET(GFLAGS_SOURCES_DIR ${PADDLE_SOURCE_DIR}/third-party/gflags) | ||
SET(GFLAGS_INSTALL_DIR ${THIRD_PARTY_PATH}/install/gflags) | ||
SET(GFLAGS_INCLUDE_DIR "${GFLAGS_INSTALL_DIR}/include" CACHE PATH "gflags include directory." FORCE) | ||
IF(WIN32) | ||
|
@@ -73,3 +74,12 @@ if (WIN32) | |
set_property(GLOBAL PROPERTY OS_DEPENDENCY_MODULES shlwapi.lib) | ||
endif(HAVE_SHLWAPI) | ||
endif (WIN32) | ||
|
||
else() | ||
|
||
option(BUILD_STATIC_LIBS "" ON) | ||
option(BUILD_TESTING "" OFF) | ||
set(GFLAGS_NAMESPACE "google;gflags") | ||
add_subdirectory(${PROJECT_SOURCE_DIR}/third-party/gflags) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这样改动有两个原因
|
||
|
||
endif(NOT EMSCRIPTEN) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,7 +119,6 @@ if (NOT WIN32) | |
set(COMMON_FLAGS | ||
-fPIC | ||
-fno-omit-frame-pointer | ||
-Werror | ||
-Wall | ||
-Wextra | ||
-Wnon-virtual-dtor | ||
|
@@ -140,6 +139,11 @@ set(COMMON_FLAGS | |
-Wno-error=maybe-uninitialized # Warning in boost gcc 7.2 | ||
) | ||
|
||
if (NOT EMSCRIPTEN) | ||
# disable -Werror for Emscripten | ||
set(COMMON_FLAGS "${COMMON_FLAGS} -Werror") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. -Werror 会对 emscripten 链接器也生效,而且没办法用 -Wno-error=xxx 来 suppress,所以在使用 emscripten 时就关掉了 |
||
endif(EMSCRIPTEN) | ||
|
||
set(GPU_COMMON_FLAGS | ||
-fPIC | ||
-fno-omit-frame-pointer | ||
|
@@ -154,7 +158,7 @@ set(GPU_COMMON_FLAGS | |
-Wno-error=array-bounds # Warnings in Eigen::array | ||
-gencode arch=compute_62,code=sm_62 | ||
) | ||
if(NOT LITE_WITH_CUDA AND NOT LITE_WITH_SW) | ||
if(NOT LITE_WITH_CUDA AND NOT LITE_WITH_SW AND NOT EMSCRIPTEN) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64") | ||
endif() | ||
endif(NOT WIN32) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
所有的 CMAKE_SOURCE_DIR 改成了正确的 PADDLE_SOURCE_DIR,CMAKE_BINARY_DIR 改成了正确的 PADDLE_BINARY_DIR,否则 paddle-lite 无法作为其它项目的 subdirectory