- Overview
- Building and Running the Demos on Linux and macOS
- Building and Running the Demos on Windows
This directory contains C++ sample programs for various Ice components; they all use the Ice C++98 mapping. These examples are provided to get you started on using a particular Ice feature or coding technique.
Most of the subdirectories here correspond directly to Ice components, such as IceGrid, Glacier2, and so on. We've also included the following additional subdirectories:
- Manual contains complete examples for some of the code snippets in the Ice manual.
The makefiles require GNU make 3.80 or later.
On macOS, the command-line demos require the Xcode Command Line Tools to be
installed (use xcode-select --install
to install them).
If you've installed Ice in a non-standard location, you'll need to set the
ICE_HOME
environment variable with the path name of the
installation directory:
export ICE_HOME=~/testing/ice
Review the settings in ../make/Make.rules
. For example, set OPTIMIZE=yes
to build with optimization.
When you're ready to start the build, run make
, for example:
make V=1
V=1
in the example above turns on verbose output.
The clean
and distclean
targets allow you clean all the demos. clean
removes the binary files created by the build; distclean
removes all these
files plus the C++ files generated by slice2cpp.
Note that make clean
only removes the binary files for the configuration and
platform specified with the CONFIGS
and PLATFORMS
variables in Make.rules
.
You can also build or clean a single demo with make <demo-path>[_clean|_distclean]
,
for example:
make V=1 Ice/hello
make Ice/hello_distclean
Refer to the README.md file in each demo directory for usage instructions.
Visual Studio 2017 users need to install Windows 10 SDK (10.0.14393.0) component in Visual Studio 2017 installer.
Open the solution file C++98 demos.sln
to build the sample programs.
The demos are configured to use Ice C++ binary distribution, packaged with NuGet. The build downloads automatically the Ice NuGet package.
If you have disabled the automatic download of NuGet packages by Visual Studio,
you need to restore the packages before you build using Tools > NuGet Package Manager > Manage NuGet Packages for Solution...
in Visual Studio.
Then select your target configuration (Debug or Release) and platform (Win32
or x64). Right click on the desired demo in the Solution Explorer window and
select Build
.
-
Build from command line:
- Open a Visual Studio command prompt
cd ice-demos\cpp98 MSBuild /p:IceHome=<Ice dist path> /p:Configuration=<Release or Debug> msbuild\ice.proj"
-
Build from Visual Studio
- Open a Visual Studio command prompt
cd ice-demos\cpp98 MSBuild /p:IceHome=<Ice dist path> /p:Configuration=<Release or Debug> /t:InstallLocalPackages msbuild\ice.proj"
- Start Visual Studio and open
C++98 demos.sln
solution file, select your target configuration (Debug or Release) and platform (Win32 or x64). Right click on the desired demo in the Solution Explorer window and selectBuild
.
You need to add the Ice bin
directory to your PATH before running the demos.
If are building Debug, add both the Debug and Release bin
directories with a
command similar to:
set PATH=%USERPROFILE%\ice-demos\cpp11\packages\zeroc.ice.v140.3.7.1\build\native\bin\x64\Debug;%USERPROFILE%\ice-demos\cpp11\packages\zeroc.ice.v140.3.7.1\build\native\bin\x64\Release;%PATH%
This is required because the Debug bin
directories provide only a subset of all
Ice services and tools. For example, they don't provide glacier2router
.
If you are building Release, you should add only the Release bin
directory to
your PATH with a command similar to:
set PATH=%USERPROFILE%\ice-demos\cpp11\packages\zeroc.ice.v140.3.7.1\build\native\bin\x64\Release;%PATH%
Then refer to the README.md file in each demo directory for usage instructions.