Skip to content

Commit

Permalink
Improved Windows build script for compiling with libpng
Browse files Browse the repository at this point in the history
  • Loading branch information
heikohimu committed Oct 23, 2021
1 parent 7ff202d commit 9466329
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 9 deletions.
91 changes: 83 additions & 8 deletions build_win.bat
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,59 @@ if %ERRORLEVEL% NEQ 0 (
exit /b 1
)

:: Create directories for building and installing
echo ----- Create directories for building and installing -----

if not exist "build\" mkdir build
cd build

for /F "tokens=* USEBACKQ" %%F in (`git describe`) do (set VERSION=%%F)

set TARGET=rc_genicam_api-%VERSION%-win64
if not exist "%TARGET%\" mkdir %TARGET%
cd %TARGET%
if not exist "install\" mkdir install
cd install
set INSTALL_PATH=%CD%
cd ..

cd ..\..\..

echo ----- Download zlib and libpng -----

if not exist "zlib\" (
git clone https://github.com/winlibs/zlib.git
cd zlib
git checkout zlib-1.2.11
cd ..
)

if not exist "libpng\" (
git clone https://github.com/winlibs/libpng.git
cd libpng
git checkout libpng-1.6.34
cd ..
)

echo ----- Building zlib -----

cd zlib

if not exist "build\" mkdir build
cd build

if exist "build_rc_genicam_api\" (
cd build_rc_genicam_api\
) else (
mkdir build_rc_genicam_api\
cd build_rc_genicam_api\
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="%INSTALL_PATH%" ..\..
)

nmake install
if %ERRORLEVEL% NEQ 0 exit /b 1

cd ..\..\..

echo ----- Building libpng -----

cd libpng

if not exist "build\" mkdir build
cd build

if exist "build_rc_genicam_api\" (
cd build_rc_genicam_api\
Expand All @@ -44,5 +85,39 @@ if exist "build_rc_genicam_api\" (
)

nmake install
if %ERRORLEVEL% NEQ 0 exit /b 1

cd ..\..\..

echo ----- Build rc_genicam_api -----

cd rc_genicam_api\build

if exist "build_rc_genicam_api\" (
cd build_rc_genicam_api\
) else (
mkdir build_rc_genicam_api\
cd build_rc_genicam_api\
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="%INSTALL_PATH%" ..\..
)

nmake install
if %ERRORLEVEL% NEQ 0 exit /b 1

cd ..

echo ----- Extracting files for publication -----

for /F "tokens=* USEBACKQ" %%F in (`git describe`) do (set VERSION=%%F)

set TARGET=rc_genicam_api-%VERSION%-win64
if not exist "%TARGET%\" mkdir %TARGET%

xcopy /s %INSTALL_PATH%\bin %TARGET%\bin\
if not exist "%TARGET%\include\" mkdir %TARGET%\include
xcopy /s %INSTALL_PATH%\include\rc_genicam_api %TARGET%\include\
if not exist "%TARGET%\lib\" mkdir %TARGET%\lib
copy %INSTALL_PATH%\lib\GCBase*lib %TARGET%\lib\
copy %INSTALL_PATH%\lib\GenApi*lib %TARGET%\lib\
copy %INSTALL_PATH%\lib\rc_genicam_api.lib %TARGET%\lib\

cd ..\..
1 change: 1 addition & 0 deletions rc_genicam_api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ list(APPEND MSVC_DISABLED_WARNINGS
"/wd4626"
"/wd5026"
"/wd5027"
"/wd4267"
"/wd5039")

if (UNIX)
Expand Down
2 changes: 1 addition & 1 deletion rc_genicam_api/system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ std::vector<std::shared_ptr<System> > System::getSystems()
System *p=new System(name[i]);
ret.push_back(std::shared_ptr<System>(p));
}
catch (const std::exception &ex)
catch (const std::exception &)
{
// ignore transport layers that cannot be used
}
Expand Down

0 comments on commit 9466329

Please sign in to comment.