This page covers instructions on how to compile this SRM SDK. In addition, it provides steps that can be used to verify that the compilation completed successfully.
NOTE: This document is intended for those users who are building the SRM libraries from the source. Pre-compiled (binary) distributions for both static and dynamic linking for all supported platforms are available for download from the SEDRIS Web Site.
For general information about this release, where to obtain it, and items that require specific attention, see the Release Notes.
For help, comments, and bug reports please send email to help@sedris.org. If you are an associate, please use se-coders@sedris.org.
Return to: Top
If you require SRM support on other platforms or compilers, you can send email to se-scrccb@sedris.org stating the specific platform, operating system and C/C++ compiler requirements. The SEDRIS project will try to accommodate your requests as much as possible.
Platform Compiler Irix 6.5 (n32 only)
- MipsPro 7.2 (n32 only)
- GCC 3.0.1
SunOS 5.6
- SC 4.2
- GCC 3.0.1 (without optimization)
SunOS 5.7
- SC 4.2
- SC 5.2 - Forte (without optimization) (requires compiler patches: 105591-09, 106327-11, 106300-12, 106950-16, and 104631-07)
- GCC 3.0.1
Linux (Red Hat Linux 3.2.2-5)
- GCC 3.2.2
Windows 98/Me/NT/2000/XP
- Visual C++ 6.0 and 7.1 (.net)
Return to: Top
The SRM software will compile and work "out-of-the-box" on all supported systems. However, your particular system may have missing or different versions of the Make utility and compiler versions, so read the following sections carefully to verify your system.
The build requirements for Unix and Win32 environments are:
- Unix
The SDK Build Environment for Unix requires the use of the GNU "make" utility (the "gmake" program) version 3.78.1 or higher, older versions will not work. GNU "make" is freely available under the GNU General Public License and may be downloaded via several mirror sites. You can verify your availability of "make" and its version by just executing the command "make -v". If you get a "Command not found" error, you will need to install it.
- Win32
The SDK Build Environment for Win32 supports both the Microsoft Visual C++ 6.0 and 7.1 project files. Hence, a default installation of Microsoft Visual C++ 6.0 or 7.1 is sufficient to successfully build all the SDK libraries and applications.
Return to: Top
Compiling the libraries and applications is only a few steps in all supported platforms. In the following sections, the "[root]" directory is where you extracted the SDK source code.
- Unix
A "make" command in the "[root]" directory will recursively go through the SDK directory structure and build all libraries and applications provided with the distribution using the default settings. See Build Options and Commands for command line settings. For this release, the default settings are:
- BUILDING_SRM_C_API = yes
- BUILD_MODE = OPT
- BIND_STATIC = no
- USE_GNU = false (set to true under Linux)
These settings will compile the C API implementation using optimization and dynamic linking. Set the "BUILDING_SRM_C_API" to "no" to build the C++ API implementation. Depending on the API selected, the proper header files would be copied to the include/ directory.
- Win32
Follow these steps to build all the SDK libraries and applications using:
- From Windows Explorer, locate and open (i.e. double click) either the "win32_headers_c.bat" file or the "win32_header_cpp.bat file in the "[root]" directory of your installation. This step creates the top "include" directory with all the header files for this SDK for the C API or the C++ API respectively.
- Select which version of MSVC++ to use:
- If using MSVC++ 6.0: If you want to compile the SDK using Dynamic linking (i.e. linking against DLLs), open either the "vcpp_dynamic.dsw" or the "vcpp_cpp_dynamic.dsw" VC++ project workspace file to build the C or C++ API implementation respectively. Likewise, for Static linking, open either the "vcpp_static.dsw" or the "cpp_cpp_static.dsw file.
- If using MSVC++ 7.1 (.net): If you want to compile the SDK using Dynamic linking (i.e. linking against DLLs), open either the "vcpp_dynamic.sln" or the "vcpp_cpp_dynamic.sln" VC++ project workspace file to build the C or C++ API implementation respectively. Likewise, for Static linking, open either the "vcpp_static.sln" or the "cpp_cpp_static.sln file.
- From the Visual C++ IDE, select "all_sdk" as your "Active Project" and "Release" or "Debug" for your "Active Configuration". For example, to compile in "Release" mode, choose "Build->Set Active Configuration..." and select the "all_sdk - Win32 Release" entry for the C API (or all_cpp_sdk - Win32 Release for the C++ API).
- From the "Build" menu, choose "Rebuild All".
Notes:
- If you will be switching between the Static and Dynamic project workspaces, make sure to use the "Rebuild All" command so that the previous compilation files are deleted.
- You can build individual applications by making them the current "Active Project" ("Project->Set Active Project" menu), and choosing "Rebuild All".
- The "Release" option is similar to the Unix Build Environment "OPT" option for the "BUILD_MODE" variable.
If you have any errors reported by the build process, see Problems with the Build.
Return to: Top
In order to run the included applications, you will need to add to your current path the paths to where the application executables and the libraries (if compiled "dynamic") are.
- Unix
The names of the application and library directories can be retrieved by executing the command "make env". Look for the lines containing "EXE_DIR" and "LIB_DIR". For example, you can use the command "make env | grep _DIR" to list all the directories specified by the build environment. You can also do an "ls" in the "[root]/bin" and "[root]/lib" directories (and their subdirectories) to find where the applications or libraries reside. For example, in a Linux system, the path to the executable applications might be "[root]/bin/linux-2.4.7-10-i386/OPT". You will need to add the applications directory to your "PATH" environment variable, and the libraries directory to your "LD_LIBRARY_PATH" directory. For example, to add the previous Linux executable applications path in a Bash shell, you can use "PATH=$PATH:[root]/bin/linux-2.4.7-10-i386/OPT".
- Win32
The executable applications reside in the "[root]\bin\Release" or "[root]\bin\Debug" depending on build mode. Similarly, the libraries reside in either "[root]\lib\Release" or "[root]\lib\Debug". From a DOS Prompt, add these directories to the "PATH" environment variable by using the command "set PATH=[root]\bin\Release;[root]\lib\Release;%PATH%" (or use "Debug" instead of "Release" if you compiled in "Debug" mode).
You are now ready to try one of the SRM applications. Execute the command
this will run the Sample SRM Access program, which converts a 3D coordinate from a Celestiodetic SRF to a Celestiocentric SRF.
- "c_sample_srm_access" if you built the C API
- "sample_srm_access" if you built the C++ API
- If you are using the C API, then you should see an output similar to the following:
Running SRM Sample test program... [ 4517590.878846, 0.000000, 4487348.408859 ]- If you are using the C++ API, then you should see an output similar to the following:
Running SRM Sample test program... Source Celestiodetic SRF parameters: orm=> 250 rt=> 341 Target Celestiocentric SRF parameters: orm=> 250 rt=> 341 Executed changeCoordinate3DSRF Source Celestiodetic 3D coordinate: [ 0, 0.785398, 0 ] Target (converted) Celestiocentric 3D coordinate: [ 4.51759e+06, 0, 4.48735e+06 ] Released CC SRF Released CD SRFIf you see something like what is shown above, you have successfully compiled the SRM SDK!
Return to: Top
This section describes the steps needed to link your software against the libraries produced by this SDK. Applications and/or libraries that use this SDK will need to refer to the "[root]/include" directory for compilation, and the libraries in the "[root]/lib" subdirectories for linking. The examples that follow create an application called "myapp" which you can use as a starting point for your own development.
The library your applications will need to link against for the SRM SDK is called "libsrm.a" in Unix, and "srm.lib" in Win32 environments.
- Unix
The Unix Build Environment uses standard Makefiles and "include" files that specify the process for compiling and linking the applications and libraries. The following steps show how to integrate an application into the build environment. If you want to create an application in another directory, you will need to change the relative paths as appropriate.
- From a Unix shell, create a new directory called "myapp" under "[root]/src/apps".
- Create an "appdefs.mk" file in the new "myapp" directory with the following lines:
include $(DEPTH)/src/templates/cleanup_macros.mk ifdef SRM_SDK DIR_PATH := src/apps/myapp else DIR_PATH := src/lib/srm/src/apps/myapp endif APPNAME := myapp C_SOURCES := myapp.c CXX_SOURCES := REQUIRED_LIBS := srm LOCAL_INCLUDES := -I$(INC_DIR) include $(DEPTH)/src/templates/localtargets.mk- Put your "myapp.c" source code file into the "myapp" directory.
- You should now be able to run the "make" command from the "[root]" directory and have your application compiled and linked against the SDK libraries.
- Win32 Application
This section describes the steps to compile an application against the C libraries using VC++ 6.0. For VC++ 7.1, extensions ".dsw" and ".dsp" becomes ".sln" and ".vcproj" respectively:
To compile your own applications from the Visual C++ 6.0 IDE, use one of the provided applications as a model for your project files (the ".dsp" files), edit them as needed, insert them into the appropriate workspace (either "vcpp_dynamic.dsw" or "vcpp_static.dsw") by using the VC++ menu command "Project->Insert Project Into Workspace...", and set the project dependencies as done for the other applications. As an alternative, you can create the project from scratch directly from the SDK workspace. The following steps show you exactly how to do this. The steps create an application to be linked dynamically against the SDK libraries. The application will be created in the "[root]/src/apps" directory. If you want to create an application in another directory, you will need to change the relative paths as appropriate.
- Open the "vcpp_dynamic.dsw" file.
- Select "Project->Add To Project->New...".
- Choose the "Projects" tab in the "New" dialog, and select "Win32 Console Application".
- In the "Location:" box, click the "..." button and navigate to the "[root]/src/apps" directory, and click the "OK" button.
- In the "Project name:" box, enter "myapp".
- Verify the "Add to current workspace" choice is selected, and click the "OK" button
- In the next dialog, leave the selection to "An empty project", click the "Finish" button, and the "OK" button in the next dialog.
- Your new project is now in the workspace, and it should be "bolded" indicating it is the current project. If it is not, use the "Project->Set Active Project" menu to make it active.
- Choose "Project->Add To Project->Files...", and add your source code files to it.
- Choose "Project->Settings...", select the "myapp" project on the left side of the "Project Settings" dialog, and choose "Win32 Release" for the "Settings For:" drop down menu on the top left of the dialog.
- In the "General" tab, enter "../../../bin/Release" in the "Output files:" box.
- In the "C/C++" tab, choose "Code Generation" in the "Category:" drop down menu, and choose "Multithreaded DLL" in the "Use run-time library:" drop down menu.
- Now choose "Win32 Debug" for the "Settings For:" drop down menu.
- In the "C/C++" tab, choose "Code Generation" in the "Category:" drop down menu, and choose "Debug Multithreaded DLL" in the "Use run-time library:" drop down menu.
- In the "General" tab, enter "../../../bin/Debug" in the "Output files:" box.
- Now choose "All Configurations" for the "Settings For:" drop down menu.
- In the "C/C++" tab, choose "Preprocessor" in the "Category:" drop down menu, and enter "../../../include" in the "Additional include directories:" box.
- Click the "OK" button in the "Project Settings" dialog.
- Choose "Project->Dependencies...", and select "myapp" in the "Select project to modify:" drop down menu.
- Click the box beside the "sedris" entry in the "Dependent on the following project(s):" scroll list so that a check mark is inside it, and click the "OK" button.
- You should now be able to build your project by pressing the "F7" key or from the menu by choosing "Build->Build myapp.exe".
- The executable will be located in the "[root]\bin\Release" or "[root]\bin\Debug" directory depending on your build mode.
To create a project for static linking, see the settings for those applications in the static workspace and set the preprocessor definition
EXPORT_DLL=""in the "Preprocessor definitions" options for your project. You can do this from the VC++ IDE using the following steps:
- Open your project and choose "Project->Settings...".
- Select "All Configurations" in the "Settings For:" drop down menu.
- Select your application project on the left part of the dialog.
- In the "C/C++" tab, select "General" in the "Category:" drop down menu.
- In the "Preprocessor definitions:", enter the following at the end of all other entries:
,EXPORT_DLL=""- Click "OK" and build your project using "Build->Rebuild All".
To compile an applications against the C++ library add the following steps:
- Add "BUILD_SRM_CPP" to the Preprocessor Definitions in user application's project setting when building against the dynamic (.dll) library.
- Add both the "BUILD_SRM_CPP" and the "EXPORT_SRM_CPP_DLL=" to the Preprocessor Definitions in user application's project setting when building against the static (.lib) library.
- Win32 Library
If you are linking your own libraries against this SDK library, you will need to set a preprocessor definition in your project files or "unresolved" errors will appear when linking. From the Visual C++ IDE, use the following steps:
- Open your project and choose "Project->Settings...".
- Select "All Configurations" in the "Settings For:" drop down menu.
- Select your library project on the left part of the dialog.
- In the "C/C++" tab, select "General" in the "Category:" drop down menu.
- In the "Preprocessor definitions:" entry box, enter the following at the end of all other entries:
if linking your libraries against this SDK built dynamically, or,EXPORT_DLL="__declspec(dllimport)"if linking your libraries against this SDK built statically.,EXPORT_DLL=""- Click "OK" and build your project using "Build->Rebuild All".
To run your application, follow the same steps as described in Testing the Build.
Return to: Top
The following is a list of the most common build environment variables and commands for the SDK Build Environment for Unix. The options for the SDK Build Environment for Win32 are controlled from the Visual C++ IDE interface. Consult the Visual C++ Documentation for more information on changing the build settings.
The default settings are marked with an asterisk "*" and in bold. Also note that you can use "true", "on", and "1" to signify an "active" state, and "false", "off", and "0" to signify a "deactive" state (use all lower or upper case letters).
Variable Valid Settings Description BUILDING_SRM_C_API YES*, NO Chooses between the C and C++ APIs BUILD_MODE OPT*, STD, DEBUG, PROF Compile mode: optimized, standard, debug, or profiling BIND_STATIC YES, NO* Chooses between static and dynamic linking OPTIMIZE YES*, NO Forces optimization The following is a list of the most common build environment commands for Unix:
Command Description make Builds software contained in the current directory and copies to the install directory. make clean Deletes compiled software from current directory. make realclean Deletes compiled software from install directory. Also performs a "make clean" of current directory and removes headers from the "include" directory. make distclean Only operates on the entire release from the root directory. Removes all ".objects" and ".depends" directories, all autogenerated files, the "lib" and "bin" directories, and removes all header files from the "include" directory, returning the entire release to its original "pristine" state. Note that a sharing violation may occur if the command tries to delete files that you are currently using (like one of the SDK applications still running). make env Displays current build settings. Return to: Top
- Why am I having problems compiling the sample application in WIN32?
- Make sure you have the top "include" directory created and containing the SRM header files. See Compiling.
- Why am I having errors using my "make" in Unix?
- Check that you are using the proper "make". See Build Requirements.
- How do I get the release back to its pristine start condition?
- Run the "make distclean" command ("Build->Clean" in Win32) to remove the created subdirectories, as well as their contents.
- In Win32, I compiled "dynamic" and now I am trying to build "static" but I am getting some errors. What's wrong?
- Make sure you use the "Build->Rebuild All" command from the VC++ menu so that the older compilation files are rebuilt.
- In Win32, I am linking my own libraries or static application against the SDK and I get "unresolved references" errors. What's wrong?
- You may need to set some of the preprocessor definitions as explained in Using the Libraries.
Return to: Top
Return to: Top
For help, comments, and bug reports please send email to help@sedris.org. If you are an associate, please use se-coders@sedris.org.
Return to: Top
These links require Internet access.
- SRM at the SEDRIS Web Site
- SEDRIS (www.sedris.org)
- SEDRIS Technologies SDK Downloads
- SEDRIS Technologies Documents
- SEDRIS Tools
Return to: Top
Copyright © 2006 SEDRIS