5 Star 23 Fork 10

10km/jpegwrapper

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
mingw_build.bat 2.27 KB
一键复制 编辑 原始数据 按行查看 历史
10km 提交于 2023-10-28 18:16 +08:00 . 增加 conan 2.x 支持
@rem 根据%%1参数 编译DEBUG|RELEASE版本,默认RELEASE
@echo off
echo build jpegwrapper by MinGW
where gcc
if errorlevel 1 (
echo MinGW/gcc NOT FOUND.
exit /B -1
)
echo MinGW/gcc found.
where cmake
if errorlevel 1 (
echo cmake NOT FOUND.
echo download from http://cmake.org/ ,extract to disk
echo add installation path to environment variable PATH
exit /B -1
)
echo cmake found.
set sh_folder=%~dp0
rem 定义编译的版本类型(DEBUG|RELEASE)
set build_type=Release
rem 如果输入参数1为"DEBUG"(不区分大小写)则编译DEBUG版本
if /I "%1" == "DEBUG" ( set build_type=Debug)
echo build_type=%build_type%
rem 是否编译测试程序
set build_test=True
rem 判断是否能编译64位程序
gcc --version |findstr "sjlj seh"
if errorlevel 1 (
echo unsupported x86_64 build
)else call:gcc_x86_64
rem 判断是否能编译32位程序
gcc --version |findstr "sjlj dwarf"
if errorlevel 1 (
echo unsupported x86 build
)else call:gcc_x86
goto :end
:gcc_x86
echo build x86 use MinGW
if exist build_gcc_x86 rmdir build_gcc_x86 /s/q || exit /B
mkdir build_gcc_x86 || exit /B
pushd build_gcc_x86 || exit /B
conan install .. --build missing -s arch=x86 -of . -o build_test=%build_test% -s build_type=%build_type% || exit /B
cmake .. -G "MinGW Makefiles" ^
-DCMAKE_BUILD_TYPE=%build_type% ^
-DAUTO_BUILD_TEST=%build_test% ^
-DCMAKE_CXX_FLAGS=-m32 ^
-DCMAKE_TOOLCHAIN_FILE=./conan_toolchain.cmake ^
-DCMAKE_INSTALL_PREFIX=../release/jpegwrapper-windows-gcc-x86 || exit /B
cmake --build . --config %build_type% || exit /B
cmake --install . --config %build_type% || exit /B
popd
rmdir build_gcc_x86 /s/q
goto:eof
:gcc_x86_64
echo build x86_64 use MinGW
if exist build_gcc_x86_64 rmdir build_gcc_x86_64 /s/q
mkdir build_gcc_x86_64 || exit /B
pushd build_gcc_x86_64 || exit /B
conan install .. --build missing -s arch=x86_64 -of . -o build_test=%build_test% -s build_type=%build_type% || exit /B
cmake .. -G "MinGW Makefiles" ^
-DCMAKE_BUILD_TYPE=%build_type% ^
-DAUTO_BUILD_TEST=%build_test% ^
-DCMAKE_CXX_FLAGS=-m64 ^
-DCMAKE_TOOLCHAIN_FILE=./conan_toolchain.cmake ^
-DCMAKE_INSTALL_PREFIX=../release/jpegwrapper-windows-gcc-x86_64 || exit /B
cmake --build . --config %build_type% || exit /B
cmake --install . --config %build_type% || exit /B
popd
rmdir build_gcc_x86_64/s/q
goto:eof
:end
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/l0km/jpegwrapper.git
git@gitee.com:l0km/jpegwrapper.git
l0km
jpegwrapper
jpegwrapper
master

搜索帮助