def _build_win32(working_directory_path, root_project_path): source_folder_path = _download_and_extract(working_directory_path) _patch_sources(source_folder_path, working_directory_path) # x86 x86_env = build_utils.get_win32_vs_x86_env() build_utils.run_process([ 'nmake', '-f', 'Makefile.vc', 'CFG=release-static', 'RTLIBCFG=dynamic', 'OBJDIR=output' ], process_cwd=source_folder_path, environment=x86_env, shell=True) build_utils.run_process([ 'nmake', '-f', 'Makefile.vc', 'CFG=debug-static', 'RTLIBCFG=dynamic', 'OBJDIR=output' ], process_cwd=source_folder_path, environment=x86_env, shell=True) # x64 x64_env = build_utils.get_win32_vs_x64_env() build_utils.run_process([ 'nmake', '-f', 'Makefile.vc', 'CFG=release-static', 'RTLIBCFG=dynamic', 'OBJDIR=output' ], process_cwd=source_folder_path, environment=x64_env, shell=True) build_utils.run_process([ 'nmake', '-f', 'Makefile.vc', 'CFG=debug-static', 'RTLIBCFG=dynamic', 'OBJDIR=output' ], process_cwd=source_folder_path, environment=x64_env, shell=True) libs_win_root = os.path.join(root_project_path, 'Libs/lib_CMake/win') shutil.copyfile( os.path.join(source_folder_path, 'output/debug-static/x86/lib/libwebp_debug.lib'), os.path.join(libs_win_root, 'x86/Debug/libwebp.lib')) shutil.copyfile( os.path.join(source_folder_path, 'output/release-static/x86/lib/libwebp.lib'), os.path.join(libs_win_root, 'x86/Release/libwebp.lib')) shutil.copyfile( os.path.join(source_folder_path, 'output/debug-static/x64/lib/libwebp_debug.lib'), os.path.join(libs_win_root, 'x64/Debug/libwebp.lib')) shutil.copyfile( os.path.join(source_folder_path, 'output/release-static/x64/lib/libwebp.lib'), os.path.join(libs_win_root, 'x64/Release/libwebp.lib')) _copy_headers(source_folder_path, root_project_path)
def _patch_sources(source_folder_path, working_directory_path, patch_file_path): try: if source_folder_path in _patch_sources.cache: return except AttributeError: _patch_sources.cache = [] pass shutil.copyfile('WIN32.MAK', os.path.join(source_folder_path, 'WIN32.MAK')) build_utils.run_process(['nmake', '/f', 'makefile.vc', 'setup-v10'], process_cwd=source_folder_path, shell=True, environment=build_utils.get_win32_vs_x86_env()) build_utils.apply_patch(os.path.abspath(patch_file_path), working_directory_path) _patch_sources.cache.append(source_folder_path)
def _build_win32(working_directory_path, root_project_path): libraries_win_root = os.path.join(root_project_path, 'Libs/lib_CMake/win') # x86 source_folder_path_x86 = _download_and_extract(working_directory_path, 'win32_x86') shutil.copyfile('build-msvc.cmd', os.path.join(source_folder_path_x86, 'build-msvc.cmd')) build_utils.run_process('build-msvc.cmd', process_cwd=source_folder_path_x86, shell=True, environment=build_utils.get_win32_vs_x86_env()) libeay_path_x86_debug = os.path.join(source_folder_path_x86, 'out32.dbg/libeay32.lib') ssleay_path_x86_debug = os.path.join(source_folder_path_x86, 'out32.dbg/ssleay32.lib') libeay_path_x86_release = os.path.join(source_folder_path_x86, 'out32/libeay32.lib') ssleay_path_x86_release = os.path.join(source_folder_path_x86, 'out32/ssleay32.lib') shutil.copyfile(libeay_path_x86_debug, os.path.join(libraries_win_root, 'x86/Debug/libeay32.lib')) shutil.copyfile(ssleay_path_x86_debug, os.path.join(libraries_win_root, 'x86/Debug/ssleay32.lib')) shutil.copyfile( libeay_path_x86_release, os.path.join(libraries_win_root, 'x86/Release/libeay32.lib')) shutil.copyfile( ssleay_path_x86_release, os.path.join(libraries_win_root, 'x86/Release/ssleay32.lib')) #x64 source_folder_path_x64 = _download_and_extract(working_directory_path, 'win32_x64') shutil.copyfile('build-msvc.cmd', os.path.join(source_folder_path_x64, 'build-msvc.cmd')) build_utils.run_process(['build-msvc.cmd', 'x64'], process_cwd=source_folder_path_x64, shell=True, environment=build_utils.get_win32_vs_x64_env()) libeay_path_x64_debug = os.path.join(source_folder_path_x64, 'out32.dbg/libeay32.lib') ssleay_path_x64_debug = os.path.join(source_folder_path_x64, 'out32.dbg/ssleay32.lib') libeay_path_x64_release = os.path.join(source_folder_path_x64, 'out32/libeay32.lib') ssleay_path_x64_release = os.path.join(source_folder_path_x64, 'out32/ssleay32.lib') shutil.copyfile(libeay_path_x64_debug, os.path.join(libraries_win_root, 'x64/Debug/libeay32.lib')) shutil.copyfile(ssleay_path_x64_debug, os.path.join(libraries_win_root, 'x64/Debug/ssleay32.lib')) shutil.copyfile( libeay_path_x64_release, os.path.join(libraries_win_root, 'x64/Release/libeay32.lib')) shutil.copyfile( ssleay_path_x64_release, os.path.join(libraries_win_root, 'x64/Release/ssleay32.lib')) # headers headers_x86_src = os.path.join(source_folder_path_x86, 'inc32/openssl') headers_x64_src = os.path.join(source_folder_path_x64, 'inc32/openssl') headers_x86_dst = _headers_include_path(root_project_path, 'win32/x86') headers_x64_dst = _headers_include_path(root_project_path, 'win32/x64') build_utils.copy_folder_recursive(headers_x86_src, headers_x86_dst) build_utils.copy_folder_recursive(headers_x64_src, headers_x64_dst)
def _build_win32(working_directory_path, root_project_path): source_folder_path = _download_and_extract(working_directory_path) _patch_sources_windows(source_folder_path, working_directory_path) """ Build instructions for libxml2 v2.7.8 """ libraries_win_root = os.path.join(root_project_path, 'Libs/lib_CMake/win') makefile_path = os.path.join(source_folder_path, 'win32') cscript_debug = [ 'cscript', 'configure.js', 'compiler=msvc', 'static=yes', 'iconv=no', 'ftp=no', 'http=no', 'cruntime=/MDd', 'debug=yes' ] cscript_release = [ 'cscript', 'configure.js', 'compiler=msvc', 'static=yes', 'iconv=no', 'ftp=no', 'http=no', 'cruntime=/MD', 'debug=no' ] nmake_clean = ['nmake', 'clean'] # Generate makefile for debug build build_utils.run_process(cscript_debug, process_cwd=makefile_path, shell=True, environment=None) # Build and copy x86 debug static lib build_utils.run_process(['nmake', '/f', 'Makefile', 'libxmla'], process_cwd=makefile_path, shell=True, environment=build_utils.get_win32_vs_x86_env()) shutil.copyfile(os.path.join(makefile_path, 'bin.msvc/libxml2_a.lib'), os.path.join(libraries_win_root, 'x86/Debug/libxml2.lib')) build_utils.run_process(nmake_clean, process_cwd=makefile_path, shell=True, environment=build_utils.get_win32_vs_x86_env()) # Build and copy x64 debug static lib build_utils.run_process(['nmake', '/f', 'Makefile', 'libxmla'], process_cwd=makefile_path, shell=True, environment=build_utils.get_win32_vs_x64_env()) shutil.copyfile(os.path.join(makefile_path, 'bin.msvc/libxml2_a.lib'), os.path.join(libraries_win_root, 'x64/Debug/libxml2.lib')) build_utils.run_process(nmake_clean, process_cwd=makefile_path, shell=True, environment=build_utils.get_win32_vs_x64_env()) # Generate makefile for release build build_utils.run_process(cscript_release, process_cwd=makefile_path, shell=True, environment=None) # Build and copy x86 release static lib build_utils.run_process(['nmake', '/f', 'Makefile', 'libxmla'], process_cwd=makefile_path, shell=True, environment=build_utils.get_win32_vs_x86_env()) shutil.copyfile( os.path.join(makefile_path, 'bin.msvc/libxml2_a.lib'), os.path.join(libraries_win_root, 'x86/Release/libxml2.lib')) build_utils.run_process(nmake_clean, process_cwd=makefile_path, shell=True, environment=build_utils.get_win32_vs_x86_env()) # Build and copy x64 release static lib build_utils.run_process(['nmake', '/f', 'Makefile', 'libxmla'], process_cwd=makefile_path, shell=True, environment=build_utils.get_win32_vs_x64_env()) shutil.copyfile( os.path.join(makefile_path, 'bin.msvc/libxml2_a.lib'), os.path.join(libraries_win_root, 'x64/Release/libxml2.lib')) build_utils.run_process(nmake_clean, process_cwd=makefile_path, shell=True, environment=build_utils.get_win32_vs_x64_env()) """ Build instructions for libxml2 v2.9.0 and later sln_path = os.path.join(source_folder_path, 'win32/VC10/libxml2.sln') build_utils.build_vs(sln_path, 'Debug', 'Win32', target='libxml2', toolset=build_config.get_msvc_toolset_ver_win32()) build_utils.build_vs(sln_path, 'Release', 'Win32', target='libxml2', toolset=build_config.get_msvc_toolset_ver_win32()) build_utils.build_vs(sln_path, 'Debug', 'x64', target='libxml2', toolset=build_config.get_msvc_toolset_ver_win32()) build_utils.build_vs(sln_path, 'Release', 'x64', target='libxml2', toolset=build_config.get_msvc_toolset_ver_win32()) libraries_win_root = os.path.join(root_project_path, 'Libs/lib_CMake/win') lib_path_x86_debug = os.path.join( source_folder_path, 'win32/VC10/Debug/libxml2.lib') lib_path_x86_release = os.path.join( source_folder_path, 'win32/VC10/Release/libxml2.lib') shutil.copyfile( lib_path_x86_debug, os.path.join(libraries_win_root, 'x86/Debug/libxml2.lib')) shutil.copyfile( lib_path_x86_release, os.path.join(libraries_win_root, 'x86/Release/libxml2.lib')) lib_path_x64_debug = os.path.join( source_folder_path, 'win32/VC10/x64/Debug/libxml2.lib') lib_path_x64_release = os.path.join( source_folder_path, 'win32/VC10/x64/Release/libxml2.lib') shutil.copyfile( lib_path_x64_debug, os.path.join(libraries_win_root, 'x64/Debug/libxml2.lib')) shutil.copyfile( lib_path_x64_release, os.path.join(libraries_win_root, 'x64/Release/libxml2.lib')) """ _copy_headers(source_folder_path, root_project_path)
def _build_win32(working_directory_path, root_project_path): source_folder_path = _download(working_directory_path) build_folder_path = os.path.join(working_directory_path, 'gen/build_win32') build_folder_path_x86 = os.path.join(build_folder_path, 'x86') build_folder_path_x86_debug = os.path.join(build_folder_path_x86, 'Debug') build_folder_path_x86_release = os.path.join(build_folder_path_x86, 'Release') build_folder_path_x64 = os.path.join(build_folder_path, 'x64') build_folder_path_x64_debug = os.path.join(build_folder_path_x64, 'Debug') build_folder_path_x64_release = os.path.join(build_folder_path_x64, 'Release') os.makedirs(build_folder_path_x86_debug) os.makedirs(build_folder_path_x86_release) os.makedirs(build_folder_path_x64_debug) os.makedirs(build_folder_path_x64_release) vc_solution_file=os.path.join(source_folder_path, 'uv.sln') override_props_file=os.path.abspath('override_win32.props') toolset=build_config.get_msvc_toolset_ver_win32() msbuild_args=[ "/p:ForceImportBeforeCppTargets={}".format(override_props_file), "/p:WindowsTargetPlatformVersion={}".format(build_config.get_msvc_sdk_version_win32()) ] # x86 x86_env = build_utils.get_win32_vs_x86_env() x86_env['GYP_MSVS_VERSION'] = build_config.get_gyp_msvs_version() build_utils.run_process( ['vcbuild.bat', 'x86', 'nobuild'], process_cwd=source_folder_path, environment=x86_env, shell=True) build_utils.build_vs(vc_solution_file, 'Debug', 'Win32', 'libuv', toolset, msbuild_args=msbuild_args) build_utils.build_vs(vc_solution_file, 'Release', 'Win32', 'libuv', toolset, msbuild_args=msbuild_args) lib_path_x86_debug = os.path.join(build_folder_path_x86_debug, 'libuv.lib') lib_path_x86_release = os.path.join(build_folder_path_x86_release, 'libuv.lib') shutil.copyfile( os.path.join(source_folder_path, 'Debug/lib/libuv.lib'), lib_path_x86_debug) shutil.copyfile( os.path.join(source_folder_path, 'Release/lib/libuv.lib'), lib_path_x86_release) build_utils.run_process( ['vcbuild.bat', 'clean'], process_cwd=source_folder_path, environment=x86_env, shell=True) # x64 x64_env = build_utils.get_win32_vs_x64_env() x64_env['GYP_MSVS_VERSION'] = build_config.get_gyp_msvs_version() build_utils.run_process( ['vcbuild.bat', 'x64', 'nobuild'], process_cwd=source_folder_path, environment=x64_env, shell=True) build_utils.build_vs(vc_solution_file, 'Debug', 'x64', 'libuv', toolset, msbuild_args=msbuild_args) build_utils.build_vs(vc_solution_file, 'Release', 'x64', 'libuv', toolset, msbuild_args=msbuild_args) lib_path_x64_debug = os.path.join(build_folder_path_x64_debug, 'libuv.lib') lib_path_x64_release = os.path.join(build_folder_path_x64_release, 'libuv.lib') shutil.copyfile( os.path.join(source_folder_path, 'Debug/lib/libuv.lib'), lib_path_x64_debug) shutil.copyfile( os.path.join(source_folder_path, 'Release/lib/libuv.lib'), lib_path_x64_release) # copy libs libs_win_root = os.path.join(root_project_path, 'Libs/lib_CMake/win') shutil.copyfile( lib_path_x86_debug, os.path.join(libs_win_root, 'x86/Debug/libuv.lib')) shutil.copyfile( lib_path_x86_release, os.path.join(libs_win_root, 'x86/Release/libuv.lib')) shutil.copyfile( lib_path_x64_debug, os.path.join(libs_win_root, 'x64/Debug/libuv.lib')) shutil.copyfile( lib_path_x64_release, os.path.join(libs_win_root, 'x64/Release/libuv.lib')) _copy_headers(source_folder_path, root_project_path)
def _build_win32(working_directory_path, root_project_path): source_folder_path, c99_to_c89_folder_path = _download_and_extract( working_directory_path) _patch_sources(source_folder_path, working_directory_path) install_path_debug_x86 = os.path.join(working_directory_path, 'gen/install_win32_debug_x86') install_path_debug_x64 = os.path.join(working_directory_path, 'gen/install_win32_debug_x64') install_path_release_x86 = os.path.join(working_directory_path, 'gen/install_win32_release_x86') install_path_release_x64 = os.path.join(working_directory_path, 'gen/install_win32_release_x64') msys2_cmd_template = ['msys2_shell.cmd', '-use-full-path', '-l', '-c'] # make clean is so dumb bash_arg_clean_part = (' && make clean && rm compat/msvcrt/snprintf.d' ' && rm compat/msvcrt/snprintf.o' ' && rm compat/strtod.o && rm compat/strtod.d') bash_arg_template = ('cd {} && ./configure {} && ' 'make && make install' + bash_arg_clean_part) configure_args_debug_template = ( '--toolchain=msvc --prefix={} --disable-all --enable-static ' '--disable-shared --enable-avcodec --enable-avdevice --enable-avfilter ' '--enable-avformat --enable-swresample --enable-swscale ' '--enable-gpl --enable-postproc') configure_args_release_template = configure_args_debug_template + ' --disable-debug' env_x86 = build_utils.get_win32_vs_x86_env() env_x64 = build_utils.get_win32_vs_x64_env() env_x86['PATH'] = c99_to_c89_folder_path + ';' + env_x86['PATH'] env_x64['PATH'] = c99_to_c89_folder_path + ';' + env_x64['PATH'] configure_args_debug_x86 = configure_args_debug_template.format( _path_to_msys_path(install_path_debug_x86)) bash_arg = bash_arg_template.format(_path_to_msys_path(source_folder_path), configure_args_debug_x86) cmd = msys2_cmd_template[:] cmd.append(bash_arg) build_utils.run_process(cmd, process_cwd=source_folder_path, environment=env_x86) configure_args_release_x86 = configure_args_release_template.format( _path_to_msys_path(install_path_release_x86)) bash_arg = bash_arg_template.format(_path_to_msys_path(source_folder_path), configure_args_release_x86) cmd = msys2_cmd_template[:] cmd.append(bash_arg) build_utils.run_process(cmd, process_cwd=source_folder_path, environment=env_x86) configure_args_debug_x64 = configure_args_debug_template.format( _path_to_msys_path(install_path_debug_x64)) bash_arg = bash_arg_template.format(_path_to_msys_path(source_folder_path), configure_args_debug_x64) cmd = msys2_cmd_template[:] cmd.append(bash_arg) build_utils.run_process(cmd, process_cwd=source_folder_path, environment=env_x64) configure_args_release_x64 = configure_args_release_template.format( _path_to_msys_path(install_path_release_x64)) bash_arg = bash_arg_template.format(_path_to_msys_path(source_folder_path), configure_args_release_x64) cmd = msys2_cmd_template[:] cmd.append(bash_arg) build_utils.run_process(cmd, process_cwd=source_folder_path, environment=env_x64) _copy_headers(install_path_debug_x86, root_project_path) _copy_libraries( install_path_debug_x86, os.path.join(root_project_path, 'Libs/lib_CMake/win/x86/Debug/')) _copy_libraries( install_path_release_x86, os.path.join(root_project_path, 'Libs/lib_CMake/win/x86/Release/')) _copy_libraries( install_path_debug_x64, os.path.join(root_project_path, 'Libs/lib_CMake/win/x64/Debug/')) _copy_libraries( install_path_release_x64, os.path.join(root_project_path, 'Libs/lib_CMake/win/x64/Release/'))
def _build_win32(working_directory_path, root_project_path): source_folder_path = _download_and_extract(working_directory_path) build_utils.apply_patch( os.path.abspath('patch_debug_and_dynamic_runtime.diff'), working_directory_path) # Build only detours library excluding examples makefile_path = os.path.join(source_folder_path, 'src') # x86 debug build env = build_utils.get_win32_vs_x86_env() env['DETOURS_TARGET_PROCESSOR'] = 'X86' env['DETOURS_RUNTIME'] = 'DYNAMIC' env['DETOURS_BUILD_MODE'] = 'DEBUG' env['DETOURS_CONFIG'] = '.debug' build_utils.run_process(['nmake'], process_cwd=makefile_path, shell=True, environment=env) # x86 release build env = build_utils.get_win32_vs_x86_env() env['DETOURS_TARGET_PROCESSOR'] = 'X86' env['DETOURS_RUNTIME'] = 'DYNAMIC' env['DETOURS_BUILD_MODE'] = 'RELEASE' env['DETOURS_CONFIG'] = '.release' build_utils.run_process(['nmake'], process_cwd=makefile_path, shell=True, environment=env) # x64 debug build env = build_utils.get_win32_vs_x64_env() env['DETOURS_TARGET_PROCESSOR'] = 'X64' env['DETOURS_RUNTIME'] = 'DYNAMIC' env['DETOURS_BUILD_MODE'] = 'DEBUG' env['DETOURS_CONFIG'] = '.debug' build_utils.run_process(['nmake'], process_cwd=makefile_path, shell=True, environment=env) # x64 release build env = build_utils.get_win32_vs_x64_env() env['DETOURS_TARGET_PROCESSOR'] = 'X64' env['DETOURS_RUNTIME'] = 'DYNAMIC' env['DETOURS_BUILD_MODE'] = 'RELEASE' env['DETOURS_CONFIG'] = '.release' build_utils.run_process(['nmake'], process_cwd=makefile_path, shell=True, environment=env) libraries_win_root = os.path.join(root_project_path, 'Libs/lib_CMake/win') shutil.copyfile( os.path.join(source_folder_path, 'lib.X86.debug/detours.lib'), os.path.join(libraries_win_root, 'x86/Debug/detours.lib')) shutil.copyfile( os.path.join(source_folder_path, 'lib.X86.release/detours.lib'), os.path.join(libraries_win_root, 'x86/Release/detours.lib')) shutil.copyfile( os.path.join(source_folder_path, 'lib.X64.debug/detours.lib'), os.path.join(libraries_win_root, 'x64/Debug/detours.lib')) shutil.copyfile( os.path.join(source_folder_path, 'lib.X64.release/detours.lib'), os.path.join(libraries_win_root, 'x64/Release/detours.lib')) _copy_headers(source_folder_path, root_project_path)