imageworks/OpenShadingLanguage — pull request #206 by lgritz (2012-12-25 18:00:14+00:00)
Title: Brecht's build static option -- with LG's fixes

Brecht Van Lommel submitted pull request #200 which added a BUILDSTATIC option to the CMake scripts to build static libraries.

Upon testing it, I found that it didn't fully work, due to the static linkage omitting object modules that weren't directly referenced, but which had symbols that would be looked up dynamically in the course of LLVM JIT (six .o files consisted exclusively of functions called from compiled shaders).

This patch merely replicates Brecht's work, but adds two things from LG:

1. Add 'make BUILDSTATIC=1' for those who prefer working from the Makefile wrapper rather than CMake directly.

2. Force dummy symbols from the opFOO.cpp files (just one int per file) to be referenced from llvm_instance.cpp, which causes everything to get linked properly when using static linkage. All tests pass now with static linkage.