[Beignet] [PATCH 1/3] add option BUILD_STATIC_GBE_COMPILER to build static compiler

Guo, Yejun yejun.guo at intel.com
Wed Dec 31 03:07:25 PST 2014


Just build libcl.so and libgbeinterp.so in the old c/c++ environment, and use the offline compiler that built in mainstream c/c++ environment. It will make beignet workable with CL_EMBEDDED_PROFILE in the old c/c++ environment, please refer to my next two patches of this patch set.

From: spring_wind [mailto:spring_wind at yeah.net]
Sent: Wednesday, December 31, 2014 4:30 PM
To: Guo, Yejun
Cc: beignet at lists.freedesktop.org
Subject: Re:[Beignet] [PATCH 1/3] add option BUILD_STATIC_GBE_COMPILER to build static compiler

Do you have plan to support to build libcl and libgbe_interp in static way? Only add static in CMakeList.txt will not work, because init function will not be called if we use libcl.a and libgbe_interp.a, but it works for libcl.so and libgbe_interp.so.


At 2014-12-31 15:34:22, "Guo Yejun" <yejun.guo at intel.com<mailto:yejun.guo at intel.com>> wrote:

>The offline 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.

>

>Signed-off-by: Guo Yejun <yejun.guo at intel.com<mailto:yejun.guo at intel.com>>

>---

> backend/src/CMakeLists.txt | 33 +++++++++++++++++++++++----------

> 1 file changed, 23 insertions(+), 10 deletions(-)

>

>diff --git a/backend/src/CMakeLists.txt b/backend/src/CMakeLists.txt

>index bec0d2a..118a745 100644

>--- a/backend/src/CMakeLists.txt

>+++ b/backend/src/CMakeLists.txt

>@@ -117,22 +117,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)

>

>@@ -149,8 +149,21 @@ if (LLVM_VERSION_NODOT VERSION_EQUAL 34)

> endif(LLVM_VERSION_NODOT VERSION_EQUAL 34)

>

> link_directories (${LLVM_LIBRARY_DIR} ${DRM_LIBDIR})

>+

>+if (BUILD_STATIC_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})

>+else (BUILD_STATIC_GBE_COMPILER STREQUAL "true")

> ADD_EXECUTABLE(gbe_bin_generater gbe_bin_generater.cpp)

> TARGET_LINK_LIBRARIES(gbe_bin_generater gbe)

>+endif (BUILD_STATIC_GBE_COMPILER STREQUAL "true")

>+

>

> install (TARGETS gbe LIBRARY DESTINATION ${BEIGNET_INSTALL_DIR})

> install (TARGETS gbeinterp LIBRARY DESTINATION ${BEIGNET_INSTALL_DIR})

>--

>1.9.1

>

>_______________________________________________

>Beignet mailing list

>Beignet at lists.freedesktop.org<mailto:Beignet at lists.freedesktop.org>

>http://lists.freedesktop.org/mailman/listinfo/beignet

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/beignet/attachments/20141231/487c5753/attachment.html>


More information about the Beignet mailing list