Skip to content

Commit

Permalink
ISSUE #695 updated bouncer to use the submodule svg exporter version
Browse files Browse the repository at this point in the history
  • Loading branch information
sebjf committed Sep 23, 2024
1 parent 5cca415 commit 6d34e17
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ option (REPO_BUILD_TOOLS "If the Command Line Tool is built in addition to the l
option (REPO_BUILD_TESTS "If the test suite for the core bouncer logic is built in addition to the library" OFF)
option (REPO_NO_GZIP "If zlib is not compiled into boost" OFF)
option (REPO_ASSET_GENERATOR_SUPPORT "If the AssetGenerator is present and compiled into the library" ON)
option (REPO_SVG_EXPORT_SUPPORT "If the customised Svg Exporter is present and compiled into the library" ON)


#Build IFCUtils
Expand All @@ -165,6 +166,11 @@ if (REPO_ASSET_GENERATOR_SUPPORT)
add_subdirectory(submodules/asset_generator)
endif()

if (REPO_SVG_EXPORT_SUPPORT)
add_definitions(-DREPO_SVG_EXPORT_SUPPORT)
add_subdirectory(submodules/svgexport)
endif()

#bouncer library
add_subdirectory(bouncer)

Expand Down
37 changes: 34 additions & 3 deletions bouncer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,46 @@ add_subdirectory(src)
set(VERSION_MAJOR 5)
set(VERSION_MINOR 11_3)

include_directories(${Boost_INCLUDE_DIRS} ${MONGO_INCLUDE_DIR} ${ASSIMP_INCLUDE_DIR} ${OCCT_INCLUDE_DIR} ${IFCOPENSHELL_INCLUDE_DIR} ${ODA_INCLUDE_DIR} ${SYNCHRO_READER_INCLUDE_DIR} ${AWSSDK_INCLUDE_DIR} ${CRYPTOLENS_INCLUDE_DIR} src ../)
include_directories(
${Boost_INCLUDE_DIRS}
${MONGO_INCLUDE_DIR}
${ASSIMP_INCLUDE_DIR}
${OCCT_INCLUDE_DIR}
${IFCOPENSHELL_INCLUDE_DIR}
${ODA_INCLUDE_DIR}
${SYNCHRO_READER_INCLUDE_DIR}
${AWSSDK_INCLUDE_DIR}
${CRYPTOLENS_INCLUDE_DIR}
src ../
)
add_definitions(-DREPO_API_LIBRARY)

add_library(3drepobouncer SHARED ${SOURCES})
set_target_properties(3drepobouncer PROPERTIES RELEASE_POSTFIX "_${VERSION_MAJOR}_${VERSION_MINOR}")
set_target_properties(3drepobouncer PROPERTIES DEBUG_POSTFIX "_${VERSION_MAJOR}_${VERSION_MINOR}_d")

target_link_libraries(3drepobouncer ${Boost_LIBRARIES} ${MONGO_LIBRARIES} ${ASSIMP_LIBRARIES} ${OCCT_LIBRARIES} ${IFCOPENSHELL_PARSERLIB} ${IFCOPENSHELL_GEOMLIB} ${ODA_LIB} ${SYNCHRO_READER_LIBRARIES} ${THRIFT_LIBRARIES} ${ZLIB_LIBRARIES} ${SYNCHRO_LIBRARIES} ${AWSSDK_LIBRARIES} ${CRYPTOLENS_LIBRARIES} ifcUtils_2x3 ifcUtils_4)

target_link_libraries(3drepobouncer
${Boost_LIBRARIES}
${MONGO_LIBRARIES}
${ASSIMP_LIBRARIES}
${OCCT_LIBRARIES}
${IFCOPENSHELL_PARSERLIB}
${IFCOPENSHELL_GEOMLIB}
${ODA_LIB}
${SYNCHRO_READER_LIBRARIES}
${THRIFT_LIBRARIES}
${ZLIB_LIBRARIES}
${SYNCHRO_LIBRARIES}
${AWSSDK_LIBRARIES}
${CRYPTOLENS_LIBRARIES}
ifcUtils_2x3
ifcUtils_4
)

if(REPO_SVG_EXPORT_SUPPORT)
include_directories(${SVG_EXPORT_INCLUDE_DIR})
target_link_libraries(3drepobouncer SvgExport)
endif()

install(DIRECTORY src/ DESTINATION include FILES_MATCHING PATTERN "*.h")
install(TARGETS 3drepobouncer DESTINATION lib)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ void FileProcessorDwg::importModel(OdDbDatabasePtr pDb)

void FileProcessorDwg::importDrawing(OdDbDatabasePtr pDb)
{
OdGsModulePtr pModule = ::odrxDynamicLinker()->loadModule(OdSvgExportModuleName, false);
// SvgExport is the name of the 3DRepo variant of the SVG exporter module.
// The actual module name searched for will have an SDK and compiler version
// suffix, depending on platform. This is handled by CMake.

OdGsModulePtr pModule = ::odrxDynamicLinker()->loadModule("SvgExport", false);
OdGsDevicePtr dev = pModule->createDevice();
if (!dev.isNull())
{
Expand All @@ -135,6 +139,7 @@ void FileProcessorDwg::importDrawing(OdDbDatabasePtr pDb)
pDbGiContext->setHatchAsPolygon(OdGiDefaultContext::kHatchPolygon);
dev->properties()->putAt(L"MinimalWidth", OdRxVariantValue(0.08));
dev->properties()->putAt(L"UseHLR", OdRxVariantValue(true));
dev->properties()->putAt(L"ColorPolicy", OdRxVariantValue((OdInt32)2)); // kGrayscale
pDbGiContext->setPaletteBackground(ODRGB(255, 255, 255));

OdDbBaseDatabasePEPtr pBaseDatabase(pDb);
Expand Down
13 changes: 13 additions & 0 deletions cmake_modules/FindODA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,19 @@ if(DEFINED ENV{ODA_ROOT})
message(STATUS "ODA_LIBRARIES: ${ODA_LIB}")
endif()

# When running on Windows, ODA will attempt to append a suffix to dynamically
# loaded modules. Try to find out what this, so we can ensure our own modules
# match. This suffix is not applied on *nix.

if(MSVC)
if(DEFINED ENV{ODA_VERSION})
set(ODA_VERSION $ENV{ODA_VERSION})
message(STATUS "ODA_VERSION: ${ODA_VERSION}")
else()
message(FATAL_ERROR "When building for Windows, the Environment Variable ODA_VERSION must be defined with the SDK and compiler version, e.g. ""24.8_14"". Look at the suffixes in the exe folder to see what this should be. This is not necessary on Linux.")
endif()
endif()


if(ODA_INCLUDE_DIR AND ODA_LIB)
set(ODA_FOUND TRUE)
Expand Down

0 comments on commit 6d34e17

Please sign in to comment.