Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -534,7 +534,7 @@ endif() option(LLVM_LINK_LLVM_DYLIB "Link tools against the libllvm dynamic library" OFF) if(MSVC) - option(LLVM_BUILD_LLVM_C_DYLIB "Build LLVM-C.dll (Windows only)" OFF) + option(LLVM_BUILD_LLVM_C_DYLIB "Build LLVM-C.dll (Windows only)" ON) else() option(LLVM_BUILD_LLVM_C_DYLIB "Build libllvm-c re-export library (Darwin only)" OFF) endif() Index: tools/llvm-shlib/CMakeLists.txt =================================================================== --- tools/llvm-shlib/CMakeLists.txt +++ tools/llvm-shlib/CMakeLists.txt @@ -132,10 +132,35 @@ set(GEN_UNDERSCORE "") endif() - # Get the full name to the libs so the python script understands them. - foreach(lib ${LIB_NAMES}) - list(APPEND FULL_LIB_NAMES ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib/${lib}.lib) - endforeach() + # Set this name here and touch up if needed. + set(LIBSFILE ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/libllvm-c.args) + + if(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".") + foreach(BUILD_MODE ${CMAKE_CONFIGURATION_TYPES}) + set(FULL_LIB_NAMES "") + # Get the full name to the libs so the python script understands them. + foreach(lib ${LIB_NAMES}) + list(APPEND FULL_LIB_NAMES ${CMAKE_BINARY_DIR}/${BUILD_MODE}/lib/${lib}.lib) + endforeach() + + # Need to seperate lib names with newlines. + string(REPLACE ";" "\n" FILE_CONTENT "${FULL_LIB_NAMES}") + + # Write out the full lib names into file to be read by the python script. + file(WRITE ${LIBSFILE} "${FILE_CONTENT}") + endforeach() + else() + # Get the full name to the libs so the python script understands them. + foreach(lib ${LIB_NAMES}) + list(APPEND FULL_LIB_NAMES ${CMAKE_BINARY_DIR}/lib/${lib}.lib) + endforeach() + + # Need to seperate lib names with newlines. + string(REPLACE ";" "\n" FILE_CONTENT "${FULL_LIB_NAMES}") + + # Write out the full lib names into file to be read by the python script. + file(WRITE ${LIBSFILE} "${FILE_CONTENT}") + endif() # Generate the exports file dynamically. set(GEN_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/gen-msvc-exports.py) @@ -143,7 +168,7 @@ set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/libllvm-c.exports) add_custom_command(OUTPUT ${LLVM_EXPORTED_SYMBOL_FILE} - COMMAND ${PYTHON_EXECUTABLE} ${GEN_SCRIPT} ${FULL_LIB_NAMES} ${GEN_UNDERSCORE} --nm ${LLVM_TOOLS_BINARY_DIR}/llvm-nm -o ${LLVM_EXPORTED_SYMBOL_FILE} + COMMAND ${PYTHON_EXECUTABLE} ${GEN_SCRIPT} --libsfile ${LIBSFILE} ${GEN_UNDERSCORE} --nm ${LLVM_TOOLS_BINARY_DIR}/llvm-nm -o ${LLVM_EXPORTED_SYMBOL_FILE} DEPENDS ${LIB_NAMES} llvm-nm COMMENT "Generating export list for LLVM-C" VERBATIM ) Index: tools/llvm-shlib/gen-msvc-exports.py =================================================================== --- tools/llvm-shlib/gen-msvc-exports.py +++ tools/llvm-shlib/gen-msvc-exports.py @@ -82,6 +82,10 @@ def main(): parser = argparse.ArgumentParser('gen-msvc-exports') + parser.add_argument( + '-i', '--libsfile', help='file with list of libs, new line separated', + action='store', default=None + ) parser.add_argument( '-o', '--output', help='output filename', default='LLVM-C.exports' ) @@ -93,12 +97,19 @@ '--nm', help='path to the llvm-nm executable', default='llvm-nm' ) parser.add_argument( - 'libs', metavar='LIBS', nargs='+', help='list of libraries to generate export from' + 'libs', metavar='LIBS', nargs='*', help='list of libraries to generate export from' ) ns = parser.parse_args() - gen_llvm_c_export(ns.output, ns.underscore, ns.libs, ns.nm) + libs = ns.libs + + # Add if we where given a libsfile add it to the libs. + if ns.libsfile: + with open(ns.libsfile) as f: + libs.extend(f.read().splitlines()) + + gen_llvm_c_export(ns.output, ns.underscore, libs, ns.nm) if __name__ == '__main__': Index: utils/release/build_llvm_package.bat =================================================================== --- utils/release/build_llvm_package.bat +++ utils/release/build_llvm_package.bat @@ -52,7 +52,17 @@ REM Setting CMAKE_CL_SHOWINCLUDES_PREFIX to work around PR27226. -set cmake_flags=-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON -DCMAKE_INSTALL_UCRT_LIBRARIES=ON -DCLANG_FORMAT_VS_VERSION=%clang_format_vs_version% -DPACKAGE_VERSION=%package_version% -DLLDB_RELOCATABLE_PYTHON=1 -DLLDB_TEST_COMPILER=%cd%\build32_stage0\bin\clang.exe -DCMAKE_CL_SHOWINCLUDES_PREFIX="Note: including file: " +set cmake_flags=^ + -DCMAKE_BUILD_TYPE=Release ^ + -DLLVM_ENABLE_ASSERTIONS=ON ^ + -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON ^ + -DLLVM_BUILD_LLVM_C_DYLIB=ON ^ + -DCMAKE_INSTALL_UCRT_LIBRARIES=ON ^ + -DCLANG_FORMAT_VS_VERSION=%clang_format_vs_version% ^ + -DPACKAGE_VERSION=%package_version% ^ + -DLLDB_RELOCATABLE_PYTHON=1 ^ + -DLLDB_TEST_COMPILER=%cd%\build32_stage0\bin\clang.exe ^ + -DCMAKE_CL_SHOWINCLUDES_PREFIX="Note: including file: " REM TODO: Run the "check-all" tests.