Windows上编译OpenShadingLanguage

杨彦君
2023-12-01

将OSL 1.3.0解压到[工作目录]/osl/OpenShadingLanguage

对Debug使用如下bat生成项目文件:

@Echo off

cd OpenShadingLanguage

set LIBDIR=%CD%\..\..

:: create build directory
mkdir build\windows_debug
cd build\windows_debug

cmake -G "Visual Studio 9 2008" ..\..\src ^
-DCMAKE_INSTALL_PREFIX=%LIBDIR%\osl\debug ^
-DCMAKE_CXX_FLAGS_DEBUG="/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1" ^
-DCMAKE_CXX_FLAGS_MINSIZEREL="/MT /O1 /Ob1 /D NDEBUG" ^
-DCMAKE_CXX_FLAGS_RELEASE="/MT /O2 /Ob2 /D NDEBUG" ^
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="/MT /Zi /O2 /Ob1 /D NDEBUG" ^
-DCMAKE_CXX_STANDARD_LIBRARIES:STRING="kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib psapi.lib" ^
-DBUILDSTATIC=ON ^
-DILMBASE_HOME=%LIBDIR%\openexr ^
-DOPENIMAGEIOHOME=%LIBDIR%\openimageio ^
-DOPENIMAGEIO_LIBRARY=%LIBDIR%/openimageio/lib/OpenImageIO_d.lib;%LIBDIR%/png/lib/libpng_d.lib;%LIBDIR%/jpeg/lib/libjpeg_d.lib;%LIBDIR%/tiff/lib/libtiff_d.lib;%LIBDIR%/openexr/lib/Half_d.lib;%LIBDIR%/openexr/lib/Imath_d.lib;%LIBDIR%/openexr/lib/IlmImf_d.lib;%LIBDIR%/openexr/lib/Iex_d.lib;%LIBDIR%/openexr/lib/IlmThread_d.lib ^
-DBOOST_ROOT=%LIBDIR%\boost ^
-DBoost_USE_STATIC_LIBS=ON ^
-DBoost_USE_STATIC_RUNTIME=ON ^
-DZLIB_INCLUDE_DIR=%LIBDIR%\zlib\include ^
-DZLIB_LIBRARY=%LIBDIR%\zlib\lib\libz_d.lib ^
-DUSE_TBB=OFF ^
-DFLEX_EXECUTABLE=%LIBDIR%\osl\flex_bison\bin\win_flex.exe ^
-DBISON_EXECUTABLE=%LIBDIR%\osl\flex_bison\bin\win_bison.exe ^
-DLLVM_DIRECTORY=%LIBDIR%\llvm\debug ^
-DLLVM_INCLUDES=%LIBDIR%\llvm\debug\include ^
-DLLVM_LIB_DIR=%LIBDIR%\llvm\debug\lib ^
-DLLVM_VERSION=3.2 ^
-DLLVM_LIBRARY=%LIBDIR%\llvm\debug\lib\LLVMAnalysis.lib;%LIBDIR%\llvm\debug\lib\LLVMArchive.lib;%LIBDIR%\llvm\debug\lib\LLVMAsmParser.lib;%LIBDIR%\llvm\debug\lib\LLVMAsmPrinter.lib;%LIBDIR%\llvm\debug\lib\LLVMBitReader.lib;%LIBDIR%\llvm\debug\lib\LLVMBitWriter.lib;%LIBDIR%\llvm\debug\lib\LLVMCodeGen.lib;%LIBDIR%\llvm\debug\lib\LLVMCore.lib;%LIBDIR%\llvm\debug\lib\LLVMDebugInfo.lib;%LIBDIR%\llvm\debug\lib\LLVMExecutionEngine.lib;%LIBDIR%\llvm\debug\lib\LLVMInstCombine.lib;%LIBDIR%\llvm\debug\lib\LLVMInstrumentation.lib;%LIBDIR%\llvm\debug\lib\LLVMInterpreter.lib;%LIBDIR%\llvm\debug\lib\LLVMJIT.lib;%LIBDIR%\llvm\debug\lib\LLVMLinker.lib;%LIBDIR%\llvm\debug\lib\LLVMMC.lib;%LIBDIR%\llvm\debug\lib\LLVMMCDisassembler.lib;%LIBDIR%\llvm\debug\lib\LLVMMCJIT.lib;%LIBDIR%\llvm\debug\lib\LLVMMCParser.lib;%LIBDIR%\llvm\debug\lib\LLVMObject.lib;%LIBDIR%\llvm\debug\lib\LLVMRuntimeDyld.lib;%LIBDIR%\llvm\debug\lib\LLVMScalarOpts.lib;%LIBDIR%\llvm\debug\lib\LLVMSelectionDAG.lib;%LIBDIR%\llvm\debug\lib\LLVMSupport.lib;%LIBDIR%\llvm\debug\lib\LLVMTableGen.lib;%LIBDIR%\llvm\debug\lib\LLVMTarget.lib;%LIBDIR%\llvm\debug\lib\LLVMTransformUtils.lib;%LIBDIR%\llvm\debug\lib\LLVMVectorize.lib;%LIBDIR%\llvm\debug\lib\LLVMX86AsmParser.lib;%LIBDIR%\llvm\debug\lib\LLVMX86AsmPrinter.lib;%LIBDIR%\llvm\debug\lib\LLVMX86CodeGen.lib;%LIBDIR%\llvm\debug\lib\LLVMX86Desc.lib;%LIBDIR%\llvm\debug\lib\LLVMX86Disassembler.lib;%LIBDIR%\llvm\debug\lib\LLVMX86Info.lib;%LIBDIR%\llvm\debug\lib\LLVMX86Utils.lib;%LIBDIR%\llvm\debug\lib\LLVMipa.lib;%LIBDIR%\llvm\debug\lib\LLVMipo.lib

cd ..\..\..

对Release使用:

@Echo off

cd OpenShadingLanguage

set LIBDIR=%CD%\..\..

:: create build directory
mkdir build\windows
cd build\windows

cmake -G "Visual Studio 9 2008" ..\..\src ^
-DCMAKE_INSTALL_PREFIX=%LIBDIR%\osl\release ^
-DCMAKE_CXX_FLAGS_DEBUG="/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1" ^
-DCMAKE_CXX_FLAGS_MINSIZEREL="/MT /O1 /Ob1 /D NDEBUG" ^
-DCMAKE_CXX_FLAGS_RELEASE="/MT /O2 /Ob2 /D NDEBUG" ^
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="/MT /Zi /O2 /Ob1 /D NDEBUG" ^
-DCMAKE_CXX_STANDARD_LIBRARIES:STRING="kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib psapi.lib" ^
-DBUILDSTATIC=ON ^
-DILMBASE_HOME=%LIBDIR%\openexr ^
-DOPENIMAGEIOHOME=%LIBDIR%\openimageio ^
-DOPENIMAGEIO_LIBRARY=%LIBDIR%/openimageio/lib/OpenImageIO.lib;%LIBDIR%/png/lib/libpng.lib;%LIBDIR%/jpeg/lib/libjpeg.lib;%LIBDIR%/tiff/lib/libtiff.lib;%LIBDIR%/openexr/lib/Half.lib;%LIBDIR%/openexr/lib/Imath.lib;%LIBDIR%/openexr/lib/IlmImf.lib;%LIBDIR%/openexr/lib/Iex.lib;%LIBDIR%/openexr/lib/IlmThread.lib ^
-DBOOST_ROOT=%LIBDIR%\boost ^
-DBoost_USE_STATIC_LIBS=ON ^
-DBoost_USE_STATIC_RUNTIME=ON ^
-DZLIB_INCLUDE_DIR=%LIBDIR%\zlib\include ^
-DZLIB_LIBRARY=%LIBDIR%\zlib\lib\libz.lib ^
-DUSE_TBB=OFF ^
-DFLEX_EXECUTABLE=%LIBDIR%\osl\flex_bison\bin\win_flex.exe ^
-DBISON_EXECUTABLE=%LIBDIR%\osl\flex_bison\bin\win_bison.exe ^
-DLLVM_DIRECTORY=%LIBDIR%\llvm ^
-DLLVM_INCLUDES=%LIBDIR%\llvm\include ^
-DLLVM_LIB_DIR=%LIBDIR%\llvm\lib ^
-DLLVM_VERSION=3.2 ^
-DLLVM_LIBRARY=%LIBDIR%\llvm\lib\LLVMAnalysis.lib;%LIBDIR%\llvm\lib\LLVMArchive.lib;%LIBDIR%\llvm\lib\LLVMAsmParser.lib;%LIBDIR%\llvm\lib\LLVMAsmPrinter.lib;%LIBDIR%\llvm\lib\LLVMBitReader.lib;%LIBDIR%\llvm\lib\LLVMBitWriter.lib;%LIBDIR%\llvm\lib\LLVMCodeGen.lib;%LIBDIR%\llvm\lib\LLVMCore.lib;%LIBDIR%\llvm\lib\LLVMDebugInfo.lib;%LIBDIR%\llvm\lib\LLVMExecutionEngine.lib;%LIBDIR%\llvm\lib\LLVMInstCombine.lib;%LIBDIR%\llvm\lib\LLVMInstrumentation.lib;%LIBDIR%\llvm\lib\LLVMInterpreter.lib;%LIBDIR%\llvm\lib\LLVMJIT.lib;%LIBDIR%\llvm\lib\LLVMLinker.lib;%LIBDIR%\llvm\lib\LLVMMC.lib;%LIBDIR%\llvm\lib\LLVMMCDisassembler.lib;%LIBDIR%\llvm\lib\LLVMMCJIT.lib;%LIBDIR%\llvm\lib\LLVMMCParser.lib;%LIBDIR%\llvm\lib\LLVMObject.lib;%LIBDIR%\llvm\lib\LLVMRuntimeDyld.lib;%LIBDIR%\llvm\lib\LLVMScalarOpts.lib;%LIBDIR%\llvm\lib\LLVMSelectionDAG.lib;%LIBDIR%\llvm\lib\LLVMSupport.lib;%LIBDIR%\llvm\lib\LLVMTableGen.lib;%LIBDIR%\llvm\lib\LLVMTarget.lib;%LIBDIR%\llvm\lib\LLVMTransformUtils.lib;%LIBDIR%\llvm\lib\LLVMVectorize.lib;%LIBDIR%\llvm\lib\LLVMX86AsmParser.lib;%LIBDIR%\llvm\lib\LLVMX86AsmPrinter.lib;%LIBDIR%\llvm\lib\LLVMX86CodeGen.lib;%LIBDIR%\llvm\lib\LLVMX86Desc.lib;%LIBDIR%\llvm\lib\LLVMX86Disassembler.lib;%LIBDIR%\llvm\lib\LLVMX86Info.lib;%LIBDIR%\llvm\lib\LLVMX86Utils.lib;%LIBDIR%\llvm\lib\LLVMipa.lib;%LIBDIR%\llvm\lib\LLVMipo.lib

cd ..\..\..

然后打开对应的项目文件,编译。

 

 

 

posted on 2013-07-20 00:06 Len3d 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/len3d/p/3201882.html

 类似资料: