improved cmake, removed useless cmake files

This commit is contained in:
2025-04-30 21:26:25 +03:00
parent faeef594b9
commit 998c8f3a43
14 changed files with 30 additions and 74 deletions

View File

@@ -15,10 +15,14 @@ option(OMATH_STATIC_MSVC_RUNTIME_LIBRARY "Force Omath to link static runtime" O
option(OMATH_SUPRESS_SAFETY_CHECKS "Supress some safety checks in release build to improve general performance" ON) option(OMATH_SUPRESS_SAFETY_CHECKS "Supress some safety checks in release build to improve general performance" ON)
option(OMATH_USE_UNITY_BUILD "Will enable unity build to speed up compilation" ON) option(OMATH_USE_UNITY_BUILD "Will enable unity build to speed up compilation" ON)
file(GLOB_RECURSE OMATH_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp")
file(GLOB_RECURSE OMATH_HEADERS CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp")
if (OMATH_BUILD_AS_SHARED_LIBRARY) if (OMATH_BUILD_AS_SHARED_LIBRARY)
add_library(omath SHARED source/matrix.cpp) add_library(omath SHARED ${OMATH_SOURCES} ${OMATH_HEADERS})
else () else ()
add_library(omath STATIC source/matrix.cpp) add_library(omath STATIC ${OMATH_SOURCES} ${OMATH_HEADERS})
endif () endif ()
message(STATUS "Building on ${CMAKE_HOST_SYSTEM_NAME}") message(STATUS "Building on ${CMAKE_HOST_SYSTEM_NAME}")
@@ -76,8 +80,6 @@ endif()
target_compile_features(omath PUBLIC cxx_std_23) target_compile_features(omath PUBLIC cxx_std_23)
add_subdirectory(source)
if (OMATH_BUILD_TESTS) if (OMATH_BUILD_TESTS)
add_subdirectory(extlibs) add_subdirectory(extlibs)
add_subdirectory(tests) add_subdirectory(tests)

View File

@@ -1 +0,0 @@
target_sources(omath PRIVATE box.cpp)

View File

@@ -1,11 +0,0 @@
target_sources(omath PRIVATE
matrix.cpp
color.cpp
)
add_subdirectory(projectile_prediction)
add_subdirectory(pathfinding)
add_subdirectory(projection)
add_subdirectory(collision)
add_subdirectory(engines)
add_subdirectory(3d_primitives)

View File

@@ -1,3 +0,0 @@
target_sources(omath PRIVATE
line_tracer.cpp
)

View File

@@ -1,4 +0,0 @@
add_subdirectory(source_engine)
add_subdirectory(opengl_engine)
add_subdirectory(iw_engine)
add_subdirectory(unity_engine)

View File

@@ -1 +0,0 @@
target_sources(omath PRIVATE camera.cpp formulas.cpp)

View File

@@ -1 +0,0 @@
target_sources(omath PRIVATE camera.cpp formulas.cpp)

View File

@@ -1 +0,0 @@
target_sources(omath PRIVATE camera.cpp formulas.cpp)

View File

@@ -1 +0,0 @@
target_sources(omath PRIVATE formulas.cpp camera.cpp)

View File

@@ -1 +0,0 @@
target_sources(omath PRIVATE navigation_mesh.cpp a_star.cpp)

View File

@@ -1 +0,0 @@
target_sources(omath PRIVATE proj_pred_engine_legacy.cpp projectile.cpp target.cpp proj_pred_engine_avx2.cpp proj_pred_engine.cpp)

View File

@@ -1 +0,0 @@
target_sources(omath PRIVATE camera.cpp)

View File

@@ -1,33 +1,13 @@
enable_testing() enable_testing()
project(unit-tests) project(unit_tests)
include(GoogleTest) include(GoogleTest)
add_executable(unit-tests
general/unit_test_prediction.cpp
general/unit_test_matrix.cpp
general/unit_test_mat.cpp
general/unit_test_a_star.cpp
general/unit_test_projection.cpp
general/unit_test_vector3.cpp
general/unit_test_vector2.cpp
general/unit_test_color.cpp
general/unit_test_vector4.cpp
general/unit_test_line_trace.cpp
general/unit_test_angles.cpp
general/unit_test_view_angles.cpp
general/unit_test_angle.cpp
general/unit_test_triangle.cpp
general/unit_test_box_primitive.cpp
engines/unit_test_open_gl.cpp file(GLOB_RECURSE UNIT_TESTS_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
engines/unit_test_unity_engine.cpp add_executable(unit_tests ${UNIT_TESTS_SOURCES})
engines/unit_test_source_engine.cpp
engines/unit_test_iw_engine.cpp
) set_target_properties(unit_tests PROPERTIES
set_target_properties(unit-tests PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
UNITY_BUILD ON UNITY_BUILD ON
@@ -36,6 +16,6 @@ set_target_properties(unit-tests PROPERTIES
CXX_STANDARD_REQUIRED ON) CXX_STANDARD_REQUIRED ON)
target_link_libraries(unit-tests PRIVATE gtest gtest_main omath::omath) target_link_libraries(unit_tests PRIVATE gtest gtest_main omath::omath)
gtest_discover_tests(unit-tests) gtest_discover_tests(unit_tests)

View File

@@ -5,7 +5,7 @@
#include <omath/engines/unity_engine/camera.hpp> #include <omath/engines/unity_engine/camera.hpp>
#include <omath/engines/unity_engine/constants.hpp> #include <omath/engines/unity_engine/constants.hpp>
#include <omath/engines/unity_engine/formulas.hpp> #include <omath/engines/unity_engine/formulas.hpp>
#include <print>
TEST(UnitTestUnityEngine, ForwardVector) TEST(UnitTestUnityEngine, ForwardVector)
{ {