#!/bin/sh # # parasolid_link.com # # Compiles the file "$PARASOLID/evaluation_test.c", links it with # $PARASOLID/pskernel_archive.lib, $PARASOLID/frustrum.lib and # $PARASOLID/fg.lib then creates the executable "evaluation_test.exe" # on the current directory. # ( $PARASOLID is an environment variable which points ) # ( the top directory containing the Parasolid release. ) # # To compile and link small-scale C programs of your own against # Parasolid, make a modified version of this script substituting # your own .c file(s) for $PARASOLID/evaluation_test.c. # # This file is sample code, provided as an example of building # a Parasolid-based program. # CCOPTIONS="" LINKOPTIONS="" P_CC="/usr/bin/gcc" P_LINK_CC="/usr/bin/g++" is_android=0 PARASOLID="/mnt/d/download/parasolid/Parasolid_Installer_v350_rv1000/parasolid/intel_linux/base" PROJECT_DIR="/mnt/e/CProj/ParasolidDemo2/file/file" case "$PARASOLID" in *anda*|*arm_android*|*android*) is_android=1 clangpath=$(type -p clang) if [ "$clangpath" = "" ] then echo "Building libraries/tests for Android needs an NDK clang on your" echo "PATH, and this needs to be the appropriate one for the arm64-v8a" echo "ABI. Setting up an appropriate standalone toolchain is recommended." exit 1 fi adbpath=$(type -p adb) if [ "$adbpath" = "" ] then echo "Running these tests for Android needs ADB on your PATH." exit 1 fi echo "111" P_CC="clang" P_LINK_CC="clang++" CCOPTIONS="-fPIC -fexceptions --target=aarch64-linux-android24" echo "Linking will need path to find the C++ runtime library" LINKOPTIONS="-pie -Wl,--hash-style=both -L$PARASOLID/.." andir="/data/local/tmp" ;; *) echo "222111" P_CC="/usr/bin/gcc" P_LINK_CC="/usr/bin/g++" echo "Ensure cc version 7: P_CC=$P_CC, P_LINK_CC=$P_LINK_CC" # CCOPTIONS="-m64 -w -fPIC" LINKOPTIONS="-lpthread" ;; esac # echo "222222" # P_CC="/usr/bin/gcc" # P_LINK_CC="/usr/bin/g++" # echo "Ensure cc version 7: P_CC=$P_CC, P_LINK_CC=$P_LINK_CC" # CCOPTIONS="-m64 -w -fPIC" # LINKOPTIONS="-lpthread" echo 'Compiling the evaluation_test.cpp file.' $P_CC $CCOPTIONS -c "$PROJECT_DIR/evaluation_test.cpp" -o ./evaluation_test.o $P_LINK_CC $CCOPTIONS -I"$PARASOLID" \ ./evaluation_test.o \ "$PARASOLID/frustrum.lib" \ "$PARASOLID/fg.lib" \ "$PARASOLID/pskernel_archive.lib" \ -lm $LINKOPTIONS \ -o ./evaluation_test.exe rm -f ./evaluation_test.o chmod a+rx ./evaluation_test.exe if [ "$is_android" = "1" ] then echo "" echo "To run the Parasolid tests, use these commands:" echo "" echo "adb push ./evaluation_test.exe $andir" echo "adb shell \"cd $andir ; ./evaluation_test.exe\"" echo "" echo "The following warning is harmless, if it occurs:" echo "WARNING: linker: ./evaluation_test.exe: unused DT entry..." echo "" echo "$andir is normally a directory where you can" echo "write files that are not part of an Android app." echo "You can clean up the files created by the test with:" echo "" echo "adb shell \"cd $andir ; rm jfile* sfile* xfile*\"" echo "adb shell \"cd $andir ; rm evaluation_test.exe\"" echo "" else echo 'To run the tests type ./evaluation_test.exe' fi