Skip to content

Commit

Permalink
Added build script for Visual Studio
Browse files Browse the repository at this point in the history
  • Loading branch information
heikohimu committed Jul 17, 2021
1 parent de5e3fb commit 1772ad8
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 28 deletions.
34 changes: 6 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,34 +68,12 @@ A Debian package can be built with e.g.
make
make package

### Windows and Visual Studio

Building is based on cmake. Therefore, cmake must be downloaded and installed
according to the operating system from https://cmake.org/download/ After
starting the cmake-gui, the path to the rc_genicam_api source code directory
as well as the build directory must be specified. It is common to choose
a sub-directory of the source code directory and name it 'build' for the
the temporary files that are created during the build process. After setting
both paths, the 'Configure' button must be pressed. In the up-coming dialog,
it can be chosen for which version of Visual Studio and which platform (e.g.
Win64) the project files should be generated. The dialog is closed by pressing
'Finish'.

After configuration, the value of the key with the name `CMAKE_INSTALL_PREFIX`
may be changed to an install directory. By default, the install directory is
set to a path like `C:/Program Files/rc_genicam_api`. The 'Generate' button
leads to creating the project file. Visual Studio can be opened with this
project by pressing the 'Open Project' button.

By default, a 'Debug' version will be compiled. This can be changed to 'Release'
for compiling an optimized version. The package can then be created, e.g. by
pressing 'F7'. For installing the compiled package, the 'INSTALL' target can be
*created* in the project explorer.

After installation, the install directory will contain three sub-directories.
The 'bin' directory contains the tools, DLLs and the default transport layer
including configuration. The 'include' and 'lib' sub-directories contain the
headers and libraries for using the API in own programs.
### Windows

The main directory contains the script build_win.bar. Execute this script
in the Visual Studio command line prompt for building the package.
Alternatively, you can use cmake manually to generate a build project for
compilation with your favorite compiler.

NOTE: For using the libraries in own projects, define the symbol
`GENICAM_NO_AUTO_IMPLIB` in your project file to avoid linker problems with the
Expand Down
48 changes: 48 additions & 0 deletions build_win.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

:: Build script for rc_sgm_producer under Windows

@echo off
setlocal enabledelayedexpansion

where nmake >nul 2>nul
if %ERRORLEVEL% NEQ 0 (
echo This must be run in Visual Studio command prompt for x64
exit /b 1
)

where git >nul 2>nul
if %ERRORLEVEL% NEQ 0 (
echo You must download and install git from: git-scm.com/download/win
exit /b 1
)

where cmake >nul 2>nul
if %ERRORLEVEL% NEQ 0 (
echo You must download and install cmake from: https://cmake.org/download/
exit /b 1
)

:: 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%
set INSTALL_PATH=%CD%
cd ..

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

cd ..\..

0 comments on commit 1772ad8

Please sign in to comment.