### Guile Configuration and Module Setup Source: https://github.com/opencog/atomspace-rocks/blob/master/opencog/CMakeLists.txt Defines Guile configuration targets, adds subdirectories for build modules, and declares Guile modules to be installed. It also includes logic for writing and appending to Guile configuration files, managing paths for persistence modules. ```cmake DECLARE_GUILE_CONFIG_TARGET(SCM_CONFIG "opencog rocks-config" "OPENCOG_TEST") IF (HAVE_CYTHON) ADD_SUBDIRECTORY (cython) ENDIF (HAVE_CYTHON) ADD_SUBDIRECTORY (persist) ADD_GUILE_MODULE (FILES scm/persist-mono.scm scm/persist-rocks.scm MODULE_DESTINATION "${GUILE_SITE_DIR}/opencog" ) WRITE_GUILE_CONFIG(${GUILE_BIN_DIR}/opencog/rocks-config.scm SCM_CONFIG TRUE) FILE(APPEND ${GUILE_BIN_DIR}/opencog/rocks-config.scm "(define-public opencog-ext-path-persist-mono \"${CMAKE_CURRENT_BINARY_DIR}/persist/monospace/\")\n") WRITE_GUILE_CONFIG(${GUILE_BIN_DIR}/opencog/rocks-config-installable.scm SCM_CONFIG FALSE) FILE(APPEND ${GUILE_BIN_DIR}/opencog/rocks-config-installable.scm "(define-public opencog-ext-path-persist-mono opencog-ext-path-persist-rocks)\n") INSTALL(FILES ${GUILE_BIN_DIR}/opencog/rocks-config-installable.scm DESTINATION ${GUILE_SITE_DIR}/opencog RENAME rocks-config.scm) ``` -------------------------------- ### Documentation Setup Source: https://github.com/opencog/atomspace-rocks/blob/master/CMakeLists.txt Finds the Doxygen documentation generator and includes the documentation subdirectory for building documentation. ```cmake FIND_PACKAGE(Doxygen) # ADD_SUBDIRECTORY(doc EXCLUDE_FROM_ALL) ``` -------------------------------- ### Build and Install atomspace-rocks Source: https://github.com/opencog/atomspace-rocks/blob/master/README.md Instructions for building and installing the atomspace-rocks project using CMake. Requires RocksDB development libraries. ```Shell cd to project dir atomspace-rocks mkdir build cd build cmake .. make -j4 sudo make install make check ``` -------------------------------- ### Example Usage with Guile Scheme Source: https://github.com/opencog/atomspace-rocks/blob/master/README.md Demonstrates how to initialize, open, load, and close a RocksDB-backed AtomSpace using Guile Scheme. It shows connecting to a local RocksDB instance. ```Scheme (use-modules (opencog)) (use-modules (opencog persist)) (use-modules (opencog persist-rocks)) (define sto (RocksStorageNode "rocks:///tmp/foo.rdb/")) (cog-open sto) (load-atomspace) (cog-close sto) ``` -------------------------------- ### AtomspaceRocks Package Configuration Setup Source: https://github.com/opencog/atomspace-rocks/blob/master/cmake/CMakeLists.txt This CMake script configures the AtomspaceRocks package for installation. It sets up the necessary files for CMake's find_package mechanism, including configuration files and version information, ensuring proper integration into other projects. ```cmake # CMake boilerplate that allows users to do # find_package(AtomspaceRocks REQUIRED 1.3.0) # and have it work. include(CMakePackageConfigHelpers) set(ConfigPackageLocation lib/cmake/AtomSpaceRocks) install(EXPORT AtomSpaceRocksTargets FILE AtomSpaceRocksTargets.cmake DESTINATION ${ConfigPackageLocation} ) SET(SEMANTIC_VERSION 1.3.0) configure_package_config_file(AtomSpaceRocksConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/AtomSpaceRocksConfig.cmake INSTALL_DESTINATION ${ConfigPackageLocation} PATH_VARS CMAKE_INSTALL_PREFIX ) write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/AtomSpaceRocksConfigVersion.cmake" VERSION ${SEMANTIC_VERSION} COMPATIBILITY SameMajorVersion ) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/AtomSpaceRocksConfigVersion.cmake ${CMAKE_CURRENT_BINARY_DIR}/AtomSpaceRocksConfig.cmake DESTINATION ${ConfigPackageLocation} ) # ----------------------------------------------------------- ``` -------------------------------- ### Initial CMake Setup and Policies Source: https://github.com/opencog/atomspace-rocks/blob/master/CMakeLists.txt Sets the minimum required CMake version and configures specific CMake policies to ensure consistent behavior across different CMake versions. These policies are crucial for modern CMake practices. ```cmake CMAKE_MINIMUM_REQUIRED(VERSION 3.12) IF (COMMAND CMAKE_POLICY) # These must be explicitly set, as otherwise warnings are printed. CMAKE_POLICY(SET CMP0003 NEW) CMAKE_POLICY(SET CMP0037 NEW) CMAKE_POLICY(SET CMP0045 NEW) ENDIF (COMMAND CMAKE_POLICY) ``` -------------------------------- ### CMake Build Configuration for opencog/atomspace-rocks Source: https://github.com/opencog/atomspace-rocks/blob/master/opencog/cython/CMakeLists.txt This snippet details the CMake build configuration for the opencog/atomspace-rocks project. It includes setting include directories, defining Cython module properties, adding a shared library, linking dependencies, and specifying installation targets. ```CMake INCLUDE_DIRECTORIES( ${Python3_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) SET(CYTHON_FLAGS "-3" "-f" "-Wextra") # The python module name is taken from the pyx filename. Thus, the file # storage_rocks.pxy means that module name will be # 'opencog.storage_rocks'. This will have an autogenerated # PyInit_storage_rocks() in it, again, based on the module name. CYTHON_ADD_MODULE_PYX(storage_rocks) ADD_LIBRARY(storage_rocks_cython SHARED storage_rocks.cpp ) TARGET_LINK_LIBRARIES(storage_rocks_cython ${NO_AS_NEEDED} persist-rocks persist-monospace ${AS_NEEDED} persist storage-types atomspace ${Python3_LIBRARIES} ) SET_TARGET_PROPERTIES(storage_rocks_cython PROPERTIES PREFIX "" OUTPUT_NAME storage_rocks) ### install the modules ### INSTALL(TARGETS storage_rocks_cython DESTINATION "${PYTHON_DEST}") ``` -------------------------------- ### Include OpenCog CMake Modules Source: https://github.com/opencog/atomspace-rocks/blob/master/CMakeLists.txt Includes various OpenCog-specific CMake modules for managing compiler options, library options, installation settings, and generating a summary report. ```cmake include(OpenCogGccOptions) include(OpenCogLibOptions) include(OpenCogInstallOptions) include(Summary) ``` -------------------------------- ### Build RocksDB Driver for AtomSpace Source: https://github.com/opencog/atomspace-rocks/blob/master/opencog/persist/rocks/CMakeLists.txt This CMake script configures the build process for the RocksDB driver for the AtomSpace project. It defines libraries, links dependencies, registers Guile extensions, and specifies installation paths for targets and headers. ```cmake # # Build the RocksDB driver for the AtomSpace # ADD_LIBRARY (persist-rocks SHARED RocksDAG.cc RocksFrame.cc RocksIO.cc RocksStorage.cc RocksPersistSCM.cc ) TARGET_LINK_LIBRARIES(persist-rocks ${ATOMSPACE_STORAGE_LIBRARIES} ${ATOMSPACE_LIBRARIES} rocksdb ) ADD_GUILE_EXTENSION(SCM_CONFIG persist-rocks "opencog-ext-path-persist-rocks") # The EXPORT is need to autogenerate CMake boilerplate in the lib # directory that lets other packages FIND_PACKAGE(AtomSpaceRocks) INSTALL (TARGETS persist-rocks EXPORT AtomSpaceRocksTargets DESTINATION "lib${LIB_DIR_SUFFIX}/opencog" ) INSTALL (FILES RocksStorage.h DESTINATION "include/opencog/persist/rocks" ) ``` -------------------------------- ### CMake Build Configuration for RocksDB Driver Source: https://github.com/opencog/atomspace-rocks/blob/master/opencog/persist/monospace/CMakeLists.txt This CMake script defines the build process for the RocksDB driver. It includes adding a shared library, linking necessary AtomSpace and external libraries (like rocksdb), registering a Guile extension, and configuring installation rules for targets and header files. ```cmake # # Build the RocksDB driver for a single AtomSpace # ADD_LIBRARY (persist-monospace SHARED MonoIO.cc MonoStorage.cc MonoPersistSCM.cc ) TARGET_LINK_LIBRARIES(persist-monospace ${ATOMSPACE_STORAGE_LIBRARIES} ${ATOMSPACE_LIBRARIES} rocksdb ) ADD_GUILE_EXTENSION(SCM_CONFIG persist-monospace "opencog-ext-path-persist-mono") # The EXPORT is need to autogenerate CMake boilerplate in the lib # directory that lets other packages FIND_PACKAGE(AtomSpaceMonoSpace) INSTALL (TARGETS persist-monospace EXPORT AtomSpaceMonoSpaceTargets DESTINATION "lib${LIB_DIR_SUFFIX}/opencog" ) INSTALL (FILES MonoStorage.h DESTINATION "include/opencog/persist/monospace" ) ``` -------------------------------- ### Project Summary Macros Source: https://github.com/opencog/atomspace-rocks/blob/master/CMakeLists.txt Defines and shows a summary of found components and build configurations using custom macros. ```cmake SUMMARY_ADD("AtomSpace-Rocks" "AtomSpace RocksDB Backend" HAVE_ATOMSPACE AND HAVE_ATOMSPACE_STORAGE AND HAVE_ROCKSDB) SUMMARY_ADD("Cython" "Cython (python) bindings" HAVE_CYTHON) SUMMARY_ADD("Doxygen" "Code documentation" DOXYGEN_FOUND) SUMMARY_ADD("Unit tests" "Unit tests" CXXTEST_FOUND) SUMMARY_SHOW() ``` -------------------------------- ### Include Additional CMake Macros Source: https://github.com/opencog/atomspace-rocks/blob/master/CMakeLists.txt Includes further OpenCog-specific CMake macros for general utilities, Guile integration, and Cython support, enhancing the build system's capabilities. ```cmake INCLUDE(OpenCogMacros) INCLUDE(OpenCogGuile) INCLUDE(OpenCogCython) ``` -------------------------------- ### Project Definitions and Module Path Source: https://github.com/opencog/atomspace-rocks/blob/master/CMakeLists.txt Adds preprocessor definitions for the project source and binary directories. It also appends the 'lib' directory to CMake's module search path to find custom macros. ```cmake ADD_DEFINITIONS(-DPROJECT_SOURCE_DIR="${CMAKE_SOURCE_DIR}" -DPROJECT_BINARY_DIR="${CMAKE_BINARY_DIR}") # Add the 'lib' dir to cmake's module search path list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/lib/") ``` -------------------------------- ### Enable Testing and Include CxxTest Source: https://github.com/opencog/atomspace-rocks/blob/master/tests/CMakeLists.txt Enables testing features and includes the CxxTest framework. These are fundamental steps for setting up a testing environment within the CMake build system. ```cmake ENABLE_TESTING() INCLUDE(AddCxxtest) ``` -------------------------------- ### Link Libraries Source: https://github.com/opencog/atomspace-rocks/blob/master/tests/persist/monospace/CMakeLists.txt Specifies libraries to be linked to the current target. This is a common build system command used to manage dependencies. ```CMake LINK_LIBRARIES( persist-monospace persist atomspace ) ``` -------------------------------- ### Project Definition Source: https://github.com/opencog/atomspace-rocks/blob/master/CMakeLists.txt Defines the name of the project being built. This is a fundamental step in CMake configuration. ```cmake PROJECT(atomspace-rocks) ``` -------------------------------- ### StorageNode API and Implementations Source: https://github.com/opencog/atomspace-rocks/blob/master/README.md Describes the StorageNode API concept and the RocksDB implementation. It highlights that all StorageNodes share the same API, with RocksStorageNode and MonoStorageNode being specific implementations. ```APIDOC StorageNode API: - Provides a common interface for all AtomSpace storage backends. - RocksStorageNode and MonoStorageNode are implementations of this API. RocksStorageNode: - Initializes a connection to a RocksDB database. - Usage: RocksStorageNode("rocks:///path/to/rocksdb/") - Methods: - cog-open(storage_node): Opens the connection to the database. - load-atomspace(): Loads all contents from the database into the AtomSpace. - cog-close(storage_node): Closes the connection to the database. MonoStorageNode: - A simpler implementation of the StorageNode API. ``` -------------------------------- ### Debian Packaging Configuration Source: https://github.com/opencog/atomspace-rocks/blob/master/CMakeLists.txt Configures CPack for generating a Debian package. It sets package metadata, dependencies, and includes the license and README. ```cmake EXECUTE_PROCESS(COMMAND dpkg --print-architecture OUTPUT_VARIABLE PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE) STRING(TIMESTAMP UTC_DATE "%Y%m%d" UTC) FILE(WRITE "${PROJECT_BINARY_DIR}/install_manifest.txt") SET(CPACK_GENERATOR "DEB") SET(CPACK_PACKAGE_CONTACT "opencog@googlegroups.com") SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md") SET(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}/packages") SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The AtomSpace RocksDB Storage Backend") SET(CPACK_PACKAGE_NAME "atomspace-rocks-dev") SET(CPACK_PACKAGE_VENDOR "opencog.org") SET(CPACK_PACKAGE_VERSION "${SEMANTIC_VERSION}-${UTC_DATE}") SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${PACKAGE_ARCHITECTURE}") SET(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local") SET(DEPENDENCY_LIST "guile-3.0-dev (>= 3.0.0)" "libstdc++6 (>= 7.0)" "libcogutil-dev (>= 2.0.2)" "atomspace-dev (>= 5.0.3)" ) STRING(REPLACE ";" ", " MAIN_DEPENDENCIES "${DEPENDENCY_LIST}") SET(CPACK_DEBIAN_PACKAGE_DEPENDS "${MAIN_DEPENDENCIES}") SET(CPACK_DEBIAN_PACKAGE_SECTION "libdevel") SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://opencog.org") INCLUDE(CPack) ``` -------------------------------- ### Generate CScope Database Source: https://github.com/opencog/atomspace-rocks/blob/master/CMakeLists.txt Creates a cscope database for code navigation. It finds C++ and Scheme source files within the project directories. ```cmake ADD_CUSTOM_TARGET(cscope COMMAND find opencog examples tests -name '*.cc' -o -name '*.h' -o -name '*.cxxtest' -o -name '*.scm' > ${CMAKE_SOURCE_DIR}/cscope.files COMMAND cscope -b WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMENT "Generating CScope database" ) ``` -------------------------------- ### Set Include Directories Source: https://github.com/opencog/atomspace-rocks/blob/master/CMakeLists.txt Configures the include paths for the project, making headers from the project source directory and its dependencies (CogUtil, AtomSpace) accessible during compilation. ```cmake # Set default include paths. INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR} ${COGUTIL_INCLUDE_DIR} ${ATOMSPACE_INCLUDE_DIR}) ``` -------------------------------- ### CMake: Add Subdirectories Source: https://github.com/opencog/atomspace-rocks/blob/master/opencog/persist/CMakeLists.txt Configures the build system to include subdirectories. The ADD_SUBDIRECTORY command processes the CMakeLists.txt file in the specified subdirectory, effectively adding it to the build. This is crucial for organizing larger projects. ```CMake ADD_SUBDIRECTORY(monospace) ADD_SUBDIRECTORY(rocks) ``` -------------------------------- ### Add Guile Unit Tests Source: https://github.com/opencog/atomspace-rocks/blob/master/tests/persist/monospace/CMakeLists.txt Registers Guile Scheme unit tests with the build system. This command specifies the test suite name and the corresponding Scheme file. ```CMake ADD_GUILE_TEST(MonoValueStore mono-value-store-test.scm) ``` -------------------------------- ### CMake Build Configuration Source: https://github.com/opencog/atomspace-rocks/blob/master/CMakeLists.txt Defines subdirectories for building the project and its dependencies. It conditionally adds test targets if CXXTest is found. ```cmake ADD_SUBDIRECTORY(cmake) ADD_SUBDIRECTORY(opencog) IF (CXXTEST_FOUND) ADD_CUSTOM_TARGET(tests) ADD_SUBDIRECTORY(tests EXCLUDE_FROM_ALL) IF (CMAKE_BUILD_TYPE STREQUAL "Coverage") ADD_CUSTOM_TARGET(check WORKING_DIRECTORY tests COMMAND ${CMAKE_CTEST_COMMAND} --force-new-ctest-process --output-on-failure $(ARGS) COMMENT "Running tests with coverage..." ) ELSE (CMAKE_BUILD_TYPE STREQUAL "Coverage") ADD_CUSTOM_TARGET(check DEPENDS tests WORKING_DIRECTORY tests COMMAND ${CMAKE_CTEST_COMMAND} --force-new-ctest-process --output-on-failure $(ARGS) COMMENT "Running tests..." ) ENDIF (CMAKE_BUILD_TYPE STREQUAL "Coverage") ADD_CUSTOM_TARGET(test_mono DEPENDS tests WORKING_DIRECTORY tests/persist/monospace COMMAND ${CMAKE_CTEST_COMMAND} $(ARGS) COMMENT "Running Monospace tests..." ) ADD_CUSTOM_TARGET(test_multi DEPENDS tests WORKING_DIRECTORY tests/persist/rocks COMMAND ${CMAKE_CTEST_COMMAND} $(ARGS) COMMENT "Running Multispace tests..." ) ENDIF (CXXTEST_FOUND) ``` -------------------------------- ### Add C++ Unit Tests Source: https://github.com/opencog/atomspace-rocks/blob/master/tests/persist/monospace/CMakeLists.txt Registers C++ unit tests with the build system. These commands typically define test executables that will be run during the testing phase. ```CMake ADD_CXXTEST(MonoBasicSaveUTest) ADD_CXXTEST(MonoValueSaveUTest) ADD_CXXTEST(MonoPersistUTest) ADD_CXXTEST(MonoFetchUTest) ADD_CXXTEST(MonoBasicDeleteUTest) ADD_CXXTEST(MonoDeleteUTest) ADD_CXXTEST(MonoAlphaEquivUTest) ADD_CXXTEST(MonoMultiPersistUTest) ADD_CXXTEST(MonoMultiDeleteUTest) ADD_CXXTEST(MonoQueryPersistUTest) ADD_CXXTEST(MonoLargeFlatUTest) ADD_CXXTEST(MonoLargeZipfUTest) ``` -------------------------------- ### CMake: Add Subdirectories Source: https://github.com/opencog/atomspace-rocks/blob/master/tests/persist/CMakeLists.txt Configures the build system to include subdirectories. The ADD_SUBDIRECTORY command processes the CMakeLists.txt file in the specified subdirectory, effectively adding it to the build. This is crucial for organizing larger projects. ```CMake ADD_SUBDIRECTORY(monospace) ADD_SUBDIRECTORY(rocks) ``` -------------------------------- ### AtomSpace and Storage Dependency Checks Source: https://github.com/opencog/atomspace-rocks/blob/master/CMakeLists.txt Finds the AtomSpace and AtomSpaceStorage packages, both required dependencies. It checks for specific versions and defines corresponding HAVE_* flags. The build fails if either is not found. ```cmake # AtomSpace FIND_PACKAGE(AtomSpace 5.0.3 CONFIG REQUIRED) IF (ATOMSPACE_FOUND) MESSAGE(STATUS "AtomSpace found.") ADD_DEFINITIONS(-DHAVE_ATOMSPACE) SET(HAVE_ATOMSPACE 1) ELSE (ATOMSPACE_FOUND) MESSAGE(FATAL_ERROR "AtomSpace missing: it is needed!") ENDIF (ATOMSPACE_FOUND) FIND_PACKAGE(AtomSpaceStorage CONFIG REQUIRED) IF (ATOMSPACE_STORAGE_FOUND) MESSAGE(STATUS "AtomSpace Storage found.") ADD_DEFINITIONS(-DHAVE_ATOMSPACE_STORAGE) SET(HAVE_ATOMSPACE_STORAGE 1) ELSE (ATOMSPACE_STORAGE_FOUND) MESSAGE(FATAL_ERROR "AtomSpace Storage missing: it is needed!") ENDIF (ATOMSPACE_STORAGE_FOUND) ``` -------------------------------- ### Guile and Python Integration Source: https://github.com/opencog/atomspace-rocks/blob/master/CMakeLists.txt Includes CMake modules to find Guile and Python, which are likely used for scripting or integration within the project. These are typically optional but important for certain build configurations. ```cmake # Guile Python and Cython include(OpenCogFindGuile) include(OpenCogFindPython) ``` -------------------------------- ### CxxTest Dependency Check Source: https://github.com/opencog/atomspace-rocks/blob/master/CMakeLists.txt Checks for the CxxTest framework, which is needed for unit tests. It prints a status message if CxxTest is not found but does not cause a build failure. ```cmake # Needed for unit tests FIND_PACKAGE(Cxxtest) IF (NOT CXXTEST_FOUND) MESSAGE(STATUS "CxxTest missing: needed for unit tests.") ENDIF (NOT CXXTEST_FOUND) ``` -------------------------------- ### Valgrind Dependency Check Source: https://github.com/opencog/atomspace-rocks/blob/master/CMakeLists.txt Checks for the Valgrind tool, which is optionally needed for thread debugging and suppressing warnings. It reports whether Valgrind and its development headers are found. ```cmake # Optional, currently needed only to hush up DRD in util/Logger.cc FIND_PACKAGE(VALGRIND) IF (VALGRIND_FOUND) MESSAGE(STATUS "VALGRIND was found.") IF (VALGRIND_INCLUDE_DIR) MESSAGE(STATUS "VALGRIND devel headers found.") ADD_DEFINITIONS(-DHAVE_VALGRIND) ELSE (VALGRIND_INCLUDE_DIR) MESSAGE(STATUS "VALGRIND devel headers NOT FOUND: needed for thread debugging.") ENDIF (VALGRIND_INCLUDE_DIR) ELSE (VALGRIND_FOUND) MESSAGE(STATUS "VALGRIND missing: needed for thread debugging.") ENDIF (VALGRIND_FOUND) ``` -------------------------------- ### CogUtil Dependency Check Source: https://github.com/opencog/atomspace-rocks/blob/master/CMakeLists.txt Finds the CogUtil package, which is a required dependency. It checks for version 2.0.1 and defines HAVE_COGUTIL if found. If CogUtil is not found, the build fails. ```cmake # Cogutil FIND_PACKAGE(CogUtil 2.0.1 CONFIG REQUIRED) IF (COGUTIL_FOUND) MESSAGE(STATUS "CogUtil version ${COGUTIL_VERSION} found.") ADD_DEFINITIONS(-DHAVE_COGUTIL) SET(HAVE_COGUTIL 1) ELSE (COGUTIL_FOUND) MESSAGE(FATAL_ERROR "CogUtil missing: it is needed!") ENDIF (COGUTIL_FOUND) # add the 'cmake' directory from cogutil to search path list(APPEND CMAKE_MODULE_PATH ${COGUTIL_DATA_DIR}/cmake) ``` -------------------------------- ### Build Type Configuration Source: https://github.com/opencog/atomspace-rocks/blob/master/CMakeLists.txt Configures the build type (e.g., Release, Debug, Coverage). If no build type is explicitly set, it defaults to 'Release'. This influences compiler optimizations and debugging symbols. ```cmake # Uncomment to be in Release mode [default]. # SET(CMAKE_BUILD_TYPE Release) # Uncomment to build in debug mode. # SET(CMAKE_BUILD_TYPE Debug) # Uncomment to be in coverage testing mode. # SET(CMAKE_BUILD_TYPE Coverage) # Uncomment to build in profile mode. # SET(CMAKE_BUILD_TYPE Profile) # Uncomment to build in release mode with debug information. # SET(CMAKE_BUILD_TYPE RelWithDebInfo) # default build type IF (CMAKE_BUILD_TYPE STREQUAL "") SET(CMAKE_BUILD_TYPE Release) ENDIF (CMAKE_BUILD_TYPE STREQUAL "") MESSAGE(STATUS "Build type: ${CMAKE_BUILD_TYPE}") ``` -------------------------------- ### Link Execution Library Source: https://github.com/opencog/atomspace-rocks/blob/master/tests/persist/monospace/CMakeLists.txt Links the 'execution' library to a specific C++ test target. This is often required for tests that involve program execution or runtime features. ```CMake TARGET_LINK_LIBRARIES(MonoFetchUTest execution) ``` -------------------------------- ### RocksDB Dependency Check Source: https://github.com/opencog/atomspace-rocks/blob/master/CMakeLists.txt Finds the RocksDB library, which is a required dependency. It sets the HAVE_ROCKSDB flag if found, and the build fails if RocksDB is not located. ```cmake # RocksDB FIND_PACKAGE(RocksDB REQUIRED) IF (ROCKSDB_FOUND) MESSAGE(STATUS "RocksDB found.") SET(HAVE_ROCKSDB 1) ELSE (ROCKSDB_FOUND) MESSAGE(FATAL_ERROR "RocksDB was not found.") ENDIF (ROCKSDB_FOUND) ``` -------------------------------- ### Conditionally Add Test Subdirectory Source: https://github.com/opencog/atomspace-rocks/blob/master/tests/CMakeLists.txt Adds the 'persist' subdirectory to the build if the CXXTEST_FOUND variable is true, indicating that the CxxTest framework has been successfully found and configured. ```cmake IF (CXXTEST_FOUND) ADD_SUBDIRECTORY (persist) ENDIF (CXXTEST_FOUND) ``` -------------------------------- ### Set GUILE_LOAD_PATH for Tests Source: https://github.com/opencog/atomspace-rocks/blob/master/tests/CMakeLists.txt Sets the GUILE_LOAD_PATH variable to point to the atomspace SCM directory within the build output. This path is used by ADD_CXXTEST to locate necessary SCM files for tests. ```cmake SET(GUILE_LOAD_PATH "${PROJECT_BINARY_DIR}/opencog/scm") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.