diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b63f25001efd0b637107ef56402427ecf0e3f6a..e2b4173dfeae1e645993924a10fd1cdedb4ba81b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,16 +7,15 @@ option(DEBUGING "enable debug mode" ON) option(USE_EXCEPTION "use std exception" OFF) option(LOG_PROFILE "log profile" OFF) # select the platform to build -option(CPU "armv7 with neon" ON) -option(MALI_GPU "mali gpu" OFF) +option(CPU "armv7 with neon" OFF) +option(GPU_MALI "mali gpu" OFF) +option(GPU_CL "opencl gpu" ON) option(FPGA "fpga" OFF) file(GLOB_RECURSE PADDLE_MOBILE_CC src/*.cc src/*.cpp src/*.c src/*.mm) file(GLOB_RECURSE PADDLE_MOBILE_H src/*.h) include_directories(src/) -include_directories(third_party/opecl/OpenCL-Headers) - if(IS_IOS) set(CMAKE_CXX_FLAGS "-mfpu=neon -marm -fobjc-abi-version=2 -fobjc-arc -std=gnu++11 -stdlib=libc++ -O3 -s -isysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS}") @@ -71,7 +70,23 @@ else() endforeach() endif() -if (MALI_GPU) +if (GPU_CL) + add_definitions(-DPADDLE_MOBILE_CL) + include_directories(third_party/opecl/OpenCL-Headers) + link_libraries(third_party/opecl/libOpenCL.so) +else() + file(GLOB_RECURSE _tmp_list src/framework/cl/*.cpp src/operators/kernel/cl/*.cpp) + foreach(f ${_tmp_list}) + list(REMOVE_ITEM PADDLE_MOBILE_CC ${f}) + endforeach() + + file(GLOB_RECURSE _tmp_list_h src/framework/cl/*.h) + foreach(f ${_tmp_list_h}) + list(REMOVE_ITEM PADDLE_MOBILE_H ${f}) + endforeach() +endif() + +if (GPU_MALI) add_definitions(-DPADDLE_MOBILE_MALI_GPU) add_definitions(-DUSE_ACL=1) add_definitions(-DUSE_OPENCL)