[Bf-cycles] LLVM static libs

Brecht Van Lommel brechtvanlommel at pandora.be
Sun Apr 14 21:56:42 CEST 2013


That's seems reasonable, I've attached a patch which tries to
implement it. Could you test if it works on your system?

Also, just adding the llvm-static package may not be the solution, OSL
needs to be linked with the same static/dynamic library. I'm not sure
how that would be ensured at the level of linux distribution packages.

Brecht.

On Sun, Apr 14, 2013 at 7:25 AM, Dan Eicher <dan at trollwerks.org> wrote:
> Hi all,
>
> I noticed after upgrading to llvm-3.2 on my opensuse build service magic
> machine that cmake is looking libLLVMAnalysis.a to check if llvm is
> installed which now comes in llvm-static on Fedora 18.
>
> Simple (but incorrect) fix is to just add llvm-static as a build dep and
> call it a day, easy-peasy.
>
> A better fix would be to check for a dynamic lib (libLLVM) and if that's not
> found and LLVM_STATIC isn't set to error out.
>
> Dan
>
> _______________________________________________
> Bf-cycles mailing list
> Bf-cycles at blender.org
> http://lists.blender.org/mailman/listinfo/bf-cycles
>
-------------- next part --------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 80008e2..bdfbb1e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -776,9 +776,23 @@ if(UNIX AND NOT APPLE)
 		execute_process(COMMAND ${LLVM_CONFIG} --libdir
 		                OUTPUT_VARIABLE LLVM_LIB_DIR
 		                OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+		# first try to find static library
 		find_library(LLVM_LIBRARY
 		             NAMES LLVMAnalysis # first of a whole bunch of libs to get
 		             PATHS ${LLVM_LIB_DIR})
+
+		if(NOT LLVM_LIBRARY)
+			# static library not found, try dynamic
+			find_library(LLVM_LIBRARY
+						 NAMES LLVM-${LLVM_VERSION}
+						 PATHS ${LLVM_LIB_DIR})
+
+			if(LLVM_LIBRARY)
+				set(LLVM_STATIC NO)
+			endif()
+		endif()
+
 		message(STATUS "LLVM version  = ${LLVM_VERSION}")
 		message(STATUS "LLVM dir      = ${LLVM_DIRECTORY}")
 		message(STATUS "LLVM lib dir  = ${LLVM_LIB_DIR}")


More information about the Bf-cycles mailing list