diff options
author | Guo Yejun <yejun.guo@intel.com> | 2015-01-09 14:42:10 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2015-01-12 09:05:10 +0800 |
commit | d191ae473190bc47e41df6dc3a73cbfd7d3214bb (patch) | |
tree | de5886b1c60e60ed179d0cf578fc72a0d5468ed7 /backend | |
parent | 17fae996979c86e76e91f1ff79950562c3f986e0 (diff) |
add option BUILD_STANDALONE_GBE_COMPILER to build static compiler
The standalone compiler (gbe_bin_generater), depending on LLVM/clang,
could only be built with C++11 features. To make it workable within
old c/c++ version environment, add one CMAKE option to link against
all static libraries.
And also zip the compiler and necessary files into a tar ball.
v2: change the option name to BUILD_STANDALONE_GBE_COMPILER.
zip necessary files into a tar ball.
Signed-off-by: Guo Yejun <yejun.guo@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'backend')
-rw-r--r-- | backend/src/CMakeLists.txt | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/backend/src/CMakeLists.txt b/backend/src/CMakeLists.txt index c208651c..e6d84f98 100644 --- a/backend/src/CMakeLists.txt +++ b/backend/src/CMakeLists.txt @@ -115,22 +115,22 @@ set (GBE_SRC backend/gen8_encoder.cpp ) +set (GBE_LINK_LIBRARIES + ${DRM_INTEL_LIBRARIES} + ${DRM_LIBRARIES} + ${CLANG_LIBRARIES} + ${LLVM_MODULE_LIBS} + ${LLVM_SYSTEM_LIBS} + ${CMAKE_THREAD_LIBS_INIT} + ${CMAKE_DL_LIBS} + ) include_directories (.) link_directories (${LLVM_LIBRARY_DIRS} ${DRM_LIBDIR}) include_directories(${LLVM_INCLUDE_DIRS}) add_library (gbe SHARED ${GBE_SRC}) - -target_link_libraries( - gbe - ${DRM_INTEL_LIBRARIES} - ${DRM_LIBRARIES} - ${CLANG_LIBRARIES} - ${LLVM_MODULE_LIBS} - ${LLVM_SYSTEM_LIBS} - ${CMAKE_THREAD_LIBS_INIT} - ${CMAKE_DL_LIBS}) +target_link_libraries(gbe ${GBE_LINK_LIBRARIES}) add_library(gbeinterp SHARED gbe_bin_interpreter.cpp) @@ -147,8 +147,27 @@ if (LLVM_VERSION_NODOT VERSION_EQUAL 34) endif(LLVM_VERSION_NODOT VERSION_EQUAL 34) link_directories (${LLVM_LIBRARY_DIR} ${DRM_LIBDIR}) + +if (BUILD_STANDALONE_GBE_COMPILER STREQUAL "true") +macro(remove_cxx_flag flag) + string(REPLACE "${flag}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +endmacro() + +remove_cxx_flag("-Wl,-E") +ADD_EXECUTABLE(gbe_bin_generater gbe_bin_generater.cpp ${GBE_SRC}) +set_target_properties(gbe_bin_generater PROPERTIES LINK_FLAGS "-static") +TARGET_LINK_LIBRARIES(gbe_bin_generater ${GBE_LINK_LIBRARIES}) + +ADD_CUSTOM_TARGET(gbecompiler.tgz ALL + COMMAND tar zcf ${OCL_OBJECT_DIR}/gbecompiler.tgz gbe_bin_generater -C ${OCL_OBJECT_DIR} beignet.bc -C ${OCL_OBJECT_DIR} beignet.pch -C ${OCL_OBJECT_DIR} include + DEPENDS gbe_bin_generater beignet_bitcode + ) + +else () ADD_EXECUTABLE(gbe_bin_generater gbe_bin_generater.cpp) TARGET_LINK_LIBRARIES(gbe_bin_generater gbe) +endif () + install (TARGETS gbe LIBRARY DESTINATION ${BEIGNET_INSTALL_DIR}) install (TARGETS gbeinterp LIBRARY DESTINATION ${BEIGNET_INSTALL_DIR}) |