update llvm + clang to 6.0.1 and add openmp for macOS
authorArto Kitula <arto.kitula@gmail.com>
Thu, 9 Aug 2018 14:57:12 +0000 (17:57 +0300)
committerArto Kitula <arto.kitula@gmail.com>
Thu, 9 Aug 2018 14:57:12 +0000 (17:57 +0300)
build_files/build_environment/CMakeLists.txt
build_files/build_environment/cmake/clang.cmake
build_files/build_environment/cmake/llvm.cmake
build_files/build_environment/cmake/openmp.cmake [new file with mode: 0644]
build_files/build_environment/cmake/versions.cmake
build_files/build_environment/patches/clang.diff [deleted file]
build_files/build_environment/patches/llvm-alloca-fix.diff [deleted file]
release/scripts/addons
release/scripts/addons_contrib
source/tools

index f177560c5f63aa58b248df8b1c6a1ca8af84b669..4643c48fa72d97ad768d66347ef81a7e88399536 100644 (file)
@@ -68,6 +68,9 @@ include(cmake/opencollada.cmake)
 include(cmake/opencolorio.cmake)
 include(cmake/llvm.cmake)
 include(cmake/clang.cmake)
+if(APPLE)
+  include(cmake/openmp.cmake)
+endif()
 include(cmake/openimageio.cmake)
 include(cmake/tiff.cmake)
 include(cmake/flexbison.cmake)
@@ -77,6 +80,7 @@ include(cmake/openvdb.cmake)
 include(cmake/python.cmake)
 include(cmake/python_site_packages.cmake)
 include(cmake/numpy.cmake)
+
 if(WITH_WEBP)
        include(cmake/webp.cmake)
 endif()
index 9a2705bc8bea85703fb830606c5d6838b78bef76..b2e6da73793157f41ee41fce4d5e4929cdbf9d8e 100644 (file)
@@ -21,12 +21,12 @@ set(CLANG_EXTRA_ARGS
        -DCLANG_PATH_TO_LLVM_BUILD=${LIBDIR}/llvm
        -DLLVM_USE_CRT_RELEASE=MT
        -DLLVM_USE_CRT_DEBUG=MTd
+       -DLLVM_CONFIG=${LIBDIR}/llvm/bin/llvm-config
 )
 ExternalProject_Add(external_clang
        URL ${CLANG_URI}
        DOWNLOAD_DIR ${DOWNLOAD_DIR}
        URL_HASH MD5=${CLANG_HASH}
-       PATCH_COMMAND ${PATCH_CMD} -p 2 -N -R -d ${BUILD_DIR}/clang/src/external_clang < ${PATCH_DIR}/clang.diff
        PREFIX ${BUILD_DIR}/clang
        CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/clang ${DEFAULT_CMAKE_FLAGS} ${CLANG_EXTRA_ARGS}
        INSTALL_DIR ${LIBDIR}/clang
index 6c59101f5436ae92f9f0b8c39cc6f8427d6c2898..d6f1920a114e7c3e5ca395c4740b1e5ffa826aa9 100644 (file)
@@ -38,7 +38,6 @@ ExternalProject_Add(ll
        URL_HASH MD5=${LLVM_HASH}
        CMAKE_GENERATOR ${LLVM_GENERATOR}
        PREFIX ${BUILD_DIR}/ll
-       PATCH_COMMAND ${PATCH_CMD} -p 0 -d ${BUILD_DIR}/ll/src/ll < ${PATCH_DIR}/llvm-alloca-fix.diff
        CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/llvm ${DEFAULT_CMAKE_FLAGS} ${LLVM_EXTRA_ARGS}
        INSTALL_DIR ${LIBDIR}/llvm
 )
diff --git a/build_files/build_environment/cmake/openmp.cmake b/build_files/build_environment/cmake/openmp.cmake
new file mode 100644 (file)
index 0000000..ba8e624
--- /dev/null
@@ -0,0 +1,32 @@
+# ***** 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 *****
+
+
+ExternalProject_Add(external_openmp
+       URL ${OPENMP_URI}
+       DOWNLOAD_DIR ${DOWNLOAD_DIR}
+       URL_HASH MD5=${OPENMP_HASH}
+       PREFIX ${BUILD_DIR}/openmp
+       CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openmp ${DEFAULT_CMAKE_FLAGS}
+       INSTALL_DIR ${LIBDIR}/clang
+)
+
+add_dependencies(
+       external_openmp
+       external_clang
+)
index 361787fa9567c364b4fa57fe3859b81d6bdaeb5f..fc58a0a8cc8c66a303082c9ba2ce39d9c003f1b0 100644 (file)
@@ -103,12 +103,15 @@ set(OPENCOLLADA_HASH 23db5087faed4bc4cc1dfe456c0d4701)
 set(OPENCOLORIO_URI https://github.com/imageworks/OpenColorIO/archive/6de971097c7f552300f669ed69ca0b6cf5a70843.zip)
 set(OPENCOLORIO_HASH c9de0fd98f26ce6f2e08d617ca68b8e4)
 
-set(LLVM_VERSION 3.4.2)
-set(LLVM_URI http://releases.llvm.org/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.gz)
-set(LLVM_HASH a20669f75967440de949ac3b1bad439c)
+set(LLVM_VERSION 6.0.1)
+set(LLVM_URI http://releases.llvm.org/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz)
+set(LLVM_HASH c88c98709300ce2c285391f387fecce0)
 
-set(CLANG_URI http://releases.llvm.org/${LLVM_VERSION}/cfe-${LLVM_VERSION}.src.tar.gz)
-set(CLANG_HASH 87945973b7c73038871c5f849a818588)
+set(CLANG_URI http://releases.llvm.org/${LLVM_VERSION}/cfe-${LLVM_VERSION}.src.tar.xz)
+set(CLANG_HASH 4e419bd4e3b55aa06d872320f754bd85)
+
+set(OPENMP_URI http://releases.llvm.org/${LLVM_VERSION}/openmp-${LLVM_VERSION}.src.tar.xz)
+set(OPENMP_HASH 4826402ae3633c36c51ba4d0e5527d30)
 
 set(OPENIMAGEIO_VERSION 1.7.15)
 set(OPENIMAGEIO_URI https://github.com/OpenImageIO/oiio/archive/Release-${OPENIMAGEIO_VERSION}.zip)
diff --git a/build_files/build_environment/patches/clang.diff b/build_files/build_environment/patches/clang.diff
deleted file mode 100644 (file)
index 724e92f..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
---- cfe/trunk/lib/Serialization/ASTWriter.cpp
-+++ cfe/trunk/lib/Serialization/ASTWriter.cpp
-@@ -56,14 +56,14 @@
- using namespace clang::serialization;
- template <typename T, typename Allocator>
--static StringRef bytes(const std::vector<T, Allocator> &v) {
-+static StringRef data(const std::vector<T, Allocator> &v) {
-   if (v.empty()) return StringRef();
-   return StringRef(reinterpret_cast<const char*>(&v[0]),
-                          sizeof(T) * v.size());
- }
- template <typename T>
--static StringRef bytes(const SmallVectorImpl<T> &v) {
-+static StringRef data(const SmallVectorImpl<T> &v) {
-   return StringRef(reinterpret_cast<const char*>(v.data()),
-                          sizeof(T) * v.size());
- }
-@@ -1385,7 +1385,7 @@
-   Record.push_back(INPUT_FILE_OFFSETS);
-   Record.push_back(InputFileOffsets.size());
-   Record.push_back(UserFilesNum);
--  Stream.EmitRecordWithBlob(OffsetsAbbrevCode, Record, bytes(InputFileOffsets));
-+  Stream.EmitRecordWithBlob(OffsetsAbbrevCode, Record, data(InputFileOffsets));
- }
- //===----------------------------------------------------------------------===//
-@@ -1771,7 +1771,7 @@
-   Record.push_back(SOURCE_LOCATION_OFFSETS);
-   Record.push_back(SLocEntryOffsets.size());
-   Record.push_back(SourceMgr.getNextLocalOffset() - 1); // skip dummy
--  Stream.EmitRecordWithBlob(SLocOffsetsAbbrev, Record, bytes(SLocEntryOffsets));
-+  Stream.EmitRecordWithBlob(SLocOffsetsAbbrev, Record, data(SLocEntryOffsets));
-   // Write the source location entry preloads array, telling the AST
-   // reader which source locations entries it should load eagerly.
-@@ -2087,7 +2087,7 @@
-   Record.push_back(MacroOffsets.size());
-   Record.push_back(FirstMacroID - NUM_PREDEF_MACRO_IDS);
-   Stream.EmitRecordWithBlob(MacroOffsetAbbrev, Record,
--                            bytes(MacroOffsets));
-+                            data(MacroOffsets));
- }
- void ASTWriter::WritePreprocessorDetail(PreprocessingRecord &PPRec) {
-@@ -2185,7 +2185,7 @@
-     Record.push_back(PPD_ENTITIES_OFFSETS);
-     Record.push_back(FirstPreprocessorEntityID - NUM_PREDEF_PP_ENTITY_IDS);
-     Stream.EmitRecordWithBlob(PPEOffsetAbbrev, Record,
--                              bytes(PreprocessedEntityOffsets));
-+                              data(PreprocessedEntityOffsets));
-   }
- }
-@@ -2548,7 +2548,7 @@
-   Record.push_back(CXX_BASE_SPECIFIER_OFFSETS);
-   Record.push_back(CXXBaseSpecifiersOffsets.size());
-   Stream.EmitRecordWithBlob(BaseSpecifierOffsetAbbrev, Record,
--                            bytes(CXXBaseSpecifiersOffsets));
-+                            data(CXXBaseSpecifiersOffsets));
- }
- //===----------------------------------------------------------------------===//
-@@ -2623,7 +2623,7 @@
-     Decls.push_back(std::make_pair((*D)->getKind(), GetDeclRef(*D)));
-   ++NumLexicalDeclContexts;
--  Stream.EmitRecordWithBlob(DeclContextLexicalAbbrev, Record, bytes(Decls));
-+  Stream.EmitRecordWithBlob(DeclContextLexicalAbbrev, Record, data(Decls));
-   return Offset;
- }
-@@ -2642,7 +2642,7 @@
-   Record.push_back(TYPE_OFFSET);
-   Record.push_back(TypeOffsets.size());
-   Record.push_back(FirstTypeID - NUM_PREDEF_TYPE_IDS);
--  Stream.EmitRecordWithBlob(TypeOffsetAbbrev, Record, bytes(TypeOffsets));
-+  Stream.EmitRecordWithBlob(TypeOffsetAbbrev, Record, data(TypeOffsets));
-   // Write the declaration offsets array
-   Abbrev = new BitCodeAbbrev();
-@@ -2655,7 +2655,7 @@
-   Record.push_back(DECL_OFFSET);
-   Record.push_back(DeclOffsets.size());
-   Record.push_back(FirstDeclID - NUM_PREDEF_DECL_IDS);
--  Stream.EmitRecordWithBlob(DeclOffsetAbbrev, Record, bytes(DeclOffsets));
-+  Stream.EmitRecordWithBlob(DeclOffsetAbbrev, Record, data(DeclOffsets));
- }
- void ASTWriter::WriteFileDeclIDsMap() {
-@@ -2680,7 +2680,7 @@
-   unsigned AbbrevCode = Stream.EmitAbbrev(Abbrev);
-   Record.push_back(FILE_SORTED_DECLS);
-   Record.push_back(FileSortedIDs.size());
--  Stream.EmitRecordWithBlob(AbbrevCode, Record, bytes(FileSortedIDs));
-+  Stream.EmitRecordWithBlob(AbbrevCode, Record, data(FileSortedIDs));
- }
- void ASTWriter::WriteComments() {
-@@ -2893,7 +2893,7 @@
-     Record.push_back(SelectorOffsets.size());
-     Record.push_back(FirstSelectorID - NUM_PREDEF_SELECTOR_IDS);
-     Stream.EmitRecordWithBlob(SelectorOffsetAbbrev, Record,
--                              bytes(SelectorOffsets));
-+                              data(SelectorOffsets));
-   }
- }
-@@ -3253,7 +3253,7 @@
-   Record.push_back(IdentifierOffsets.size());
-   Record.push_back(FirstIdentID - NUM_PREDEF_IDENT_IDS);
-   Stream.EmitRecordWithBlob(IdentifierOffsetAbbrev, Record,
--                            bytes(IdentifierOffsets));
-+                            data(IdentifierOffsets));
- }
- //===----------------------------------------------------------------------===//
-@@ -4046,7 +4046,7 @@
-   Record.clear();
-   Record.push_back(TU_UPDATE_LEXICAL);
-   Stream.EmitRecordWithBlob(TuUpdateLexicalAbbrev, Record,
--                            bytes(NewGlobalDecls));
-+                            data(NewGlobalDecls));
-   
-   // And a visible updates block for the translation unit.
-   Abv = new llvm::BitCodeAbbrev();
diff --git a/build_files/build_environment/patches/llvm-alloca-fix.diff b/build_files/build_environment/patches/llvm-alloca-fix.diff
deleted file mode 100644 (file)
index 5394a47..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-Index: lib/Target/X86/X86ISelLowering.cpp
-===================================================================
---- lib/Target/X86/X86ISelLowering.cpp 2014-04-11 23:04:44.000000000 +0200
-+++ lib/Target/X86/X86ISelLowering.cpp (working copy)
-@@ -15493,12 +15493,36 @@
-   // non-trivial part is impdef of ESP.
-   if (Subtarget->isTargetWin64()) {
-+    const char *StackProbeSymbol = 
-+      Subtarget->isTargetCygMing() ? "___chkstk" : "__chkstk";
-+      
-+    MachineInstrBuilder MIB;
-+    
-+    if (getTargetMachine().getCodeModel() == CodeModel::Large) {
-+      // For large code model we need to do indirect call to __chkstk.
-+    
-+      // R11 will be used to contain the address of __chkstk.
-+      // R11 is a volotiale register and assumed to be destoyed by the callee, 
-+      // so there is no need to save and restore it.
-+      BuildMI(*BB, MI, DL, TII->get(X86::MOV64ri), X86::R11)
-+        .addExternalSymbol(StackProbeSymbol);
-+      // Create a call to __chkstk function which address contained in R11.
-+      MIB = BuildMI(*BB, MI, DL, TII->get(X86::CALL64r))
-+                    .addReg(X86::R11, RegState::Kill);
-+                  
-+    } else {
-+      
-+      // For non-large code model we can do direct call to __chkstk.
-+      
-+      MIB = BuildMI(*BB, MI, DL, TII->get(X86::W64ALLOCA))
-+              .addExternalSymbol(StackProbeSymbol);
-+    }
-+  
-     if (Subtarget->isTargetCygMing()) {
-       // ___chkstk(Mingw64):
-       // Clobbers R10, R11, RAX and EFLAGS.
-       // Updates RSP.
--      BuildMI(*BB, MI, DL, TII->get(X86::W64ALLOCA))
--        .addExternalSymbol("___chkstk")
-+      MIB
-         .addReg(X86::RAX, RegState::Implicit)
-         .addReg(X86::RSP, RegState::Implicit)
-         .addReg(X86::RAX, RegState::Define | RegState::Implicit)
-@@ -15507,8 +15531,7 @@
-     } else {
-       // __chkstk(MSVCRT): does not update stack pointer.
-       // Clobbers R10, R11 and EFLAGS.
--      BuildMI(*BB, MI, DL, TII->get(X86::W64ALLOCA))
--        .addExternalSymbol("__chkstk")
-+      MIB
-         .addReg(X86::RAX, RegState::Implicit)
-         .addReg(X86::EFLAGS, RegState::Define | RegState::Implicit);
-       // RAX has the offset to be subtracted from RSP.
-Index: lib/Target/X86/X86FrameLowering.cpp
-===================================================================
---- lib/Target/X86/X86FrameLowering.cpp        2013-10-24 01:37:01.000000000 +0200
-+++ lib/Target/X86/X86FrameLowering.cpp (working copy)
-@@ -635,25 +635,49 @@
-         .addReg(X86::EAX, RegState::Kill)
-         .setMIFlag(MachineInstr::FrameSetup);
-     }
-+    
-+    MachineInstrBuilder MIB;
-     if (Is64Bit) {
-+           
-       // Handle the 64-bit Windows ABI case where we need to call __chkstk.
-       // Function prologue is responsible for adjusting the stack pointer.
-       BuildMI(MBB, MBBI, DL, TII.get(X86::MOV64ri), X86::RAX)
-         .addImm(NumBytes)
-         .setMIFlag(MachineInstr::FrameSetup);
-+        
-+      if (TM.getCodeModel() == CodeModel::Large) {
-+        // For large code model we need to do indirect call to __chkstk.
-+      
-+          
-+        // R11 will be used to contain the address of __chkstk.
-+        // R11 is a volotiale register and assumed to be destoyed by the callee, 
-+        // so there is no need to save and restore it.
-+        BuildMI(MBB, MBBI, DL, TII.get(X86::MOV64ri), X86::R11)
-+          .addExternalSymbol(StackProbeSymbol);
-+        // Create a call to __chkstk function which address contained in R11.
-+        MIB = BuildMI(MBB, MBBI, DL, TII.get(X86::CALL64r))
-+                .addReg(X86::R11, RegState::Kill);
-+      } else {
-+      
-+        // For non-large code model we can do direct call to __chkstk.
-+              
-+        MIB = BuildMI(MBB, MBBI, DL, TII.get(X86::W64ALLOCA))
-+                .addExternalSymbol(StackProbeSymbol);
-+      }
-     } else {
-       // Allocate NumBytes-4 bytes on stack in case of isEAXAlive.
-       // We'll also use 4 already allocated bytes for EAX.
-       BuildMI(MBB, MBBI, DL, TII.get(X86::MOV32ri), X86::EAX)
-         .addImm(isEAXAlive ? NumBytes - 4 : NumBytes)
-         .setMIFlag(MachineInstr::FrameSetup);
-+        
-+      MIB = BuildMI(MBB, MBBI, DL, TII.get(X86::CALLpcrel32))
-+              .addExternalSymbol(StackProbeSymbol);
-     }
--    BuildMI(MBB, MBBI, DL,
--            TII.get(Is64Bit ? X86::W64ALLOCA : X86::CALLpcrel32))
--      .addExternalSymbol(StackProbeSymbol)
--      .addReg(StackPtr,    RegState::Define | RegState::Implicit)
-+    
-+    MIB.addReg(StackPtr,    RegState::Define | RegState::Implicit)
-       .addReg(X86::EFLAGS, RegState::Define | RegState::Implicit)
-       .setMIFlag(MachineInstr::FrameSetup);
-  
index 9ae033c49c1b16718eac6306bdc271a5e6e6bf38..6c3a46dc113de870a03191e4c0685238b0823acd 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 9ae033c49c1b16718eac6306bdc271a5e6e6bf38
+Subproject commit 6c3a46dc113de870a03191e4c0685238b0823acd
index f178e6c933a25c621a5cc7d92935b66cd2ec2f5d..15b25a42783d1e516b5298d70b582fae2559ae17 160000 (submodule)
@@ -1 +1 @@
-Subproject commit f178e6c933a25c621a5cc7d92935b66cd2ec2f5d
+Subproject commit 15b25a42783d1e516b5298d70b582fae2559ae17
index 87f7038ee8c4b46a5e73a1a9065e2a9b7367f594..11656ebaf7f912cdb1b5eb39c5d0a3b5d492c1aa 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 87f7038ee8c4b46a5e73a1a9065e2a9b7367f594
+Subproject commit 11656ebaf7f912cdb1b5eb39c5d0a3b5d492c1aa