Deps: Add libraries needed for Software GL
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 9 Oct 2019 10:36:40 +0000 (12:36 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 9 Oct 2019 10:37:04 +0000 (12:37 +0200)
Only compiled on Linux.

build_files/build_environment/CMakeLists.txt
build_files/build_environment/cmake/harvest.cmake
build_files/build_environment/cmake/libglu.cmake [new file with mode: 0644]
build_files/build_environment/cmake/mesa.cmake [new file with mode: 0644]
build_files/build_environment/cmake/versions.cmake

index e7590727822b74097405a9e17802812a78007703..c7d8de22890bcaa2e870475ab12f7fd32496f9ad 100644 (file)
@@ -158,4 +158,9 @@ if(UNIX)
   include(cmake/sqlite.cmake)
 endif()
 
+if(UNIX AND NOT APPLE)
+  include(cmake/libglu.cmake)
+  include(cmake/mesa.cmake)
+endif()
+
 include(cmake/harvest.cmake)
index b10b413c39a6d1a0f50575311a3ca1e99617b32e..cc596b2c78654f175540eba5de49c8cac3860dcb 100644 (file)
@@ -200,4 +200,9 @@ harvest(xvidcore/lib ffmpeg/lib "*.a")
 harvest(embree/include embree/include "*.h")
 harvest(embree/lib embree/lib "*.a")
 
+if(UNIX AND NOT APPLE)
+  harvest(libglu/lib mesa/lib "*.so*")
+  harvest(mesa/lib mesa/lib "*.so*")
+endif()
+
 endif()
diff --git a/build_files/build_environment/cmake/libglu.cmake b/build_files/build_environment/cmake/libglu.cmake
new file mode 100644 (file)
index 0000000..d1b7647
--- /dev/null
@@ -0,0 +1,40 @@
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+set(LIBGLU_CFLAGS "-static-libgcc")
+set(LIBGLU_CXXFLAGS "-static-libgcc -static-libstdc++ -Bstatic -lstdc++ -Bdynamic -l:libstdc++.a")
+set(LIBGLU_LDFLAGS "-pthread -static-libgcc -static-libstdc++ -Bstatic -lstdc++ -Bdynamic -l:libstdc++.a")
+
+set(LIBGLU_EXTRA_FLAGS
+  CFLAGS=${LIBGLU_CFLAGS}
+  CXXFLAGS=${LIBGLU_CXXFLAGS}
+  LDFLAGS=${LIBGLU_LDFLAGS}
+)
+
+ExternalProject_Add(external_libglu
+  URL ${LIBGLU_URI}
+  DOWNLOAD_DIR ${DOWNLOAD_DIR}
+  URL_HASH MD5=${LIBGLU_HASH}
+  PREFIX ${BUILD_DIR}/libglu
+  CONFIGURE_COMMAND ${CONFIGURE_ENV} &&
+    cd ${BUILD_DIR}/libglu/src/external_libglu/ &&
+    ${CONFIGURE_COMMAND_NO_TARGET} --prefix=${LIBDIR}/libglu ${LIBGLU_EXTRA_FLAGS}
+  BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/libglu/src/external_libglu/ && make -j${MAKE_THREADS}
+  INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/libglu/src/external_libglu/ && make install
+  INSTALL_DIR ${LIBDIR}/libglu
+)
diff --git a/build_files/build_environment/cmake/mesa.cmake b/build_files/build_environment/cmake/mesa.cmake
new file mode 100644 (file)
index 0000000..77fd895
--- /dev/null
@@ -0,0 +1,54 @@
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+set(MESA_CFLAGS "-static-libgcc")
+set(MESA_CXXFLAGS "-static-libgcc -static-libstdc++ -Bstatic -lstdc++ -Bdynamic -l:libstdc++.a")
+set(MESA_LDFLAGS "-L${LIBDIR}/zlib/lib -pthread -static-libgcc -static-libstdc++ -Bstatic -lstdc++ -Bdynamic -l:libstdc++.a -l:libz_pic.a")
+
+set(MESA_EXTRA_FLAGS
+  CFLAGS=${MESA_CFLAGS}
+  CXXFLAGS=${MESA_CXXFLAGS}
+  LDFLAGS=${MESA_LDFLAGS}
+  --enable-glx=gallium-xlib
+  --with-gallium-drivers=swrast
+  --disable-dri
+  --disable-gbm
+  --disable-egl
+  --disable-gles1
+  --disable-gles2
+  --disable-llvm-shared-libs
+  --with-llvm-prefix=${LIBDIR}/llvm/lib
+)
+
+ExternalProject_Add(external_mesa
+  URL ${MESA_URI}
+  DOWNLOAD_DIR ${DOWNLOAD_DIR}
+  URL_HASH MD5=${MESA_HASH}
+  PREFIX ${BUILD_DIR}/mesa
+  CONFIGURE_COMMAND ${CONFIGURE_ENV} &&
+    cd ${BUILD_DIR}/mesa/src/external_mesa/ &&
+    ${CONFIGURE_COMMAND_NO_TARGET} --prefix=${LIBDIR}/mesa ${MESA_EXTRA_FLAGS}
+  BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/mesa/src/external_mesa/ && make -j${MAKE_THREADS}
+  INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/mesa/src/external_mesa/ && make install
+  INSTALL_DIR ${LIBDIR}/mesa
+)
+
+add_dependencies(
+  external_mesa
+  ll
+)
index 621ac6b8bb4784c3d93151d0cac48d67c0bfcdea..1c9e5c5a4f6d87beb44ae638192b1d9feb47514b 100644 (file)
@@ -310,3 +310,11 @@ set(EMBREE_HASH 3d4a1147002ff43939d45140aa9d6fb8)
 set(OIDN_VERSION 1.0.0)
 set(OIDN_URI https://github.com/OpenImageDenoise/oidn/releases/download/v${OIDN_VERSION}/oidn-${OIDN_VERSION}.src.zip)
 set(OIDN_HASH 19fe67b0164e8f020ac8a4f520defe60)
+
+set(LIBGLU_VERSION 9.0.1)
+set(LIBGLU_URI ftp://ftp.freedesktop.org/pub/mesa/glu/glu-${LIBGLU_VERSION}.tar.xz)
+set(LIBGLU_HASH 151aef599b8259efe9acd599c96ea2a3)
+
+set(MESA_VERSION 18.3.1)
+set(MESA_URI ftp://ftp.freedesktop.org/pub/mesa//mesa-${MESA_VERSION}.tar.xz)
+set(MESA_HASH d60828056d77bfdbae0970f9b15fb1be)