Building Your Application

From DocR22

Jump to: navigation, search

This section provides details about compiler flags and preprocessor directives used for successfully building an ACIS-based application on supported platforms. Also listed are the linker flags and system libraries used when linking the ACIS shared libraries.

To see examples of how Scheme AIDE is linked against the ACIS libraries, refer to the makefiles and projects provided in scm/acis3dt. If you are rebuilding the Scheme AIDE source code, refer to the required defines listed near the end of each table for recompiling the Scheme AIDE toolkit code and extensions.

Contents

Compiler Flags and Preprocessor Directives

You need to use the compiler flags and preprocessor directives for building each ACIS or InterOp ARCH. While a few of the settings listed may not be required for building customer applications, you are strongly recommended to use the listed settings or at least verify them when having compilation problems. The linker flags and system libraries used when linking the ACIS or InterOp shared libraries are provided below as well as compiler flags and preprocessor directives.

Note: Windows 64-bit platforms are supported on InterOp. All other 64-bit versions of operating systems listed are not supported on InterOp.

Platform Compiler ARCH Release(Debug) Flags and Directives
Windows 32-bit Microsoft Visual C++ 2005 SP1 NT_VC8_DLL(D) Compiler Flags for Windows 32-bit Visual C++ 2005 SP1
Windows 32-bit Microsoft Visual C++ 2008 SP1 NT_VC9_DLL(D) Compiler Flags for Windows 32-bit Visual C++ 2008 SP1
Windows 32-bit Microsoft Visual C++ 2010 NT_VC10_DLL(D) Compiler Flags for Windows 32-bit Visual C++ 2010
Windows 64-bit Microsoft Visual C++ 2005 SP1 NT_AMD_64_DLL(D) Compiler Flags for Windows 64-bit Visual C++ 2005 SP1
Windows 64-bit Microsoft Visual C++ 2008 SP1 NT_VC9_64_DLL(D) Compiler Flags for Windows 64-bit Visual C++ 2008 SP1
Windows 64-bit Microsoft Visual C++ 2010 NT_VC10_64_DLL(D) Compiler Flags for Windows 64-bit Visual C++ 2010
IBM 32-bit VisualAge C++ 10.1 aix4_so(_debug) Compiler Flags for IBM 32-bit and 64-bit VisualAge C++ 10.1
IBM 64-bit* VisualAge C++ 10.1 aix4_64_so(_debug) Compiler Flags for IBM 32-bit and 64-bit VisualAge C++ 10.1
Linux 32-bit GNU C++ gcc 4.1.2 linux_so(_debug) Compiler Flags for Linux 32-bit GNU C++ gcc 4.1.2
Linux 64-bit GNU C++ gcc 4.1.2 linux_amd_64_so(_debug) Compiler Flags for Linux 64-bit GNU C++ gcc 4.1.2
Macintosh 32-bit GNU C++ gcc 4.0.1 and Xcode 2.3 maci386(_debug) Compiler Flags for Macintosh 32-bit GNU C++ gcc 4.0.1 and Xcode 2.3

* Not supported on InterOp.


Building the ACIS Scheme AIDE Program

In order for you to see how to write and build an ACIS-based application, all source, projects, and makefiles for building the Scheme AIDE program on every platform have been distributed with your ACIS package.

For all platforms on which HOOPS is supported, you may either link using the HOOPS library delivered with ACIS or using a HOOPS installation. Note that if you are relinking acis3dt against a HOOPS version other than the version included with your ACIS installation, you must also rebuild the SpaHBridge and SpaHPart libraries using the projects or makefiles in src/ha_bridge and src/ha_part.

Note: In order to rebuild the Spatial samples, you must add your license to the sample source code. The sample source file unlock_license.cpp contains a function unlock_license which is called by every sample at start-up. Modify this file to call your application license function.


Building on Windows

Visual Studio .NET 8.0 (NT_VC8 and NT_AMD_64), Visual Studio .NET 9.0 (NT_VC9 and NT_VC9_64), and Visual Studio .NET 10.0 (NT_VC10 and NT_VC10_64)

Building on UNIX

Building on Macintosh

Notes Regarding Building and Using ACIS Scheme AIDE Program on Macintosh

ACIS Dynamic Libraries

ACIS dynamic libraries must be present in an application bundle's executable directory at runtime. Rather than installing an extra copy of the ACIS dynamic libraries inside the acis3dt application shipped with ACIS, your ACIS package supplies a script that creates relative links inside the acis3dt bundle pointing to each dynamic library in the bin/$ARCH directory. You must run this script before acis3dt can execute.

After installing ACIS, open a terminal window.

cd $A3DT/bin/macub ./RUNFIRST.sh.

where $A3DT is the location of your ACIS installation.

Scheme Initialization File

Note that the Scheme initialization file, acisinit.scm, is not automatically loaded by the Scheme AIDE program. This file defines some commonly used scheme procedures, such as zoom-all. On other platforms, Scheme AIDE looks for the file in either a path relative to the executable's location or a path relative to the current working directory. When running an application from the Finder on Mac OSX, neither of these options works.

To load the file, type the following command at the Scheme prompt:

(load "$A3DT/scm/examples/acisinit.scm")

where $A3DT is your ACIS installation.

Loading acisinit.scm

For the default toolkit applications that are provided with product installation, the acisinit.scm does not load automatically as it does on other platforms. The file, acisinit.scm is found in $A3DT/scm/examples/acisinit.scm, where $A3DT is the installation directory. You may load it after starting a Scheme session by using the command:

load "<path the ACIS>/scm/examples/acisinit.scm"

Scheme Static Libraries

Prior to use, all static libraries must have their table of contents updated once using libtool. The libtool emits an error when linking the executable if the table of contents of an included static library is older than the library's creation date. This error occurs if the library has been copied without retaining its original creation date, although the table of contents of the library is not actually out of date. The acis3dt.xcode sample project performs this step during the build, after which the libraries can be linked into any application.

To link the static libraries into your application without running the acis3dt.xcode sample project, you must perform this step manually:

for mylib in $A3DT/lib/$ARCH/*.a 
do
    libtool -static -o $mylib $mylib 
done

where $A3DT is your ACIS installation and $ARCH is either macub or macub_debug.

Building the HOOPS/ACIS Bridge

ACIS ships projects and makefiles on all platforms for rebuilding the HOOPS/ACIS Bridge and ACIS Deformable Modeling HOOPS. This section discusses how to build the bridge.

Note: In order to rebuild the Spatial samples, you must add your license to the sample source code. The sample source file unlock_license.cpp contains a function unlock_license which is called by every sample at startup. Modify this file to call your application license function.


HOOPS/ACIS Bridge Projects and Makefiles

The HOOPS/ACIS Bridge libraries shipped with ACIS are linked against HOOPS 17.0. The source code for the HOOPS/ACIS Bridge is shipped with ACIS so that you may:

  • View how the HOOPS/ACIS bridge is implemented.
  • Link against various versions of HOOPS other than version 17.0.
  • Customize the source code for other purposes as needed.

Projects and makefiles for rebuilding the two libraries in the bridge, SpaHPart and SpaHBridge, are included in the src/ha_bridge and src/ha_part directories. For those using ACIS Deformable Modeling, Spatial includes an additional set of projects for rebuilding the admhoops library in src/admhoops.

WARNING:If you are building a custom version of the HOOPS/ACIS Bridge, you must perform a rebuild when a new service pack is installed. This requirement results from the service pack's need to reinstall libraries linked against HOOPS 17.0 and to ensure that functionality changes in the bridge source code are incorporated into your bridge libraries.

If you have used these projects in previous releases, you must note that the projects have been changed to support different versions of HOOPS. Thus, UNIX makefiles now require that the environmental variable, HOOPS_VER, be set.

Building the SpaHPart, SpaHBridge, and admhoops Libraries on Windows

Microsoft Visual C++ 8.0 SP1 (NT_VC8 and NT_AMD_64)

Microsoft Visual C++ 9.0 SP1 (NT_VC9 and NT_VC9_64)

Microsoft Visual C++ 10.0 (NT_VC10 and NT_VC10_64)

Building the SpaHPart, SpaHBridge, and admhoops Libraries on UNIX

Building the SpaHPart, SpaHBridge, and admhoops Libraries on Mac OS X

Building as a Standalone Application

  1. Create a batch file which sets the following environment variables: A3DT, ARCH, and PATH. An example of such a batch file is shown below:
    BuildingStandAlone01.jpg
  2. Choose from the two options below
    Option 1:
    1. Open the Visual Studio 2005 Command Prompt window by selecting: Start>All Programs>Microsoft Visual Studio 2005>Visual Studio Tools>Visual Studio 2005 Command Prompt.
    2. Drop the batch file created in the previous step into the command window and select Enter.
    BuildingStandAlone02.jpg
    Option 2:
    1. Add the following line to the batch file created in Step 1: C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat. An example of such a batch file is shown below and follow the next steps.
      BuildingStandAlone03.jpg
    2. Select Start in the lower left corner of your screen.
    3. Select Run; this opens a new Run window:
    4. Type cmd in the window as shown below:
      BuildingStandAlone04.jpg
    5. Drag and drop the batch file created using the above steps in the newly launched command window.
    6. Choose Enter. This runs the batch file and sets the required paths needed to build an ACIS-based console application.
    7. Type devenv in the command window.
  3. Select File>New>Project or enter Ctrl+Shift+N
  4. Select Win32 from the Visual C++ Option and Win32 Console Application from Templates; enter an appropriate name and location, and then select OK. This creates a stock project: for example, MyfirstAcisProject
    BuildingStandAlone05.jpg
  5. The Win32 Application Wizard pops up; select Next.
  6. From the menu Application Settings > Application, select "Console application". From Additional options, select "Empty project". Finally, select Finish.
  7. Under Project, select Add New Item….
    1. In the Add New Item window, select Code for the category.
    2. Choose C++ file (.cpp) as the template to use. Provide the desired name and location.
    3. Select Add.
  8. Next, setup the project settings. Open the Property Pages by selecting the project name under the Solution Explorer. Enter Alt-F7 or right click and select "Properties". The following image is a sample Project Properties screen. Note: Make certain that this is the properties screen for the project and not an item in the project.
  9. Now expand the Configuration Properties and select C/C++ from the resulting list.
  10. Select the Configuration Manager button and set the Active Solution configuration as follows and then select Close.
    • Release (if ARCH=NT_VC8_DLL)
    • Debug (if ARCH=NT_VC8_DLLD)
  11. Expand the C/C++ list and select General and enter $(A3DT)/include in the "Additional Include Directories" field.
  12. Next select the "Preprocessor" option from the C/C++ tree and append NT_VC8_DLL (or NT_VC8_DLLD), ACIS_DLL, SPA_NO_AUTO_LINK.
  13. Expand the "linker" tree and select the General option and enter $(A3DT)/lib/$(ARCH) in the "Additional Library Directories" field.
  14. Next select the Input option and enter the following library in the "Additional Dependencies" field: SPAAcis.lib.
  15. Select Apply, then OK.
  16. Copy the code sample below into the CPP file.
  17. Select Build/Rebuild Solution (Ctrl+Alt+F7) .
  18. Your program is ready to use. Make certain to add the license key to begin making calls to the ACIS functions.

Code to Copy into CPP File

Licensing Headers

The following code is the licensing header and sample ACIS calls.

#include "license.hxx"
#include "spa_unlock_result.hxx"

Sample ACIS calls to create a sphere and then to write it into a SAT file:

#include "position.hxx" 
#include "body.hxx"
#include "cstrapi.hxx"
 
// SAMPLE
 
    // Create an Entity List to contain entities to be saved.
    ENTITY_LIST entityList;
 
    // Create a Sphere.
    BODY* sphere = NULL;
    api_solid_sphere(SPAposition(30, 30, 30), 10, sphere, NULL);
    entityList.add(sphere);
 
    // Create a SAT File.
    create_sat_file (entityList, "MyFirstAcisProject.sat");
 
// End SAMPLE
Personal tools