Skip to content

Commit 2daec0e

Browse files
committed
Merge pull request #211 from stepcode/review/build-additional-sdai-executables
build additional sdai executables
2 parents 1cac60a + 69f280e commit 2daec0e

File tree

8 files changed

+57
-25
lines changed

8 files changed

+57
-25
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ OPTION_WITH_DEFAULT(SCL_CPP_GENERATOR "Compile fedex_plus" ON)
8585
OPTION_WITH_DEFAULT(SCL_MEMMGR_ENABLE_CHECKS "Enable scl_memmgr's memory leak detection" OFF)
8686
OPTION_WITH_DEFAULT(SCL_TRACE_FPRINTF "Enable extra comments in generated code so the code's source in fedex_plus may be located" OFF)
8787

88+
if(NOT DEFINED SC_SDAI_ADDITIONAL_EXES_SRCS )
89+
set( SC_SDAI_ADDITIONAL_EXES_SRCS "" CACHE STRING "Source files for additional executables to be linked with SDAI libs" )
90+
endif(NOT DEFINED SC_SDAI_ADDITIONAL_EXES_SRCS )
91+
8892
#this makes SCL_BUILD_SCHEMAS show up in cmake-gui
8993
if( NOT DEFINED SCL_BUILD_SCHEMAS )
9094
SET(SCL_BUILD_SCHEMAS "ALL" CACHE string "Semicolon-separated list of paths to EXPRESS schemas to be built" )

data/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,16 @@ FUNCTION(BUILD_A_SCHEMA SCHEMA_FILE)
9292
set_target_properties( p21read_${PROJECT_NAME} PROPERTIES COMPILE_FLAGS
9393
${${PROJECT_NAME}_COMPILE_FLAGS} )
9494

95+
#add user-defined executables
96+
foreach( src ${SC_SDAI_ADDITIONAL_EXES_SRCS} )
97+
get_filename_component( name ${src} NAME_WE )
98+
get_filename_component( path ${src} ABSOLUTE )
99+
SCL_ADDEXEC( ${name}_${PROJECT_NAME} "${src}" "${PROJECT_NAME} base" "TESTABLE" )
100+
add_dependencies( ${name}_${PROJECT_NAME} version_string )
101+
set_target_properties( ${name}_${PROJECT_NAME} PROPERTIES COMPILE_FLAGS
102+
"${${PROJECT_NAME}_COMPILE_FLAGS} -I${path}" )
103+
endforeach( src ${SC_SDAI_ADDITIONAL_EXES_SRCS} )
104+
95105
#find all part 21 files in schema dir, add a test for each one
96106
get_filename_component( SCHEMA_DIR ${SCHEMA_FILE} PATH )
97107
file( GLOB_RECURSE P21_FILES ${SCHEMA_DIR}/*.stp ${SCHEMA_DIR}/*.step ${SCHEMA_DIR}/*.p21 ${SCHEMA_DIR}/*.ifc )
@@ -108,6 +118,11 @@ ENDFUNCTION(BUILD_A_SCHEMA)
108118
#----------------------------------------------------------------------------------------------------
109119

110120
if( DEFINED SCL_BUILD_SCHEMAS )
121+
foreach( src ${SC_SDAI_ADDITIONAL_EXES_SRCS} )
122+
get_filename_component( name ${src} NAME_WE )
123+
message( STATUS "Additional SDAI executable: ${name}" )
124+
endforeach( src ${SC_SDAI_ADDITIONAL_EXES_SRCS} )
125+
111126
if( SCL_BUILD_SCHEMAS STREQUAL "ALL" )
112127
file( GLOB_RECURSE SCL_BUILD_SCHEMAS ${SCL_SOURCE_DIR}/data/*.exp )
113128
endif()

src/test/generate_express/generate_express.cc

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
init function, we don't need to include the schema's header file inside
99
tests.h */
1010
#define DONT_NEED_HEADER
11-
#include <tests.h>
11+
#include "../tests.h"
12+
13+
/* STEPentity* Iterator class definition */
14+
#include "../SEarritr.h"
1215

1316
/******************** main() ****************************/
1417

@@ -50,15 +53,17 @@ main() {
5053
registry->AddEntity( *ent );
5154
#endif
5255
schema = ( SchemaDescriptor * )registry->FindSchema( "Example_Schema" );
53-
EntityDescriptor * ed = ( EntityDescriptor * )registry->FindEntity( "Circle" );
54-
Uniqueness_rule_ptr ur = new Uniqueness_rule;
55-
ur->comment_( "(* Hi Dave *)\n" );
56-
if( ed->_uniqueness_rules ) {
57-
ed->_uniqueness_rules->Append( ur );
58-
} else {
59-
// Uniqueness_rule__set_var ursv = new Uniqueness_rule__set;
60-
ed->uniqueness_rules_( new Uniqueness_rule__set );
61-
ed->_uniqueness_rules->Append( ur );
56+
if( schema ) { //adds a comment, but only to one entity of one schema
57+
EntityDescriptor * ed = ( EntityDescriptor * )registry->FindEntity( "Circle" );
58+
Uniqueness_rule_ptr ur = new Uniqueness_rule;
59+
ur->comment_( "(* Hi Dave *)\n" );
60+
if( ed->_uniqueness_rules ) {
61+
ed->_uniqueness_rules->Append( ur );
62+
} else {
63+
// Uniqueness_rule__set_var ursv = new Uniqueness_rule__set;
64+
ed->uniqueness_rules_( new Uniqueness_rule__set );
65+
ed->_uniqueness_rules->Append( ur );
66+
}
6267
}
6368

6469
registry->ResetSchemas();
@@ -69,8 +74,8 @@ main() {
6974
while( schema != 0 ) {
7075
// str = "new";
7176
str = "";
72-
str.Append( StrToLower( schema->Name(), tmp ) );
73-
str.Append( ".exp" );
77+
str.append( StrToLower( schema->Name(), tmp ) );
78+
str.append( ".exp" );
7479
efile = new ofstream( str.c_str() );
7580
cout << "Generating: " << str << endl;
7681
schema->GenerateExpress( *efile );

src/test/scl2html/scl2html.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
function, we don't need to include the schema's header file inside
3030
tests.h */
3131
#define DONT_NEED_HEADER
32-
#include <tests.h>
32+
#include "../tests.h"
33+
34+
/* STEPentity* Iterator class definition */
35+
#include "../SEarritr.h"
3336

3437
// PrintAttrTypeWithAnchor()
3538
// Given an atribute, print out its immediate type (not fundamental).
@@ -115,7 +118,7 @@ int PrintAttrsHTML( const EntityDescriptor * ent, ofstream & outhtml ) {
115118
while( attrDesc != 0 ) {
116119
attrCount++;
117120
outhtml << "<LI>" << attrDesc->Name() << " : ";
118-
if( ( SDAI_Logical )( attrDesc->Optional() ) == SCLLOG( LTrue ) ) {
121+
if( ( attrDesc->Optional() ) == SDAI_LOGICAL( LTrue ) ) {
119122
outhtml << "optional ";
120123
}
121124
PrintAttrTypeWithAnchor( attrDesc->ReferentType(), outhtml );

src/test/tests.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,3 @@
3232
#include <needFunc.h>
3333

3434
extern void SchemaInit( Registry & );
35-
36-
/* STEPentity* Iterator class definition */
37-
#include <SEarritr.h>

src/test/tio/tio.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616

1717
/* A switch for tests.h, because we don't need to schema header file */
1818
#define DONT_NEED_HEADER
19-
#include "tests.h"
19+
#include "../tests.h"
20+
21+
/* STEPentity* Iterator class definition */
22+
#include "../SEarritr.h"
2023

2124
int main( int argc, char * argv[] ) {
2225
int using_outfile = 0;

src/test/treg/treg.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020

2121
/* A switch for tests.h, because we don't need to schema header file */
2222
#define DONT_NEED_HEADER
23-
#include "tests.h"
23+
#include "../tests.h"
2424

25+
/* STEPentity* Iterator class definition */
26+
#include "../SEarritr.h"
2527

2628
// This function, given a pointer to an entity, will populate it, that is,
2729
// put data values in its attributes. PopulateEntity doesn't care what

src/test/tstatic/tstatic.cc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@
1212
*
1313
*/
1414

15-
#include "tests.h"
15+
#include "../tests.h"
1616

17-
main() {
17+
/* STEPentity* Iterator class definition */
18+
#include "../SEarritr.h"
19+
20+
int main() {
1821
// This has to be done before anything else. This initializes
1922
// all of the registry information for the schema you are using.
2023
// The SchemaInit() function is generated by fedex_plus... see
@@ -39,7 +42,7 @@ main() {
3942
rect.height_( 5 );
4043
rect.width_( 10 );
4144
cout << "Rectangle: (" << rect.opcode() << ") " << endl;
42-
cout << " Name: " << rect.item_name_() << endl;
45+
cout << " Name: " << rect.item_name_().c_str() << endl;
4346
cout << " Color: " << rect.item_color_() << endl;
4447
cout << " Sides: " << rect.number_of_sides_() << endl;
4548
cout << " Height: " << rect.height_() << endl;
@@ -55,7 +58,7 @@ main() {
5558
square.height_( 3 );
5659
square.width_( 3 );
5760
cout << "Square: (" << square.opcode() << ") " << endl;
58-
cout << " Name: " << square.item_name_() << endl;
61+
cout << " Name: " << square.item_name_().c_str() << endl;
5962
cout << " Color: " << square.item_color_() << endl;
6063
cout << " Sides: " << square.number_of_sides_() << endl;
6164
cout << " Height: " << square.height_() << endl;
@@ -72,7 +75,7 @@ main() {
7275
tri.side2_length_( 4 );
7376
tri.side3_length_( 5 );
7477
cout << "Triangle: (" << tri.opcode() << ") " << endl;
75-
cout << " Name: " << tri.item_name_() << endl;
78+
cout << " Name: " << tri.item_name_().c_str() << endl;
7679
cout << " Color: " << tri.item_color_() << endl;
7780
cout << " Sides: " << tri.number_of_sides_() << endl;
7881
cout << " Side 1: " << tri.side1_length_() << endl;
@@ -88,7 +91,7 @@ main() {
8891
circ.number_of_sides_( 1 );
8992
circ.radius_( 15 );
9093
cout << "Circle: (" << circ.opcode() << ") " << endl;
91-
cout << " Name: " << circ.item_name_() << endl;
94+
cout << " Name: " << circ.item_name_().c_str() << endl;
9295
cout << " Color: " << circ.item_color_() << endl;
9396
cout << " Sides: " << circ.number_of_sides_() << endl;
9497
cout << " Radius: " << circ.radius_() << endl;

0 commit comments

Comments
 (0)