Building Your Application

From DocR21

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 Microsoft Visual C++ .NET 2005 SP1 and Windows 64-bit Microsoft Visual C++ .NET 2008 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 NT_VC9_DLL(D) Compiler Flags for Windows 32-bit Visual C++ 2008
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 NT_VC9_64_DLL(D) Compiler Flags for Windows 64-bit Visual C++ 2008
IBM 32-bit VisualAge C++ 8.0 aix4_so(_debug) Compiler Flags for IBM 32-bit and 64-bit VisualAge C++ 8.0
IBM 64-bit* VisualAge C++ 8.0 aix4_64_so(_debug) Compiler Flags for IBM 32-bit and 64-bit VisualAge C++ 8.0
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/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) and Visual Studio .NET 9.0 (NT_VC9 and NT_VC9_64)

Note: The SPAha_bridge, SPAha_part, and admhoops DLLs shipped with ACIS were built with HOOPS version 17.0, arch nt_x64_vc80 (NT_AMD_64 with VC8.0), arch nt_i386_vc80 (NT_VC8 with VC8.0), arch nt_x64_vc90 (NT_VC9_64 with VC9.0), and arch nt_i386_vc90 (NT_VC9 with VC9.0).


  1. Open a command prompt window.
  2. Set environment variables:
    set A3DT to your ACIS installation: for example,
    SET A3DT=c:\Progra~1\Spatial\acisR20
    set HOOPS_INSTALL_DIR to your HOOPS installation directory, if applicable
  3. Open the project file:
    cd %A3DT%\scm\acis3dt
    devenv acis3dt_amd_64.sln (NT_AMD_64)
    devenv acis3dt_vc8.sln (NT_VC8)
    devenv acis3dt_vc9_64.sln (NT_AMD_64)
    devenv acis3dt_vc9.sln (NT_VC8)
  4. Choose one of the two available configurations: Release or Debug.
  5. Add optional ACIS products (if applicable)
    Open "Properties" for ACIS3DT
    Select C/C++ - Preprocessor; Add:
    ACIS_DM (for 3D ACIS Deformable Modeling)
    ACIS_PHLV5 (for 3D ACIS PHL V5)
  6. Add the corresponding library.
    Release configuration: Release Libraries
    (Spatial arches: NT_VC8_DLL, NT_AMD_64_DLL, NT_VC9_DLL, NT_VC9_64_DLL)
    For each of the following libraries, open "Properties" and change "Excluded from Build" to No.
    3D ACIS DM Release Lib
    3D ACIS PHL V5 Release Lib
    Debug configuration: Debug Libraries
    (Spatial arches: NT_VC8_DLLD, NT_AMD_64_DLLD, NT_VC9_DLL, NT_VC9_64_DLL)
    For each of the following libraries, open "Properties" and change "Excluded from Build" to No.
    3D ACIS DM Debug Lib
    3D ACIS PHL V5 Debug Lib
  7. Choose Build>Build acis3dt.exe

Note: Once you have completed this step and if there are unresolved symbols at link time, then Visual Studio has not recognized that the libraries were added. Save and close the solution file, reopen it and rebuild. This should resolve the link error.


Building on UNIX

Note: If you are relinking acis3dt against a HOOPS version other than 17.0, you must also rebuild the SpaHBridge and SpaHPart libraries using the projects/makefiles in src/ha_bridge and src/ha_part.


  1. Set environment variables:
    Set A3DT to your ACIS installation.
    Set ARCH to the architecture you would like to build, for example, aix4_so.
    Set HOOPS_INSTALL_DIR to the location of your HOOPS installation, if applicable.
    Set HOOPS_VER to the version of your HOOPS installation, if applicable.
  2. Change your directory.
    cd $A3DT/scm/acis3dt
  3. Build the executable.
    If not using a HOOPS installation:
    make TARGET=<target>
    If using a HOOPS installation:
    make –f makefile_hoops TARGET=<target>
    where <target> is one of the following:
    • ACIS - 3D ACIS Modeler
    • ACIS_DM - 3D ACIS Modeler and 3D ACIS Deformable Modeling
    • ACIS_PHLV5 - 3D ACIS Modeler and 3D ACIS PHL V5
    • ACIS_ALL - 3D ACIS Modeler, 3D ACIS Deformable Modeling and 3D ACIS PHL V5
  4. The executable (acis3dt) is created in $A3DT/bin/$ARCH.

Building on Macintosh

  1. Open the Xcode project file in <A3DT>:scm:acis3dt, where A3DT is your ACIS installation. The project contains targets that build slightly different configurations of the acis3dt application. The project supports two build styles, both of which work for each of the targets. The Development style builds with debug symbols on and optimization off. The Deployment style builds with debug symbols off and optimization level -O1. Upon opening the project for the first time, the active Build style is Development. The targets are:
    • acis3dt - 3D ACIS Modeler using ACIS release mode macub libraries
    • acis3dt_d - 3D ACIS Modeler using ACIS debug mode macub libraries
    • acis3dt_dm - 3D ACIS Modeler and 3D ACIS Deformable Modeling using ACIS release mode macub libraries
    • acis3dt_dm_d - 3D ACIS Modeler and 3D ACIS Deformable Modeling using ACIS debug mode macub libraries
    • acis3dt_phlv5 - 3D ACIS Modeler and 3D ACIS PHL V5 using ACIS release mode macub libraries
    • acis3dt_phlv5_d - 3D ACIS Modeler and 3D ACIS PHL V5 using ACIS debug mode macub libraries
    • acis3dt_all - 3D ACIS Modeler, 3D ACIS Deformable Modeling and 3D ACIS PHL V5 using ACIS release mode macub libraries
    • acis3dt_all_d - 3D ACIS Modeler, 3D ACIS Deformable Modeling and 3D ACIS PHL V5 using ACIS debug mode macub libraries
  2. Choose your desired build target from the Active Targets dropdown list.
  3. Update settings regarding your HOOPS installation, if applicable. These settings must be updated in both build styles.
    1. Highlight the active target under the Targets section in Groups & Files pane. Click the Info button in the main toolbar, or select File->Get Info.
    2. Select the Build pane.
    3. Select the desired configuration or select "All Configurations" from the Configuration drop down menu.
    4. Select "Edit>Change Existing Settings" and then change the two custom build settings HOOPS_INSTALL_DIR and HOOPS_VER.
    5. Using the Active Build Style drop down list, change the build configuration from Development to Deployment and repeat the previous two steps.
    6. Close the Info window.
  4. Select Build. Open the detailed build window (Build->Detailed Build Results) to view detailed build results, switch build style, or switch the active build target.
  5. The application bundle is placed in <A3DT>/scm/acis3dt/build, which is Xcode's default build location. To change the destination location:
    1. In the Groups & Files window, select the project icon at the top of the window (titled acis3dt).
    2. Select Info in the main toolbar, or select "File>Get Info".
    3. Select the General pane.
    4. Change the "Place Build Products In" setting to "Separate location" and enter your desired location.
  6. Note that three custom phases have been added to the Xcode build sequence to prepare the acis3dt bundle for runtime. Hence, additional disc space is occupied by the library copies.
    1. The libtool table of contents update discussed below is performed in a Shell Script phase.
    2. The HOOPS library is copied from $(HOOPS_INSTALL_DIR)/Dev_Tools/hoops_3dgs/lib to acis3dt*.app/Contents/MacOS.
    3. The ACIS dynamic libraries are copied from the ACIS bin directory to acis3dt*.app/Contents/MacOS.

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 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)

  1. Open a command prompt window.
  2. Set the following environment variables:
    set A3DT to your ACIS installation, for example, set A3DT=c:\Progra~1\Spatial\acisR20
    set HOOPS_INSTALL_DIR to your HOOPS installation directory>
  3. Open the desired project:
    cd %A3DT%\src\ha_bridge (or src\ha_part or src\admhoops) and then
    devenv ha_bridge_amd_64.sln (or ha_part_amd_64.sln or admhoops_amd_64.sln) (for NT_AMD_64) or
    devenv ha_bridge_vc8.sln (or ha_part_vc8.sln or admhoops_vc8.sln) (for NT_VC8)
  4. Choose one of these configurations:
    Release - Use with HOOPS version 10 or higher to link release ACIS to VC8.0 release HOOPS or
    Debug - Use with HOOPS version 10 or higher to link debug ACIS to VC8.0 debug HOOPS.
  5. Select from menu: Build>Build the library

Microsoft Visual C++ 9.0 (NT_VC9 and NT_VC9_64)

  1. Open a command prompt window.
  2. Set the following environment variables:
    set A3DT to your ACIS installation, for example, set A3DT=c:\Progra~1\Spatial\acisR20
    set HOOPS_INSTALL_DIR to your HOOPS installation directory>
  3. Open the desired project:
    cd %A3DT%\src\ha_bridge (or src\ha_part or src\admhoops) and then
    devenv ha_bridge_vc9_64.sln (or ha_part_vc9_64.sln or admhoops_vc9_64.sln) (for NT_VC9_64) or
    devenv ha_bridge_vc9.sln (or ha_part_vc9.sln or admhoops_vc9.sln) (for NT_VC9)
  4. Choose one of these configurations:
    Release - Use with HOOPS version 10 or higher to link release ACIS to VC9.0 release HOOPS or
    Debug - Use with HOOPS version 10 or higher to link debug ACIS to VC9.0 debug HOOPS.
  5. Select from menu: Build>Build the library

Building the SpaHPart, SpaHBridge, and admhoops Libraries on UNIX

  1. Set the following environment variables:
    set A3DT to your ACIS installation
    set ARCH to the ACIS architecture you would like to build against
    set HOOPS_INSTALL_DIR to the location of your HOOPS installation
    set HOOPS_VER to the version of your HOOPS installation.
  2. Change your working directory:
    cd $A3DT/src/ha_bridge (or src/ha_part or src/admhoops)
  3. Build the library:
    make arch;
    where arch is one of the following: aix, aix64, linux, or linux_amd_64.

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

  1. Open the desired Xcode project in A3DT/src/ha_bridge (or src/ha_part or src/admhoops), where A3DT is your ACIS installation location.
  2. Update the settings regarding your HOOPS installation.
    1. In the Groups & Files window, expand the Target Category and select the target (ha_bridge, ha_part or admhoops).
    2. Click the Info Button in the main toolbar, or select File>Get Info.
    3. Select the Build pane.
    4. Scroll down through the settings to the two custom build settings HOOPS_INSTALL_DIR and HOOPS_VER.
    5. Select Edit Setting for each one and enter the appropriate value.
  3. Click Build on the main window. The library is placed in A3DT/src/ha_bridge/build, which is Xcode's default build location. To change the destination location:
    1. In the Groups & Files window, select the project icon at the top of the window (titled ha_bridge, ha_part, or admhoops).
    2. Click the Info Button in the main toolbar, or select File>Get Info.
    3. Select the General pane.
    4. Change the "Place Build Products In" setting to "Separate location" and enter your desired location.
      Note: The project supports two build styles, both of which link against ACIS release libraries and the HOOPS release library. The Development style builds with debug symbols on and optimization off. The Deployment style builds with debug symbols off and optimization level -O1.
    5. Upon opening the project for the first time, the active Build Style is Development. To switch the style:
      1. Open the build results window by selecting Build>Detailed Build Results.
      2. Select Deployment from the Active Build Style drop down list.

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:
    Image: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.
    Image: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.Image: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:
      Image: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
    Image: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 libraries in the "Additional Dependencies" field: SPAAcis.lib SpaLicErrGUI.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"
#include "spa_lic_err_gui.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 add entities
	ENTITY_LIST entityList;
 
// Create Sphere //
	BODY* sphere = NULL;
	api_solid_sphere(SPAposition(30, 30, 30), 10, sphere,NULL);
	entityList.add(sphere);
 
// Create sat File //
create_sat_file (entityList, "MyFirstAcisProject.sat");
// End SAMPLE
Personal tools
Live