Added msvc import/export scheme for fedex_plus generated code.

* Added IMPORTS/EXPORTS flags in data/CmakeLists.txt.
* Added EXPORT flags for fedex_plus generated code variables and functions.
This commit is contained in:
davyw committed 2011-12-12 14:59:59 +01:00
1 parent 737c53ef28
commit 80208dcdd6
2 files changed
+28 -5

No files matched your search

+12 -1
View File
@@ -63,6 +63,13 @@ FUNCTION(BUILD_A_SCHEMA SCHEMA_FILE)
WORKING_DIRECTORY ${SCHEMA_OUTPUT_DIR}
COMMENT "Running fedex_plus for ${SCHEMA_SHORT_NAME}..."
VERBATIM )
if(MSVC)
add_definitions( -DSCL_SCHEMA_DLL_EXPORTS )
add_definitions( -DSCL_EXPRESS_DLL_IMPORTS )
add_definitions( -DSCL_DAI_DLL_IMPORTS )
add_definitions( -DSCL_CORE_DLL_IMPORTS )
add_definitions( -DSCL_EDITOR_DLL_IMPORTS )
endif(MSVC)
add_library( ${PROJECT_NAME} SHARED ${FEDEX_OUT} )
target_link_libraries(${PROJECT_NAME} stepdai stepcore express stepeditor )
add_dependencies( ${PROJECT_NAME} generate_cpp_${SCHEMA_SHORT_NAME} )
@@ -85,7 +92,11 @@ FUNCTION(BUILD_A_SCHEMA SCHEMA_FILE)
set_tests_properties( generate_cpp_${SCHEMA_SHORT_NAME} PROPERTIES LABELS cpp_schema_gen )
set_tests_properties( build_cpp_${PROJECT_NAME} PROPERTIES DEPENDS generate_cpp_${SCHEMA_SHORT_NAME} LABELS cpp_schema_build )
add_executable( p21read_${PROJECT_NAME} ${SCL_SOURCE_DIR}/src/test/p21read/p21read.cc )
if(MSVC)
add_executable( p21read_${PROJECT_NAME} ${SCL_SOURCE_DIR}/src/test/p21read/p21read.cc ${SCL_SOURCE_DIR}/src/fedex_plus/xgetopt.cc )
else(MSVC)
add_executable( p21read_${PROJECT_NAME} ${SCL_SOURCE_DIR}/src/test/p21read/p21read.cc )
endif(MSVC)
add_dependencies( p21read_${PROJECT_NAME} version_string )
target_link_libraries( p21read_${PROJECT_NAME} ${PROJECT_NAME} )
set_target_properties( p21read_${PROJECT_NAME} PROPERTIES COMPILE_FLAGS
+16 -4
View File
@@ -30,8 +30,8 @@ N350 ( August 31, 1993 ) of ISO 10303 TC184/SC4/WG7.
void use_ref( Schema, Express, FILES * );
void create_builtin_type_decl( FILES * files, char * name ) {
fprintf( files->incall, "extern TypeDescriptor *%s%s_TYPE;\n",
TD_PREFIX, name );
fprintf( files->incall, "extern SCL_%s_EXPORT TypeDescriptor *%s%s_TYPE;\n",
"SCHEMA" TD_PREFIX, name );
}
void create_builtin_type_defn( FILES * files, char * name ) {
@@ -58,6 +58,18 @@ void print_file_header( Express express, FILES * files ) {
files -> incall = FILEcreate( "schema.h" );
fprintf( files->incall, "\n// in the fedex_plus source code, this file is generally referred to as files->incall or schemafile\n" );
fprintf( files->incall, "\n#ifndef SCL_%s_EXPORT\n", "SCHEMA" );
fprintf( files->incall, "# if defined(SCL_%s_DLL_EXPORTS) && defined(SCL_%s_DLL_IMPORTS)\n", "SCHEMA", "SCHEMA" );
fprintf( files->incall, "# error \"SCL_%s_DLL_EXPORTS or SCL_%s_DLL_IMPORTS can be defined, not both.\"\n", "SCHEMA", "SCHEMA" );
fprintf( files->incall, "# elif defined(SCL_%s_DLL_EXPORTS)\n", "SCHEMA" );
fprintf( files->incall, "# define SCL_%s_EXPORT __declspec(dllexport)\n", "SCHEMA" );
fprintf( files->incall, "# elif defined(SCL_%s_DLL_IMPORTS)\n", "SCHEMA" );
fprintf( files->incall, "# define SCL_%s_EXPORT __declspec(dllimport)\n", "SCHEMA" );
fprintf( files->incall, "# else\n" );
fprintf( files->incall, "# define SCL_%s_EXPORT\n", "SCHEMA" );
fprintf( files->incall, "# endif\n" );
fprintf( files->incall, "#endif\n\n" );
fprintf( files->incall, "#ifdef SCL_LOGGING\n" );
fprintf( files->incall, "#include <sys/time.h>\n" );
fprintf( files->incall, "#endif\n" );
@@ -71,8 +83,8 @@ void print_file_header( Express express, FILES * files ) {
fprintf( files->incall, "\n#include <Sdaiclasses.h>\n" );
fprintf( files->incall, "extern void SchemaInit (Registry &);\n" );
fprintf( files->incall, "extern void InitSchemasAndEnts (Registry &);\n" );
fprintf( files->incall, "extern SCL_%s_EXPORT void SchemaInit (Registry &);\n", "SCHEMA" );
fprintf( files->incall, "extern SCL_%s_EXPORT void InitSchemasAndEnts (Registry &);\n", "SCHEMA" );
files -> initall = FILEcreate( "schema.cc" );
fprintf( files->initall, "\n// in the fedex_plus source code, this file is generally referred to as files->initall or schemainit\n" );