mirror of
https://github.com/orange-cpp/omath.git
synced 2026-04-19 12:03:26 +00:00
Merge pull request #155 from orange-cpp/feaute/examples-folders
retructurized examples
This commit is contained in:
@@ -131,9 +131,8 @@ set_target_properties(
|
|||||||
CXX_STANDARD_REQUIRED ON)
|
CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
if(OMATH_STATIC_MSVC_RUNTIME_LIBRARY)
|
if(OMATH_STATIC_MSVC_RUNTIME_LIBRARY)
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
set_target_properties(${PROJECT_NAME} PROPERTIES MSVC_RUNTIME_LIBRARY
|
||||||
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
|
"MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(OMATH_USE_AVX2)
|
if(OMATH_USE_AVX2)
|
||||||
|
|||||||
@@ -1,44 +1,7 @@
|
|||||||
project(examples)
|
add_subdirectory(example_barycentric)
|
||||||
|
add_subdirectory(example_glfw3)
|
||||||
add_executable(example_projection_matrix_builder example_proj_mat_builder.cpp)
|
add_subdirectory(example_proj_mat_builder)
|
||||||
set_target_properties(
|
add_subdirectory(example_signature_scan)
|
||||||
example_projection_matrix_builder
|
|
||||||
PROPERTIES CXX_STANDARD 23
|
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
|
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
|
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}")
|
|
||||||
target_link_libraries(example_projection_matrix_builder PRIVATE omath::omath)
|
|
||||||
|
|
||||||
add_executable(example_signature_scan example_signature_scan.cpp)
|
|
||||||
set_target_properties(
|
|
||||||
example_signature_scan
|
|
||||||
PROPERTIES CXX_STANDARD 23
|
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
|
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
|
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}")
|
|
||||||
target_link_libraries(example_signature_scan PRIVATE omath::omath)
|
|
||||||
|
|
||||||
add_executable(example_glfw3 example_glfw3.cpp)
|
|
||||||
set_target_properties(
|
|
||||||
example_glfw3
|
|
||||||
PROPERTIES CXX_STANDARD 23
|
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
|
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
|
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}")
|
|
||||||
|
|
||||||
add_executable(example_barycentric example_barycentric.cpp)
|
|
||||||
set_target_properties(
|
|
||||||
example_barycentric
|
|
||||||
PROPERTIES CXX_STANDARD 23
|
|
||||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
|
|
||||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
|
|
||||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}")
|
|
||||||
target_link_libraries(example_barycentric PRIVATE omath::omath GLEW::GLEW glfw OpenGL::GL)
|
|
||||||
|
|
||||||
find_package(OpenGL)
|
|
||||||
find_package(GLEW REQUIRED)
|
|
||||||
find_package(glfw3 CONFIG REQUIRED)
|
|
||||||
target_link_libraries(example_glfw3 PRIVATE omath::omath GLEW::GLEW glfw OpenGL::GL)
|
|
||||||
|
|
||||||
if(OMATH_ENABLE_VALGRIND)
|
if(OMATH_ENABLE_VALGRIND)
|
||||||
omath_setup_valgrind(example_projection_matrix_builder)
|
omath_setup_valgrind(example_projection_matrix_builder)
|
||||||
|
|||||||
14
examples/example_barycentric/CMakeLists.txt
Normal file
14
examples/example_barycentric/CMakeLists.txt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
project(example_barycentric)
|
||||||
|
|
||||||
|
add_executable(${PROJECT_NAME} example_barycentric.cpp)
|
||||||
|
set_target_properties(
|
||||||
|
${PROJECT_NAME}
|
||||||
|
PROPERTIES CXX_STANDARD 23
|
||||||
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
|
||||||
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}")
|
||||||
|
|
||||||
|
find_package(OpenGL)
|
||||||
|
find_package(GLEW REQUIRED)
|
||||||
|
find_package(glfw3 CONFIG REQUIRED)
|
||||||
|
target_link_libraries(${PROJECT_NAME} PRIVATE omath::omath GLEW::GLEW glfw OpenGL::GL)
|
||||||
14
examples/example_glfw3/CMakeLists.txt
Normal file
14
examples/example_glfw3/CMakeLists.txt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
project(example_glfw3)
|
||||||
|
|
||||||
|
add_executable(${PROJECT_NAME} example_glfw3.cpp)
|
||||||
|
set_target_properties(
|
||||||
|
${PROJECT_NAME}
|
||||||
|
PROPERTIES CXX_STANDARD 23
|
||||||
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
|
||||||
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}")
|
||||||
|
|
||||||
|
find_package(OpenGL)
|
||||||
|
find_package(GLEW REQUIRED)
|
||||||
|
find_package(glfw3 CONFIG REQUIRED)
|
||||||
|
target_link_libraries(${PROJECT_NAME} PRIVATE omath::omath GLEW::GLEW glfw OpenGL::GL)
|
||||||
10
examples/example_proj_mat_builder/CMakeLists.txt
Normal file
10
examples/example_proj_mat_builder/CMakeLists.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
project(example_projection_matrix_builder)
|
||||||
|
|
||||||
|
add_executable(${PROJECT_NAME} example_proj_mat_builder.cpp)
|
||||||
|
set_target_properties(
|
||||||
|
${PROJECT_NAME}
|
||||||
|
PROPERTIES CXX_STANDARD 23
|
||||||
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
|
||||||
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}")
|
||||||
|
target_link_libraries(${PROJECT_NAME} PRIVATE omath::omath)
|
||||||
10
examples/example_signature_scan/CMakeLists.txt
Normal file
10
examples/example_signature_scan/CMakeLists.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
project(example_signature_scan)
|
||||||
|
|
||||||
|
add_executable(${PROJECT_NAME} example_signature_scan.cpp)
|
||||||
|
set_target_properties(
|
||||||
|
${PROJECT_NAME}
|
||||||
|
PROPERTIES CXX_STANDARD 23
|
||||||
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
|
||||||
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}")
|
||||||
|
target_link_libraries(${PROJECT_NAME} PRIVATE omath::omath)
|
||||||
@@ -15,7 +15,10 @@ endif()
|
|||||||
set(EXAMPLES_BIN_DIR "${PROJECT_ROOT}/out/${CMAKE_BUILD_TYPE}")
|
set(EXAMPLES_BIN_DIR "${PROJECT_ROOT}/out/${CMAKE_BUILD_TYPE}")
|
||||||
|
|
||||||
if(NOT EXISTS "${EXAMPLES_BIN_DIR}")
|
if(NOT EXISTS "${EXAMPLES_BIN_DIR}")
|
||||||
message(FATAL_ERROR "Examples binary directory not found: ${EXAMPLES_BIN_DIR}. Please build the project first.")
|
message(
|
||||||
|
FATAL_ERROR
|
||||||
|
"Examples binary directory not found: ${EXAMPLES_BIN_DIR}. Please build the project first."
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS "Looking for benchmark executables in: ${EXAMPLES_BIN_DIR}")
|
message(STATUS "Looking for benchmark executables in: ${EXAMPLES_BIN_DIR}")
|
||||||
@@ -48,11 +51,8 @@ foreach(EXAMPLE_PATH ${EXAMPLE_FILES})
|
|||||||
message(STATUS "Running benchmark: ${FILENAME}")
|
message(STATUS "Running benchmark: ${FILENAME}")
|
||||||
message(STATUS "-------------------------------------------------")
|
message(STATUS "-------------------------------------------------")
|
||||||
|
|
||||||
execute_process(
|
execute_process(COMMAND "${EXAMPLE_PATH}" WORKING_DIRECTORY "${PROJECT_ROOT}"
|
||||||
COMMAND "${EXAMPLE_PATH}"
|
RESULT_VARIABLE EXIT_CODE)
|
||||||
WORKING_DIRECTORY "${PROJECT_ROOT}"
|
|
||||||
RESULT_VARIABLE EXIT_CODE
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT EXIT_CODE EQUAL 0)
|
if(NOT EXIT_CODE EQUAL 0)
|
||||||
message(WARNING "Benchmark ${FILENAME} exited with error code: ${EXIT_CODE}")
|
message(WARNING "Benchmark ${FILENAME} exited with error code: ${EXIT_CODE}")
|
||||||
|
|||||||
@@ -15,7 +15,10 @@ endif()
|
|||||||
set(EXAMPLES_BIN_DIR "${PROJECT_ROOT}/out/${CMAKE_BUILD_TYPE}")
|
set(EXAMPLES_BIN_DIR "${PROJECT_ROOT}/out/${CMAKE_BUILD_TYPE}")
|
||||||
|
|
||||||
if(NOT EXISTS "${EXAMPLES_BIN_DIR}")
|
if(NOT EXISTS "${EXAMPLES_BIN_DIR}")
|
||||||
message(FATAL_ERROR "Examples binary directory not found: ${EXAMPLES_BIN_DIR}. Please build the project first.")
|
message(
|
||||||
|
FATAL_ERROR
|
||||||
|
"Examples binary directory not found: ${EXAMPLES_BIN_DIR}. Please build the project first."
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS "Looking for example executables in: ${EXAMPLES_BIN_DIR}")
|
message(STATUS "Looking for example executables in: ${EXAMPLES_BIN_DIR}")
|
||||||
@@ -48,11 +51,8 @@ foreach(EXAMPLE_PATH ${EXAMPLE_FILES})
|
|||||||
message(STATUS "Running example: ${FILENAME}")
|
message(STATUS "Running example: ${FILENAME}")
|
||||||
message(STATUS "-------------------------------------------------")
|
message(STATUS "-------------------------------------------------")
|
||||||
|
|
||||||
execute_process(
|
execute_process(COMMAND "${EXAMPLE_PATH}" WORKING_DIRECTORY "${PROJECT_ROOT}"
|
||||||
COMMAND "${EXAMPLE_PATH}"
|
RESULT_VARIABLE EXIT_CODE)
|
||||||
WORKING_DIRECTORY "${PROJECT_ROOT}"
|
|
||||||
RESULT_VARIABLE EXIT_CODE
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT EXIT_CODE EQUAL 0)
|
if(NOT EXIT_CODE EQUAL 0)
|
||||||
message(WARNING "Example ${FILENAME} exited with error code: ${EXIT_CODE}")
|
message(WARNING "Example ${FILENAME} exited with error code: ${EXIT_CODE}")
|
||||||
|
|||||||
@@ -15,7 +15,10 @@ endif()
|
|||||||
set(EXAMPLES_BIN_DIR "${PROJECT_ROOT}/out/${CMAKE_BUILD_TYPE}")
|
set(EXAMPLES_BIN_DIR "${PROJECT_ROOT}/out/${CMAKE_BUILD_TYPE}")
|
||||||
|
|
||||||
if(NOT EXISTS "${EXAMPLES_BIN_DIR}")
|
if(NOT EXISTS "${EXAMPLES_BIN_DIR}")
|
||||||
message(FATAL_ERROR "Examples binary directory not found: ${EXAMPLES_BIN_DIR}. Please build the project first.")
|
message(
|
||||||
|
FATAL_ERROR
|
||||||
|
"Examples binary directory not found: ${EXAMPLES_BIN_DIR}. Please build the project first."
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS "Looking for unit test executables in: ${EXAMPLES_BIN_DIR}")
|
message(STATUS "Looking for unit test executables in: ${EXAMPLES_BIN_DIR}")
|
||||||
@@ -48,11 +51,8 @@ foreach(EXAMPLE_PATH ${EXAMPLE_FILES})
|
|||||||
message(STATUS "Running unit_tests: ${FILENAME}")
|
message(STATUS "Running unit_tests: ${FILENAME}")
|
||||||
message(STATUS "-------------------------------------------------")
|
message(STATUS "-------------------------------------------------")
|
||||||
|
|
||||||
execute_process(
|
execute_process(COMMAND "${EXAMPLE_PATH}" WORKING_DIRECTORY "${PROJECT_ROOT}"
|
||||||
COMMAND "${EXAMPLE_PATH}"
|
RESULT_VARIABLE EXIT_CODE)
|
||||||
WORKING_DIRECTORY "${PROJECT_ROOT}"
|
|
||||||
RESULT_VARIABLE EXIT_CODE
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT EXIT_CODE EQUAL 0)
|
if(NOT EXIT_CODE EQUAL 0)
|
||||||
message(WARNING "Example ${FILENAME} exited with error code: ${EXIT_CODE}")
|
message(WARNING "Example ${FILENAME} exited with error code: ${EXIT_CODE}")
|
||||||
|
|||||||
15
scripts/cmake-format.sh
Normal file
15
scripts/cmake-format.sh
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Format all CMakeLists.txt and *.cmake files in the repo (excluding common build dirs)
|
||||||
|
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
|
|
||||||
|
cd "$REPO_ROOT"
|
||||||
|
|
||||||
|
find . \
|
||||||
|
-path "./build" -prune -o \
|
||||||
|
-path "./cmake-build*" -prune -o \
|
||||||
|
-path "./out" -prune -o \
|
||||||
|
-path "./.git" -prune -o \
|
||||||
|
\( -name "CMakeLists.txt" -o -name "*.cmake" \) -print0 \
|
||||||
|
| xargs -0 cmake-format -i
|
||||||
Reference in New Issue
Block a user