### Directory and Dependency Setup Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Physics/BouncingTetrahedra/CMakeLists.txt Configures output paths, include directories, and links necessary libraries for the project. ```cmake set(GTE_ROOT ${PROJECT_SOURCE_DIR}/../../..) set(GTE_INC_DIR ${GTE_ROOT}) set(GTE_LIB_PREFIX ${GTE_ROOT}/lib/${CMAKE_BUILD_TYPE}) set(GTE_EXE_PREFIX ${PROJECT_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE}) if(BUILD_SHARED_LIB) set(GTE_LIB_DIR ${GTE_LIB_PREFIX}Shared) set(GTE_EXE_DIR ${GTE_EXE_PREFIX}Shared) else() set(GTE_LIB_DIR ${GTE_LIB_PREFIX}Static) set(GTE_EXE_DIR ${GTE_EXE_PREFIX}Static) endif() set(EXECUTABLE_OUTPUT_PATH ${GTE_EXE_DIR} CACHE PATH "Executable directory" FORCE) SET(EXECUTABLE_OUTPUT_PATH ${GTE_EXE_DIR}) include_directories(${GTE_INC_DIR}) add_executable(${PROJECT_NAME} ${PROJECT_NAME}Main.cpp ${PROJECT_NAME}Window3.cpp PhysicsModule.cpp RigidPlane.cpp RigidTetrahedron.cpp) find_package(PNG REQUIRED) find_package(Threads REQUIRED) target_link_directories(${PROJECT_NAME} PUBLIC ${GTE_LIB_DIR}) target_link_libraries(${PROJECT_NAME} gtapplications gtmathematicsgpu gtgraphics GL EGL X11 PNG::PNG Threads::Threads) ``` -------------------------------- ### Directory and Path Setup Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Imagics/ExtractLevelCurves/CMakeLists.txt Configures root, include, and output directories based on the build type and library linkage mode. ```cmake set(GTE_ROOT ${PROJECT_SOURCE_DIR}/../../..) set(GTE_INC_DIR ${GTE_ROOT}) set(GTE_LIB_PREFIX ${GTE_ROOT}/lib/${CMAKE_BUILD_TYPE}) set(GTE_EXE_PREFIX ${PROJECT_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE}) if(BUILD_SHARED_LIB) set(GTE_LIB_DIR ${GTE_LIB_PREFIX}Shared) set(GTE_EXE_DIR ${GTE_EXE_PREFIX}Shared) else() set(GTE_LIB_DIR ${GTE_LIB_PREFIX}Static) set(GTE_EXE_DIR ${GTE_EXE_PREFIX}Static) endif() set(EXECUTABLE_OUTPUT_PATH ${GTE_EXE_DIR} CACHE PATH "Executable directory" FORCE) SET(EXECUTABLE_OUTPUT_PATH ${GTE_EXE_DIR}) include_directories(${GTE_INC_DIR}) ``` -------------------------------- ### Project Setup and Options Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Physics/WrigglingSnake/CMakeLists.txt Configures the CMake version, project name, build options for release/shared libraries, and C++ standard. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() project(WrigglingSnake) cmake_minimum_required(VERSION 3.10) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) ``` -------------------------------- ### Install Header Files and Targets Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Mathematics/CMakeLists.txt Defines installation rules for header files and exports the library target for downstream projects. ```cmake include(CMakePackageConfigHelpers) # Find all .h files in the same directory as this CMakeLists.txt file(GLOB HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.h") # Install the header files install(FILES ${HEADER_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/Mathematics) # Install the target (export for downstream use) install( TARGETS gtmathematics EXPORT gtmathematicsTargets INCLUDES DESTINATION include ) # Generate and install the CMake package config file install(EXPORT gtmathematicsTargets FILE gtmathematicsTargets.cmake NAMESPACE GTE:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/gtmathematics ) ``` -------------------------------- ### CMake Project Setup Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Physics/DoublePendulum/CMakeLists.txt Initializes the CMake project, sets the C++ standard, and defines build options. Use this for basic project configuration. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(DoublePendulum) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) add_definitions(-DGTE_USE_LINUX -DGTE_USE_ROW_MAJOR -DGTE_USE_MAT_VEC -DGTE_USE_OPENGL -DGTE_DISABLE_PCH) add_compile_options(-c -Wall -Werror) if(BUILD_RELEASE_LIB) add_compile_definitions(NDEBUG) add_compile_options(-O3) else() add_compile_definitions(_DEBUG) add_compile_options(-g) endif() ``` -------------------------------- ### CMake Project Setup Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Graphics/CMakeLists.txt Configures CMake policy, sets the minimum required version, and defines the project name and version. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) set(GTE_VERSION_MAJOR 8) set(GTE_VERSION_MINOR 2) project(Graphics VERSION ${GTE_VERSION_MAJOR}.${GTE_VERSION_MINOR}) ``` -------------------------------- ### CMake Project Setup Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Intersection/IntersectTriangleBox/CMakeLists.txt Configures the CMake project, including minimum version, project name, build options, C++ standard, and compiler flags. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(IntersectTriangleBox) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) add_definitions(-DGTE_USE_LINUX -DGTE_USE_ROW_MAJOR -DGTE_USE_MAT_VEC -DGTE_USE_OPENGL -DGTE_DISABLE_PCH) add_compile_options(-c -Wall -Werror) if(BUILD_RELEASE_LIB) add_compile_definitions(NDEBUG) add_compile_options(-O3) else() add_compile_definitions(_DEBUG) add_compile_options(-g) endif() ``` -------------------------------- ### CMake Project Setup Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Geometrics/ConvexHull3D/CMakeLists.txt Initializes the CMake project, sets the minimum required version, and defines project name. Includes options for building release or shared libraries. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(ConvexHull3D) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) ``` -------------------------------- ### CMake Project Setup Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Intersection/MovingCircleRectangle/CMakeLists.txt Configures the CMake build system for the project, setting the minimum required version, project name, and build options. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(MovingCircleRectangle) ``` -------------------------------- ### Configure Include Directories Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Mathematics/CMakeLists.txt Sets the include paths for both build and installation environments. ```cmake target_include_directories(gtmathematics INTERFACE $ $ ) ``` -------------------------------- ### Generate Package Configuration Files Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Mathematics/CMakeLists.txt Creates and installs the version and configuration files required for find_package() support. ```cmake write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/gtmathematicsConfigVersion.cmake" VERSION ${PROJECT_VERSION} COMPATIBILITY SameMajorVersion ) configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/gtmathematicsConfig.cmake.in" # Template file "${CMAKE_CURRENT_BINARY_DIR}/gtmathematicsConfig.cmake" INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/gtmathematics ) install( FILES "${CMAKE_CURRENT_BINARY_DIR}/gtmathematicsConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/gtmathematicsConfigVersion.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/gtmathematics ) ``` -------------------------------- ### CMake Project Setup Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Physics/RoughPlaneParticle2/CMakeLists.txt Sets up the CMake project, defines build options, and configures C++ standards and compiler flags. Use this to define project name, C++ standard, and essential compiler settings. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(RoughPlaneParticle2) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) add_definitions(-DGTE_USE_LINUX -DGTE_USE_ROW_MAJOR -DGTE_USE_MAT_VEC -DGTE_USE_OPENGL -DGTE_DISABLE_PCH) add_compile_options(-c -Wall -Werror) if(BUILD_RELEASE_LIB) add_compile_definitions(NDEBUG) add_compile_options(-O3) else() add_compile_definitions(_DEBUG) add_compile_options(-g) endif() ``` -------------------------------- ### CMake Project Setup Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/SceneGraphs/BillboardNodes/CMakeLists.txt Sets up the CMake project, including minimum version, project name, and build options for release/shared libraries. It also defines C++ standard and compiler extensions. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(BillboardNodes) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) ``` -------------------------------- ### CMake Project Setup Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Physics/RoughPlaneParticle1/CMakeLists.txt Configures the CMake version, project name, C++ standard, and build options. It also defines preprocessor macros and compiler flags. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(RoughPlaneParticle1) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) add_definitions(-DGTE_USE_LINUX -DGTE_USE_ROW_MAJOR -DGTE_USE_MAT_VEC -DGTE_USE_OPENGL -DGTE_DISABLE_PCH) add_compile_options(-c -Wall -Werror) if(BUILD_RELEASE_LIB) add_compile_definitions(NDEBUG) add_compile_options(-O3) else() add_compile_definitions(_DEBUG) add_compile_options(-g) endif() ``` -------------------------------- ### CMake Project Setup Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Physics/GelatinCube/CMakeLists.txt Initializes the CMake project, sets the minimum required version, and defines project name. Includes options for building release or shared libraries and sets C++ standard to C++14. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(GelatinCube) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) ``` -------------------------------- ### CMake Project Setup Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Mathematics/ApproximateEllipsoid3/CMakeLists.txt Configures the CMake project, sets minimum version, and defines build options for release/shared libraries. It also sets C++ standard and compiler extensions. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() project(ApproximateEllipsoid3) cmake_minimum_required(VERSION 3.10) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) ``` -------------------------------- ### 3D Application with Window3 and Camera Source: https://context7.com/davideberly/geometrictools/llms.txt Illustrates the structure of a 3D graphics application using the Window3 base class. Includes camera initialization, mesh creation with custom vertex formats, trackball setup, and basic rendering loop. ```cpp #include #include #include using namespace gte; class MyWindow : public Window3 { public: MyWindow(Parameters& parameters) : Window3(parameters) { // Initialize camera: FOV, aspect ratio, near/far planes, // translation/rotation speeds, position, direction, up vector InitializeCamera(60.0f, GetAspectRatio(), 0.1f, 1000.0f, 0.1f, 0.01f, { 0.0f, 0.0f, -4.0f }, // Camera position { 0.0f, 0.0f, 1.0f }, // View direction { 0.0f, 1.0f, 0.0f }); // Up vector // Create visual effect mEffect = std::make_shared(mProgramFactory); // Create mesh (example: colored vertices) VertexFormat vformat; vformat.Bind(VASemantic::POSITION, DF_R32G32B32_FLOAT, 0); vformat.Bind(VASemantic::COLOR, DF_R32G32B32A32_FLOAT, 0); uint32_t numVertices = 8; auto vbuffer = std::make_shared(vformat, numVertices); // Fill vertex data... auto ibuffer = std::make_shared(IP_TRIMESH, 12, sizeof(uint32_t)); // Fill index data... mMesh = std::make_shared(vbuffer, ibuffer, mEffect); // Setup trackball for rotation mTrackBall.Attach(mMesh); mTrackBall.Update(); // Subscribe to projection-view-world matrix updates mPVWMatrices.Subscribe(mMesh->worldTransform, mEffect->GetPVWMatrixConstant()); mPVWMatrices.Update(); } virtual void OnIdle() override { // Handle camera movement if (mCameraRig.Move()) { mPVWMatrices.Update(); } // Render mEngine->ClearBuffers(); mEngine->Draw(mMesh); mEngine->DisplayColorBuffer(0); } private: std::shared_ptr mMesh; std::shared_ptr mEffect; }; // Main entry point int main(int, char const*[]) { Window::Parameters parameters(L"My 3D Application", 0, 0, 800, 600); auto window = TheWindowSystem.Create(parameters); TheWindowSystem.MessagePump(window, TheWindowSystem.NO_IDLE_LOOP); TheWindowSystem.Destroy(window); return 0; } ``` -------------------------------- ### CMake Project Setup Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Distance/DistanceSegments3/CMakeLists.txt Configures the minimum CMake version, project name, and build options like release and shared library builds. Sets C++ standard to 14 and enables compiler warnings. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(DistanceSegments3) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) add_definitions(-DGTE_USE_LINUX -DGTE_USE_ROW_MAJOR -DGTE_USE_MAT_VEC -DGTE_USE_OPENGL -DGTE_DISABLE_PCH) add_compile_options(-c -Wall -Werror) if(BUILD_RELEASE_LIB) add_compile_definitions(NDEBUG) add_compile_options(-O3) else() add_compile_definitions(_DEBUG) add_compile_options(-g) endif() ``` -------------------------------- ### CMake Project Setup and Options Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Graphics/StructuredBuffers/CMakeLists.txt Configures the CMake version, project name, and build options like release and shared library flags. Sets C++ standard to 14 and enables compiler warnings. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(StructuredBuffers) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) add_definitions(-DGTE_USE_LINUX -DGTE_USE_ROW_MAJOR -DGTE_USE_MAT_VEC -DGTE_USE_OPENGL -DGTE_DISABLE_PCH) add_compile_options(-c -Wall -Werror) if(BUILD_RELEASE_LIB) add_compile_definitions(NDEBUG) add_compile_options(-O3) else() add_compile_definitions(_DEBUG) add_compile_options(-g) endif() ``` -------------------------------- ### CMake Project Setup Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Physics/MassSprings3D/CMakeLists.txt Configures the CMake version, project name, and build options for the MassSprings3D project. Sets C++ standard to 14 and enables compiler warnings. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(MassSprings3D) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) add_definitions(-DGTE_USE_LINUX -DGTE_USE_ROW_MAJOR -DGTE_USE_MAT_VEC -DGTE_USE_OPENGL -DGTE_DISABLE_PCH) add_compile_options(-c -Wall -Werror) if(BUILD_RELEASE_LIB) add_compile_definitions(NDEBUG) add_compile_options(-O3) else() add_compile_definitions(_DEBUG) add_compile_options(-g) endif() ``` -------------------------------- ### CMake Project Setup and Versioning Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Imagics/CMakeLists.txt Configures the CMake build system, sets the project name to 'Imagics', and defines its version. Includes a policy setting for CMP0048. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) set(GTE_VERSION_MAJOR 8) set(GTE_VERSION_MINOR 2) project(Imagics VERSION ${GTE_VERSION_MAJOR}.${GTE_VERSION_MINOR}) ``` -------------------------------- ### CMake Project Setup Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Intersection/IntersectPlaneConvexPolyhedron/CMakeLists.txt Configures the CMake project, sets the C++ standard, and defines build options for release/shared libraries. It also sets compiler flags and definitions. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(IntersectPlaneConvexPolyhedron) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) add_definitions(-DGTE_USE_LINUX -DGTE_USE_ROW_MAJOR -DGTE_USE_MAT_VEC -DGTE_USE_OPENGL -DGTE_DISABLE_PCH) add_compile_options(-c -Wall -Werror) if(BUILD_RELEASE_LIB) add_compile_definitions(NDEBUG) add_compile_options(-O3) else() add_compile_definitions(_DEBUG) add_compile_options(-g) endif() set(GTE_ROOT ${PROJECT_SOURCE_DIR}/../../..) set(GTE_INC_DIR ${GTE_ROOT}) set(GTE_LIB_PREFIX ${GTE_ROOT}/lib/${CMAKE_BUILD_TYPE}) set(GTE_EXE_PREFIX ${PROJECT_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE}) if(BUILD_SHARED_LIB) set(GTE_LIB_DIR ${GTE_LIB_PREFIX}Shared) set(GTE_EXE_DIR ${GTE_EXE_PREFIX}Shared) else() set(GTE_LIB_DIR ${GTE_LIB_PREFIX}Static) set(GTE_EXE_DIR ${GTE_EXE_PREFIX}Static) endif() set(EXECUTABLE_OUTPUT_PATH ${GTE_EXE_DIR} CACHE PATH "Executable directory" FORCE) SET(EXECUTABLE_OUTPUT_PATH ${GTE_EXE_DIR}) ``` -------------------------------- ### CMake Project Setup Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Physics/RoughPlaneSolidBox/CMakeLists.txt Configures the CMake project, sets the C++ standard, and defines build options for release/debug and static/shared libraries. It also sets compiler flags and definitions. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(RoughPlaneSolidBox) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) add_definitions(-DGTE_USE_LINUX -DGTE_USE_ROW_MAJOR -DGTE_USE_MAT_VEC -DGTE_USE_OPENGL -DGTE_DISABLE_PCH) add_compile_options(-c -Wall -Werror) if(BUILD_RELEASE_LIB) add_compile_definitions(NDEBUG) add_compile_options(-O3) else() add_compile_definitions(_DEBUG) add_compile_options(-g) endif() set(GTE_ROOT ${PROJECT_SOURCE_DIR}/../../..) set(GTE_INC_DIR ${GTE_ROOT}) set(GTE_LIB_PREFIX ${GTE_ROOT}/lib/${CMAKE_BUILD_TYPE}) set(GTE_EXE_PREFIX ${PROJECT_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE}) if(BUILD_SHARED_LIB) set(GTE_LIB_DIR ${GTE_LIB_PREFIX}Shared) set(GTE_EXE_DIR ${GTE_EXE_PREFIX}Shared) else() set(GTE_LIB_DIR ${GTE_LIB_PREFIX}Static) set(GTE_EXE_DIR ${GTE_EXE_PREFIX}Static) endif() set(EXECUTABLE_OUTPUT_PATH ${GTE_EXE_DIR} CACHE PATH "Executable directory" FORCE) SET(EXECUTABLE_OUTPUT_PATH ${GTE_EXE_DIR}) ``` -------------------------------- ### CMake Project Setup Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Distance/DistanceRectangleBox/CMakeLists.txt Configures the CMake build system for the project, setting the minimum version, project name, C++ standard, and compile options. It also defines preprocessor macros for platform and library features. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(DistanceRectangleBox) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) add_definitions(-DGTE_USE_LINUX -DGTE_USE_ROW_MAJOR -DGTE_USE_MAT_VEC -DGTE_USE_OPENGL -DGTE_DISABLE_PCH) add_compile_options(-c -Wall -Werror) if(BUILD_RELEASE_LIB) add_compile_definitions(NDEBUG) add_compile_options(-O3) else() add_compile_definitions(_DEBUG) add_compile_options(-g) endif() ``` -------------------------------- ### CMake Project Setup Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Physics/CollisionsMovingSphereTriangle/CMakeLists.txt Configures the CMake version, project name, build options, and C++ standard. It also defines compiler flags and preprocessor definitions based on build type. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(CollisionsMovingSphereTriangle) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) add_definitions(-DGTE_USE_LINUX -DGTE_USE_ROW_MAJOR -DGTE_USE_MAT_VEC -DGTE_USE_OPENGL -DGTE_DISABLE_PCH) add_compile_options(-c -Wall -Werror) if(BUILD_RELEASE_LIB) add_compile_definitions(NDEBUG) add_compile_options(-O3) else() add_compile_definitions(_DEBUG) add_compile_options(-g) endif() ``` -------------------------------- ### CMake Project Setup Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Distance/DistanceAlignedBoxes/CMakeLists.txt Configures the CMake version, project name, and build options like release or shared libraries. Sets the C++ standard to C++14 and enables compiler warnings. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(DistanceAlignedBoxes) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) add_definitions(-DGTE_USE_LINUX -DGTE_USE_ROW_MAJOR -DGTE_USE_MAT_VEC -DGTE_USE_OPENGL -DGTE_DISABLE_PCH) add_compile_options(-c -Wall -Werror) if(BUILD_RELEASE_LIB) add_compile_definitions(NDEBUG) add_compile_options(-O3) else() add_compile_definitions(_DEBUG) add_compile_options(-g) endif() ``` -------------------------------- ### Create Vertex and Index Buffers Source: https://context7.com/davideberly/geometrictools/llms.txt Illustrates the setup of vertex and index buffers for mesh rendering. Defines a flexible vertex format and populates vertex and index data for a triangle mesh. Useful for defining mesh geometry for GPU processing. ```cpp #include #include #include using namespace gte; // Define vertex format VertexFormat vformat; vformat.Bind(VASemantic::POSITION, DF_R32G32B32_FLOAT, 0); vformat.Bind(VASemantic::NORMAL, DF_R32G32B32_FLOAT, 0); vformat.Bind(VASemantic::TEXCOORD, DF_R32G32_FLOAT, 0); vformat.Bind(VASemantic::COLOR, DF_R32G32B32A32_FLOAT, 0); // Create vertex buffer uint32_t numVertices = 100; auto vbuffer = std::make_shared(vformat, numVertices); // Define a vertex structure matching the format struct Vertex { Vector3 position; Vector3 normal; Vector2 texcoord; Vector4 color; }; // Access and fill vertex data Vertex* vertices = vbuffer->Get(); for (uint32_t i = 0; i < numVertices; ++i) { vertices[i].position = Vector3(/* ... */); vertices[i].normal = Vector3(0.0f, 1.0f, 0.0f); vertices[i].texcoord = Vector2(0.0f, 0.0f); vertices[i].color = Vector4(1.0f, 1.0f, 1.0f, 1.0f); } // Create index buffer (triangle mesh) uint32_t numTriangles = 50; auto ibuffer = std::make_shared(IP_TRIMESH, numTriangles, sizeof(uint32_t)); // Fill index data auto* indices = ibuffer->Get(); for (uint32_t i = 0; i < numTriangles; ++i) { indices[3 * i + 0] = /* vertex index 0 */; indices[3 * i + 1] = /* vertex index 1 */; indices[3 * i + 2] = /* vertex index 2 */; } // Get channel data by semantic std::set requiredTypes = { DF_R32G32B32_FLOAT }; char* positionChannel = vbuffer->GetChannel(VASemantic::POSITION, 0, requiredTypes); // Standard vs. structured buffer usage bool isStandard = vbuffer->StandardUsage(); ``` -------------------------------- ### CMake Project Setup and Versioning Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Physics/CMakeLists.txt Configures the CMake build system, sets the project name to 'Physics', and defines its version. It also enables the CMP0048 policy to allow the VERSION keyword in the project() statement. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) set(GTE_VERSION_MAJOR 8) set(GTE_VERSION_MINOR 2) project(Physics VERSION ${GTE_VERSION_MAJOR}.${GTE_VERSION_MINOR}) ``` -------------------------------- ### Create Geometric Primitives with MeshFactory Source: https://context7.com/davideberly/geometrictools/llms.txt Demonstrates the setup and usage of MeshFactory to generate common geometric primitives like spheres, boxes, cylinders, tori, rectangles, and disks. Includes platonic solids and accessing mesh data. ```cpp #include #include using namespace gte; // Setup vertex format VertexFormat vformat; vformat.Bind(VASemantic::POSITION, DF_R32G32B32_FLOAT, 0); vformat.Bind(VASemantic::NORMAL, DF_R32G32B32_FLOAT, 0); vformat.Bind(VASemantic::TEXCOORD, DF_R32G32_FLOAT, 0); // Create mesh factory MeshFactory factory(vformat); factory.SetVertexBufferUsage(Resource::Usage::DYNAMIC_UPDATE); factory.SetIndexFormat(true); // Use 32-bit indices factory.SetOutside(true); // Triangles face outward // Create geometric primitives std::shared_ptr sphere = factory.CreateSphere(16, 32, 1.0f); // numZSamples=16, numRadialSamples=32, radius=1.0 std::shared_ptr box = factory.CreateBox(1.0f, 2.0f, 0.5f); // xExtent=1, yExtent=2, zExtent=0.5 (half-lengths) std::shared_ptr cylinder = factory.CreateCylinderClosed(8, 16, 0.5f, 2.0f); // numAxisSamples=8, numRadialSamples=16, radius=0.5, height=2.0 std::shared_ptr torus = factory.CreateTorus(32, 16, 2.0f, 0.5f); // numCircleSamples=32, numRadialSamples=16, outerRadius=2.0, innerRadius=0.5 std::shared_ptr rectangle = factory.CreateRectangle(4, 4, 1.0f, 1.0f); // numXSamples=4, numYSamples=4, xExtent=1.0, yExtent=1.0 std::shared_ptr disk = factory.CreateDisk(4, 16, 1.0f); // numShellSamples=4, numRadialSamples=16, radius=1.0 // Platonic solids (inscribed in unit sphere) std::shared_ptr tetrahedron = factory.CreateTetrahedron(); std::shared_ptr cube = factory.CreateHexahedron(); std::shared_ptr octahedron = factory.CreateOctahedron(); std::shared_ptr dodecahedron = factory.CreateDodecahedron(); std::shared_ptr icosahedron = factory.CreateIcosahedron(); // Access mesh data auto vbuffer = sphere->GetVertexBuffer(); auto ibuffer = sphere->GetIndexBuffer(); uint32_t numVertices = vbuffer->GetNumElements(); uint32_t numTriangles = ibuffer->GetNumPrimitives(); ``` -------------------------------- ### CMake Project Setup Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/SceneGraphs/BlendedAnimations/CMakeLists.txt Configures the CMake build system for the BlendedAnimations project. Sets C++ standard to 14, enables compiler warnings, and defines output paths for executables and libraries based on build type and shared library options. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(BlendedAnimations) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) add_definitions(-DGTE_USE_LINUX -DGTE_USE_ROW_MAJOR -DGTE_USE_MAT_VEC -DGTE_USE_OPENGL -DGTE_DISABLE_PCH) add_compile_options(-c -Wall -Werror) if(BUILD_RELEASE_LIB) add_compile_definitions(NDEBUG) add_compile_options(-O3) else() add_compile_definitions(_DEBUG) add_compile_options(-g) endif() set(GTE_ROOT ${PROJECT_SOURCE_DIR}/../../..) set(GTE_INC_DIR ${GTE_ROOT}) set(GTE_LIB_PREFIX ${GTE_ROOT}/lib/${CMAKE_BUILD_TYPE}) set(GTE_EXE_PREFIX ${PROJECT_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE}) if(BUILD_SHARED_LIB) set(GTE_LIB_DIR ${GTE_LIB_PREFIX}Shared) set(GTE_EXE_DIR ${GTE_EXE_PREFIX}Shared) else() set(GTE_LIB_DIR ${GTE_LIB_PREFIX}Static) set(GTE_EXE_DIR ${GTE_EXE_PREFIX}Static) endif() set(EXECUTABLE_OUTPUT_PATH ${GTE_EXE_DIR} CACHE PATH "Executable directory" FORCE) SET(EXECUTABLE_OUTPUT_PATH ${GTE_EXE_DIR}) include_directories(${GTE_INC_DIR}) add_executable(${PROJECT_NAME} ${PROJECT_NAME}Main.cpp ${PROJECT_NAME}Window3.cpp BipedManager.cpp) find_package(PNG REQUIRED) find_package(Threads REQUIRED) target_link_directories(${PROJECT_NAME} PUBLIC ${GTE_LIB_DIR}) target_link_libraries(${PROJECT_NAME} gtapplications gtmathematicsgpu gtgraphics GL EGL X11 PNG::PNG Threads::Threads) ``` -------------------------------- ### Project Configuration Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Imagics/GpuGaussianBlur2/CMakeLists.txt Sets up the minimum CMake version, project name, build options, and C++ standard. ```cmake cmake_minimum_required(VERSION 3.10) project(GpuGaussianBlur2) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) ``` -------------------------------- ### Path and Dependency Configuration Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Geometrics/VertexCollapseMesh/CMakeLists.txt Sets up directory paths for libraries and executables, and links necessary system and framework dependencies. ```cmake set(GTE_ROOT ${PROJECT_SOURCE_DIR}/../../..) set(GTE_INC_DIR ${GTE_ROOT}) set(GTE_LIB_PREFIX ${GTE_ROOT}/lib/${CMAKE_BUILD_TYPE}) set(GTE_EXE_PREFIX ${PROJECT_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE}) if(BUILD_SHARED_LIB) set(GTE_LIB_DIR ${GTE_LIB_PREFIX}Shared) set(GTE_EXE_DIR ${GTE_EXE_PREFIX}Shared) else() set(GTE_LIB_DIR ${GTE_LIB_PREFIX}Static) set(GTE_EXE_DIR ${GTE_EXE_PREFIX}Static) endif() set(EXECUTABLE_OUTPUT_PATH ${GTE_EXE_DIR} CACHE PATH "Executable directory" FORCE) SET(EXECUTABLE_OUTPUT_PATH ${GTE_EXE_DIR}) include_directories(${GTE_INC_DIR}) add_executable(${PROJECT_NAME} ${PROJECT_NAME}Main.cpp ${PROJECT_NAME}Window3.cpp) find_package(PNG REQUIRED) find_package(Threads REQUIRED) target_link_directories(${PROJECT_NAME} PUBLIC ${GTE_LIB_DIR}) target_link_libraries(${PROJECT_NAME} gtapplications gtmathematicsgpu gtgraphics GL EGL X11 PNG::PNG Threads::Threads) ``` -------------------------------- ### Project Configuration and Executable Definition Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Graphics/IEEEFloatingPoint/CMakeLists.txt Sets up the CMake project, defines build options, and specifies the source files for the main executable. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(IEEEFloatingPoint) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) include_directories(${GTE_INC_DIR}) add_executable(${PROJECT_NAME} ${PROJECT_NAME}Main.cpp ${PROJECT_NAME}Console.cpp) ``` -------------------------------- ### Directory Configuration Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Imagics/ExtractLevelSurfaces/CMakeLists.txt Sets up include directories and defines output paths for libraries and executables based on build type and library sharing options. ```cmake set(GTE_ROOT ${PROJECT_SOURCE_DIR}/../../..) set(GTE_INC_DIR ${GTE_ROOT}) set(GTE_LIB_PREFIX ${GTE_ROOT}/lib/${CMAKE_BUILD_TYPE}) set(GTE_EXE_PREFIX ${PROJECT_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE}) ``` ```cmake if(BUILD_SHARED_LIB) set(GTE_LIB_DIR ${GTE_LIB_PREFIX}Shared) set(GTE_EXE_DIR ${GTE_EXE_PREFIX}Shared) else() set(GTE_LIB_DIR ${GTE_LIB_PREFIX}Static) set(GTE_EXE_DIR ${GTE_EXE_PREFIX}Static) endif() ``` ```cmake set(EXECUTABLE_OUTPUT_PATH ${GTE_EXE_DIR} CACHE PATH "Executable directory" FORCE) SET(EXECUTABLE_OUTPUT_PATH ${GTE_EXE_DIR}) ``` ```cmake include_directories(${GTE_INC_DIR}) ``` -------------------------------- ### CMake Project Configuration Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Imagics/ExtractLevelSurfaces/CMakeLists.txt Sets up the CMake build system for the project, including minimum version, project name, and build options. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(ExtractLevelSurfaces) ``` ```cmake option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) ``` -------------------------------- ### Package Finding and Library Linking Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Physics/DoublePendulum/CMakeLists.txt Finds required external packages (PNG, Threads) and links the project executable to GTE libraries and system libraries. Ensure the found packages are installed and available. ```cmake find_package(PNG REQUIRED) find_package(Threads REQUIRED) target_link_directories(${PROJECT_NAME} PUBLIC ${GTE_LIB_DIR}) target_link_libraries(${PROJECT_NAME} gtapplications gtmathematicsgpu gtgraphics GL EGL X11 PNG::PNG Threads::Threads) ``` -------------------------------- ### CMake Project Configuration Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Geometrics/IncrementalDelaunay2/CMakeLists.txt Sets up the CMake build system for the project, including minimum version, project name, and build type. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(IncrementalDelaunay2) ``` -------------------------------- ### Initialize CMake Project Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Geometrics/CMakeLists.txt Specifies the minimum required CMake version and sets the project name and version. ```cmake cmake_minimum_required(VERSION 3.10) project(Geometrics VERSION ${GTE_VERSION_MAJOR}.${GTE_VERSION_MINOR}) ``` -------------------------------- ### Project Initialization and Options Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/SceneGraphs/MorphControllers/CMakeLists.txt Initializes the CMake project and defines build options such as release and shared library builds. ```cmake cmake_minimum_required(VERSION 3.10) project(MorphControllers) ``` ```cmake option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) ``` -------------------------------- ### CMake Project Configuration Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/SceneGraphs/Picking/CMakeLists.txt Initializes the project, sets C++ standards, and configures build options for the Picking application. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(Picking) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) add_definitions(-DGTE_USE_LINUX -DGTE_USE_ROW_MAJOR -DGTE_USE_MAT_VEC -DGTE_USE_OPENGL -DGTE_DISABLE_PCH) add_compile_options(-c -Wall -Werror) if(BUILD_RELEASE_LIB) add_compile_definitions(NDEBUG) add_compile_options(-O3) else() add_compile_definitions(_DEBUG) add_compile_options(-g) endif() set(GTE_ROOT ${PROJECT_SOURCE_DIR}/../../..) set(GTE_INC_DIR ${GTE_ROOT}) set(GTE_LIB_PREFIX ${GTE_ROOT}/lib/${CMAKE_BUILD_TYPE}) set(GTE_EXE_PREFIX ${PROJECT_SOURCE_DIR}/build/${CMAKE_BUILD_TYPE}) if(BUILD_SHARED_LIB) set(GTE_LIB_DIR ${GTE_LIB_PREFIX}Shared) set(GTE_EXE_DIR ${GTE_EXE_PREFIX}Shared) else() set(GTE_LIB_DIR ${GTE_LIB_PREFIX}Static) set(GTE_EXE_DIR ${GTE_EXE_PREFIX}Static) endif() set(EXECUTABLE_OUTPUT_PATH ${GTE_EXE_DIR} CACHE PATH "Executable directory" FORCE) SET(EXECUTABLE_OUTPUT_PATH ${GTE_EXE_DIR}) include_directories(${GTE_INC_DIR}) add_executable(${PROJECT_NAME} ${PROJECT_NAME}Main.cpp ${PROJECT_NAME}Window3.cpp) find_package(PNG REQUIRED) find_package(Threads REQUIRED) target_link_directories(${PROJECT_NAME} PUBLIC ${GTE_LIB_DIR}) target_link_libraries(${PROJECT_NAME} gtapplications gtmathematicsgpu gtgraphics GL EGL X11 PNG::PNG Threads::Threads) ``` -------------------------------- ### Define Project and Build Options Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Graphics/TextureArrays/CMakeLists.txt Initializes the project and defines build options for release and shared libraries. These options control compilation flags and library output. ```cmake cmake_minimum_required(VERSION 3.10) project(TextureArrays) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) ``` -------------------------------- ### Project Configuration and Options Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Graphics/VertexTextures/CMakeLists.txt Sets the minimum CMake version, project name, and build options like release and shared library builds. ```cmake cmake_minimum_required(VERSION 3.10) project(VertexTextures) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) ``` -------------------------------- ### CMake Project Configuration Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/SceneGraphs/IKControllers/CMakeLists.txt Initializes the project, sets C++ standards, and defines build options for the IKControllers project. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(IKControllers) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) add_definitions(-DGTE_USE_LINUX -DGTE_USE_ROW_MAJOR -DGTE_USE_MAT_VEC -DGTE_USE_OPENGL -DGTE_DISABLE_PCH) add_compile_options(-c -Wall -Werror) if(BUILD_RELEASE_LIB) add_compile_definitions(NDEBUG) add_compile_options(-O3) else() add_compile_definitions(_DEBUG) add_compile_options(-g) endif() ``` -------------------------------- ### CMake Project Configuration Source: https://github.com/davideberly/geometrictools/blob/master/GTE/Samples/Imagics/ExtractLevelCurves/CMakeLists.txt Initializes the project, sets C++ standards, and defines build options for the GeometricTools environment. ```cmake if(COMMAND cmake_policy) # Allow VERSION in the project() statement. cmake_policy(SET CMP0048 NEW) endif() cmake_minimum_required(VERSION 3.10) project(ExtractLevelCurves) option(BUILD_RELEASE_LIB "Build release library" OFF) option(BUILD_SHARED_LIB "Build shared library" OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) add_definitions(-DGTE_USE_LINUX -DGTE_USE_ROW_MAJOR -DGTE_USE_MAT_VEC -DGTE_USE_OPENGL -DGTE_DISABLE_PCH) add_compile_options(-c -Wall -Werror) if(BUILD_RELEASE_LIB) add_compile_definitions(NDEBUG) add_compile_options(-O3) else() add_compile_definitions(_DEBUG) add_compile_options(-g) endif() ```