@@ -147,6 +147,7 @@ option(WITH_3DMOUSE "Support for 3DConnexion Space Mouse" OFF)
147147option (WITH_TSDF "Complie with TSDF (openVDB)" OFF )
148148option (WITH_CALIB "Complie with calibration" OFF )
149149option (WITH_SYSTEM_APRILTAG "Link against system-wide apriltag library" OFF )
150+ option (WITH_SYSTEMC "Compile with SystemC library for fixedPoint arithmetic" ON )
150151
151152# Adds imgui to show using opengl2 and glut
152153if (WITH_IMGUI)
@@ -455,6 +456,7 @@ add_subdirectory(src/gps)
455456add_subdirectory (src/curvefusion )
456457add_subdirectory (src/mesh )
457458add_subdirectory (src/detectCylinder )
459+ add_subdirectory (src/sc_fixed )
458460# 3rdparty must come before src/calibration because it sets
459461# APRILTAG_INCLUDE_DIRS
460462add_subdirectory (3rdparty )
@@ -474,9 +476,42 @@ find_package(Boost COMPONENTS system filesystem unit_test_framework REQUIRED)
474476enable_testing ()
475477add_subdirectory (testing )
476478
479+
480+ # SystemC integration
481+
482+ # Configurable constants for SystemC fixed-point value
483+ set (FIXED_WORD_LENGTH 48 CACHE STRING "Word length for fixed-point type" )
484+ set (FIXED_INT_WORD_LENGTH 36 CACHE STRING "Integer word length for fixed-point type" )
485+ set (FIXED_HERON_ITERATIONS 3 CACHE STRING "Iterations ins heron algorithm for square root calculations for fixed point numbers" )
486+
487+ if (WITH_SYSTEMC)
488+ message (STATUS "SystemC support enabled" )
489+ find_package (SystemC REQUIRED )
490+
491+ if (SystemC_FOUND)
492+ message (STATUS "SystemC installation found" )
493+ include_directories (${SYSTEMC_INCLUDE_DIR} )
494+ add_definitions (-DWITH_SYSTEMC )
495+ # Set configurable constants for SystemC fixed-point value as compiler definition
496+ target_compile_definitions (icpFixpoint PRIVATE
497+ FIXED_WORD_LENGTH=${FIXED_WORD_LENGTH}
498+ FIXED_INT_WORD_LENGTH=${FIXED_INT_WORD_LENGTH}
499+ FIXED_HERON_ITERATIONS=${FIXED_HERON_ITERATIONS}
500+ )
501+ set (SYSTEMC_LINK_LIBS ${SYSTEMC_LIBRARY} )
502+
503+ else ()
504+ message (FATAL_ERROR "SystemC was enabled, but could not be found" )
505+ endif ()
506+
507+ set (SYSTEMC_INCLUDE_DIR)
508+
509+ else ()
510+ message (STATUS "SystemC support disabled" )
511+ endif ()
477512# Dummy target with all header files
478513# This is a hint for some IDEs, such as Qt Creator, to show all headers in the project tree
479514file (GLOB_RECURSE 3DTK_HEADER_FILES "include/*.h" )
480515add_custom_target (headers SOURCES ${3DTK_HEADER_FILES} )
481516
482- message (STATUS "Build environment is set up!" )
517+ message (STATUS "Build environment is set up!" )
0 commit comments