Skip to content

Commit

Permalink
Enforce LLVM 3.5+'s need for C++11 with helpful build errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
lgritz committed Jun 25, 2015
1 parent 180629c commit 2df0755
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/cmake/externalpackages.cmake
Expand Up @@ -192,6 +192,10 @@ if(NOT LLVM_DIRECTORY OR EXISTS ${LLVM_CONFIG})
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()

if (LLVM_VERSION VERSION_GREATER 3.4.9 AND NOT OSL_BUILD_CPP11)
message (FATAL_ERROR "LLVM ${LLVM_VERSION} requires C++11. You must build with USE_CPP11=1.")
endif ()

find_library ( LLVM_LIBRARY
NAMES LLVM-${LLVM_VERSION}
PATHS ${LLVM_LIB_DIR})
Expand Down Expand Up @@ -235,7 +239,6 @@ if ((LLVM_LIBRARY OR LLVM_STATIC) AND LLVM_INCLUDES AND LLVM_DIRECTORY AND LLVM_
message (STATUS "LLVM library = ${LLVM_LIBRARY}")
endif ()


if (NOT LLVM_LIBRARY)
message (FATAL_ERROR "LLVM library not found.")
endif()
Expand Down
4 changes: 4 additions & 0 deletions src/liboslexec/llvm_util.cpp
Expand Up @@ -32,6 +32,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "OSL/oslconfig.h"
#include "OSL/llvm_util.h"

#if OSL_LLVM_VERSION >= 35 && ! OSL_BUILD_CPP11
#error "LLVM >= 3.5 requires USE_CPP11=1"
#endif

#ifndef USE_MCJIT
// MCJIT first appeared with LLVM 3.3
# define USE_MCJIT (OSL_LLVM_VERSION>=33)
Expand Down

0 comments on commit 2df0755

Please sign in to comment.