### Adding Subdirectories for Demos and Tests Source: https://github.com/hcebke/libqex/blob/master/CMakeLists.txt Includes the 'demo/minimal_c' and 'demo/cmdline_tool' subdirectories to build demo applications. It also conditionally enables building unit tests if `BUILD_UNIT_TESTS` is set to true, requiring the googletest framework. ```cmake add_subdirectory(demo/minimal_c) add_subdirectory(demo/cmdline_tool) set(BUILD_UNIT_TESTS false CACHE BOOL "Whether to build the unit tests.") if (BUILD_UNIT_TESTS) enable_testing() set(GTEST_DIR CACHE PATH "Source path of googletest.") if (NOT GTEST_DIR) message(FATAL_ERROR "GTEST_DIR unset") endif() add_subdirectory(${GTEST_DIR} gtest) add_subdirectory(tests) endif() ``` -------------------------------- ### CMake: Define C Demo Variables Source: https://github.com/hcebke/libqex/blob/master/demo/minimal_c/CMakeLists.txt These CMake commands initialize variables to store source files, include directories, libraries, and library directories for the minimal C demo. They are used later to configure the target executable. ```cmake set (DEMO_MINIMAL_C_SOURCES "") set (DEMO_MINIMAL_C_INCLUDE_DIRS "") set (DEMO_MINIMAL_C_LIBRARIES "") set (DEMO_MINIMAL_C_LIBRARY_DIRS "") ``` -------------------------------- ### Basic CMake Configuration and Library Definitions Source: https://github.com/hcebke/libqex/blob/master/CMakeLists.txt Sets the minimum CMake version, defines the project name, and configures include and library paths. It then creates both shared and static libraries named 'QEx' using the specified source files and external libraries. ```cmake cmake_minimum_required (VERSION 2.6) # Only set project name if not build from within another project. if("${PROJECT_NAME}" STREQUAL "") project (QEx) endif() list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) find_package (OpenMesh REQUIRED) set (SOURCES "") set (INCLUDE_DIRS "") set (LIBRARIES "") set (LIBRARY_DIRS "") list (APPEND SOURCES interfaces/c/qex.cc src/predicates.c src/MeshExtractor.cc) list (APPEND INCLUDE_DIRS ${OPENMESH_INCLUDE_DIRS}) list (APPEND LIBRARIES ${OPENMESH_LIBRARIES}) include_directories ( ${CMAKE_SOURCE_DIR}/interfaces/c ${INCLUDE_DIRS} ) link_directories ( ${CMAKE_BINARY_DIR} ${LIBRARY_DIRS} ) add_library (QEx SHARED ${SOURCES}) add_library (QExStatic STATIC ${SOURCES}) target_link_libraries (QEx ${LIBRARIES}) target_link_libraries (QExStatic ${LIBRARIES}) ``` -------------------------------- ### Create Executable and Link Libraries (CMake) Source: https://github.com/hcebke/libqex/blob/master/demo/cmdline_tool/CMakeLists.txt This snippet creates an executable target named 'cmdline_tool' using the specified source files and links it against the defined libraries. It also sets compiler flags for enhanced warnings and C++98 standard compliance. ```cmake if (NOT WIN32 ) add_executable (cmdline_tool ${CMDLINE_TOOL_SOURCES}) target_link_libraries(cmdline_tool ${CMDLINE_TOOL_LIBRARIES}) set_target_properties(cmdline_tool PROPERTIES INCLUDE_DIRECTORIES "${CMDLINE_TOOL_INCLUDE_DIRS}" COMPILE_FLAGS "-Wall -Wextra -pedantic -std=c++98 -Wno-long-long" ) endif() ``` -------------------------------- ### Doxygen Documentation Generation Source: https://github.com/hcebke/libqex/blob/master/CMakeLists.txt Configures the generation of project documentation using Doxygen. If Doxygen is found, it configures the Doxyfile and creates a custom target 'qex_doc' to run the documentation generation process. ```cmake find_package(Doxygen) if (DOXYGEN_FOUND) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile @ONLY) add_custom_target(qex_doc ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc COMMENT "Generating Doxygen documentation" VERBATIM) endif() ``` -------------------------------- ### CMake: Create Executable and Link Libraries Source: https://github.com/hcebke/libqex/blob/master/demo/minimal_c/CMakeLists.txt This CMake block conditionally creates a C executable named 'demo_minimal_c' using the specified sources. It then links the required libraries to this executable. This block only executes on non-Windows systems. ```cmake if (NOT WIN32 ) add_executable (demo_minimal_c ${DEMO_MINIMAL_C_SOURCES}) target_link_libraries(demo_minimal_c ${DEMO_MINIMAL_C_LIBRARIES}) set_target_properties(demo_minimal_c PROPERTIES INCLUDE_DIRECTORIES "${DEMO_MINIMAL_C_INCLUDE_DIRS}" COMPILE_FLAGS "-Wall -Wextra -pedantic -std=c99" ) endif() ``` -------------------------------- ### CMake: Append Source and Include Directories Source: https://github.com/hcebke/libqex/blob/master/demo/minimal_c/CMakeLists.txt This CMake script appends the main source file ('main.c') and necessary include directories to the respective variables. It includes directories from OpenMesh, the C interface of QEx, and QEx itself. ```cmake list (APPEND DEMO_MINIMAL_C_SOURCES main.c) list (APPEND DEMO_MINIMAL_C_INCLUDE_DIRS ${OPENMESH_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/../../interfaces/c ${QEX_INCLUDE_DIRS} ) ``` -------------------------------- ### Define Command-Line Tool Variables (CMake) Source: https://github.com/hcebke/libqex/blob/master/demo/cmdline_tool/CMakeLists.txt Initializes variables for the command-line tool's source files, include directories, libraries, and library directories. These are often appended to later in the CMakeLists.txt file. ```cmake set (CMDLINE_TOOL_SOURCES "") set (CMDLINE_TOOL_INCLUDE_DIRS "") set (CMDLINE_TOOL_LIBRARIES "") set (CMDLINE_TOOL_LIBRARY_DIRS "") ``` -------------------------------- ### CMake: Append Libraries and Library Directories Source: https://github.com/hcebke/libqex/blob/master/demo/minimal_c/CMakeLists.txt This CMake code appends the OpenMesh libraries and the QEx library to the list of libraries. It also appends the library directory for OpenMesh. These are essential for linking the demo executable. ```cmake list (APPEND DEMO_MINIMAL_C_LIBRARIES ${OPENMESH_LIBRARIES} QEx ) list (APPEND DEMO_MINIMAL_C_LIBRARY_DIRS ${OPEMESH_LIBRARY_DIR}) ``` -------------------------------- ### CMake Build Configuration for QEx Unit Tests Source: https://github.com/hcebke/libqex/blob/master/tests/CMakeLists.txt This snippet outlines the basic CMake configuration for the QEx unit tests. It sets the minimum CMake version, names the project, adds compiler warnings for non-Windows systems, enables testing, and finds necessary packages like Threads and Google Test. ```cmake cmake_minimum_required(VERSION 2.6) project(QEx_UnitTests) if (NOT WIN32) add_definitions(-Wall -Wextra -Wno-unused-parameter) endif() FIND_PACKAGE(Threads) enable_testing() ``` -------------------------------- ### CMake: Find OpenMesh Package Source: https://github.com/hcebke/libqex/blob/master/demo/minimal_c/CMakeLists.txt This CMake command searches for the OpenMesh library, making its include directories and libraries available for use in the project. It's a prerequisite for linking against OpenMesh. ```cmake find_package (OpenMesh REQUIRED) ``` -------------------------------- ### CMake Executable and Library Linking for QEx Tests Source: https://github.com/hcebke/libqex/blob/master/tests/CMakeLists.txt This CMake code defines the unit test executable `QEx_tests` using the discovered source files. It then specifies the libraries to link against, including `gtest`, `QEx`, `OpenMesh`, and `Threads`, and adds the executable as a test suite named `AllTestsIn_QEx_tests`. ```cmake include_directories("${GTEST_DIR}/include" ${OPENMESH_INCLUDE_DIR} "../interfaces/c/") add_executable(QEx_tests ${TEST_SOURCES}) target_link_libraries(QEx_tests gtest QEx ${OPENMESH_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ) add_test(AllTestsIn_QEx_tests QEx_tests) ``` -------------------------------- ### CMake File Globbing and Copying for Test Assets Source: https://github.com/hcebke/libqex/blob/master/tests/CMakeLists.txt This CMake snippet uses `file(GLOB_RECURSE ...)` to find all C++ source files for the tests and all OBJ mesh files. It then copies the discovered mesh files to the build directory, ensuring they are available during testing. ```cmake file(GLOB_RECURSE TEST_SOURCES *.cc) file(GLOB TEST_MESHES meshes/*.obj) file(COPY ${TEST_MESHES} DESTINATION ${CMAKE_BINARY_DIR}/meshes) ``` -------------------------------- ### Append to Command-Line Tool Variables (CMake) Source: https://github.com/hcebke/libqex/blob/master/demo/cmdline_tool/CMakeLists.txt Appends source files, include directories, and libraries to the previously defined variables for the command-line tool. This includes project-specific paths and dependencies like OpenMesh. ```cmake list (APPEND CMDLINE_TOOL_SOURCES main.cpp) list (APPEND CMDLINE_TOOL_INCLUDE_DIRS ${OPENMESH_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/../../interfaces/c ${QEX_INCLUDE_DIRS} ) list (APPEND CMDLINE_TOOL_LIBRARIES ${OPENMESH_LIBRARIES} QEx ) list (APPEND CMDLINE_TOOL_LIBRARY_DIRS ${OPEMESH_LIBRARY_DIR}) ``` -------------------------------- ### Setting Target Properties for QEx Libraries Source: https://github.com/hcebke/libqex/blob/master/CMakeLists.txt Sets properties for the 'QEx' and 'QExStatic' targets, including the compile flags and define symbols. This ensures that the previously defined compile flags and export symbols are applied to the libraries. ```cmake set_target_properties (QEx PROPERTIES COMPILE_FLAGS "${QEX_COMPILE_FLAGS}" DEFINE_SYMBOLS "-DQEX_EXPORT_SYMBOLS" ) set_target_properties (QExStatic PROPERTIES COMPILE_FLAGS "${QEX_COMPILE_FLAGS}" DEFINE_SYMBOLS "-DQEX_EXPORT_SYMBOLS" ) ``` -------------------------------- ### Compiler Flags for Exact Predicates (Clang, GNU, Intel, MSVC) Source: https://github.com/hcebke/libqex/blob/master/CMakeLists.txt Sets compiler flags to prevent issues with floating-point precision that can affect exact predicates. It specifically configures SSE instructions for Clang and GNU compilers, warns about potential issues with Intel compilers, and notes that MSVC might handle this internally. For unknown compilers, it issues a warning. ```cmake # # In order for the exact predicates to work the compiler # must not generate x87 FPU code as this leads to the use # of extended precision registers which prevent lead to # wrong results. # # As SSE does not have extended precision registers, # forcing the generation of SSE code ensures that the # exact predicates produce correct results. # set (QEX_COMPILE_FLAGS "-Wall") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set (QEX_COMPILE_FLAGS "${QEX_COMPILE_FLAGS} -msse -mfpmath=sse -pedantic -Weverything") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set (QEX_COMPILE_FLAGS "${QEX_COMPILE_FLAGS} -msse -mfpmath=sse -pedantic -Wextra") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") message (WARNING "You are using an Intel compiler which might generate x87 FPU code " "that breaks the exact predicates. If you know which compiler flags " "ensure that the Intel compiler produces SSE code, please patch " "the CMakeLists.txt and inform the author .") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # There is code in exactinit() that should make sure that nor x87 extended internal precision is used. else () message (WARNING "You are using an unknown compiler which might generate x87 FPU code " "that breaks the exact predicates. If you know how to detect this compiler " "and which flags " "ensure that this compiler produces SSE code, please patch " "the CMakeLists.txt and inform the author .") endif () ``` -------------------------------- ### STL Range Checks Configuration Source: https://github.com/hcebke/libqex/blob/master/CMakeLists.txt Configures whether to include STL range checks in debug builds. If the `STL_RANGE_CHECKS` variable is set to true, it adds specific preprocessor definitions to enable these checks. ```cmake set(STL_RANGE_CHECKS false CACHE BOOL "Include STL range checks in debug mode (This option is only used in debug mode.)") # Add a flag to check stl vectors in debugging mode if (STL_RANGE_CHECKS) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC" ) endif() ``` -------------------------------- ### Conditional QEx Found Settings for Dependent Projects Source: https://github.com/hcebke/libqex/blob/master/CMakeLists.txt Defines variables like `QEX_FOUND`, `QEX_LIBRARIES`, and `QEX_INCLUDE_DIRS` when the project is not built as 'QEx' itself. This allows other projects that include QEx to correctly find and use its components. ```cmake # # Fake successful finder run if compiling as a dependent project. # if(NOT "${PROJECT_NAME}" MATCHES "QEx") set (QEX_FOUND true PARENT_SCOPE) set (QEX_LIBRARIES QEx PARENT_SCOPE) set (QEX_LIBRARY QEx PARENT_SCOPE) set (QEX_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/interfaces/c" PARENT_SCOPE) set (QEX_LIBRARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE PATH "The directory where the OpenMesh libraries can be found.") endif() ``` -------------------------------- ### BibTeX Citation for libQEx Source: https://github.com/hcebke/libqex/blob/master/README.md Provides the BibTeX entry for citing the libQEx paper in academic work. This snippet is for referencing the research behind the library. ```bibtex @article{Ebke:2013:QRQ:2508363.2508372, author = {Ebke, Hans-Christian and Bommes, David and Campen, Marcel and Kobbelt, Leif}, title = {{QE}x: Robust Quad Mesh Extraction}, journal = {ACM Trans. Graph.}, issue_date = {November 2013}, volume = {32}, number = {6}, month = nov, year = {2013}, issn = {0730-0301}, pages = {168:1--168:10}, articleno = {168}, numpages = {10}, url = {http://doi.acm.org/10.1145/2508363.2508372}, doi = {10.1145/2508363.2508372}, acmid = {2508372}, publisher = {ACM}, address = {New York, NY, USA}, keywords = {integer-grid maps, quad extraction, quad meshing}, } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.