Skip to content

Commit bfada22

Browse files
authored
Merge pull request #64 from orange-cpp/feature/cpp_modules
migrated to modules
2 parents e8f4021 + fcbdefb commit bfada22

File tree

102 files changed

+1365
-2030
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+1365
-2030
lines changed

.idea/editor.xml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CMakeLists.txt

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
cmake_minimum_required(VERSION 3.26)
1+
cmake_minimum_required(VERSION 3.31)
22

33
project(omath VERSION 3.5.0 LANGUAGES CXX)
44

55
include(CMakePackageConfigHelpers)
6-
6+
include(GNUInstallDirs)
77

88
option(OMATH_BUILD_TESTS "Build unit tests" ${PROJECT_IS_TOP_LEVEL})
99
option(OMATH_THREAT_WARNING_AS_ERROR "Set highest level of warnings and force compiler to treat them as errors" ON)
@@ -13,7 +13,7 @@ option(OMATH_IMGUI_INTEGRATION "Omath will define method to convert omath types
1313
option(OMATH_BUILD_EXAMPLES "Build example projects with you can learn & play" OFF)
1414
option(OMATH_STATIC_MSVC_RUNTIME_LIBRARY "Force Omath to link static runtime" OFF)
1515
option(OMATH_SUPRESS_SAFETY_CHECKS "Supress some safety checks in release build to improve general performance" ON)
16-
option(OMATH_USE_UNITY_BUILD "Will enable unity build to speed up compilation" ON)
16+
option(OMATH_USE_UNITY_BUILD "Will enable unity build to speed up compilation" OFF)
1717
option(OMATH_ENABLE_LEGACY "Will enable legacy classes that MUST be used ONLY for backward compatibility" OFF)
1818

1919
message(STATUS "[${PROJECT_NAME}]: Building on ${CMAKE_HOST_SYSTEM_NAME}")
@@ -27,16 +27,21 @@ message(STATUS "[${PROJECT_NAME}]: AVX2 feature status ${OMATH_USE_AVX2}")
2727
message(STATUS "[${PROJECT_NAME}]: ImGUI integration feature status ${OMATH_IMGUI_INTEGRATION}")
2828
message(STATUS "[${PROJECT_NAME}]: Legacy features support ${OMATH_ENABLE_LEGACY}")
2929

30-
file(GLOB_RECURSE OMATH_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp")
31-
file(GLOB_RECURSE OMATH_HEADERS CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp")
30+
file(GLOB_RECURSE OMATH_MODULES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/modules/*.ixx")
3231

3332

3433
if (OMATH_BUILD_AS_SHARED_LIBRARY)
35-
add_library(${PROJECT_NAME} SHARED ${OMATH_SOURCES} ${OMATH_HEADERS})
34+
add_library(${PROJECT_NAME} SHARED)
3635
else ()
37-
add_library(${PROJECT_NAME} STATIC ${OMATH_SOURCES} ${OMATH_HEADERS})
36+
add_library(${PROJECT_NAME} STATIC)
3837
endif ()
3938

39+
target_sources(${PROJECT_NAME}
40+
PUBLIC
41+
FILE_SET cxx_modules TYPE CXX_MODULES
42+
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/modules
43+
FILES ${OMATH_MODULES}
44+
)
4045
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
4146

4247
target_compile_definitions(${PROJECT_NAME} PUBLIC OMATH_VERSION="${PROJECT_VERSION}")
@@ -132,6 +137,8 @@ install(TARGETS ${PROJECT_NAME}
132137
ARCHIVE DESTINATION lib COMPONENT ${PROJECT_NAME} # For static libraries
133138
LIBRARY DESTINATION lib COMPONENT ${PROJECT_NAME} # For shared libraries
134139
RUNTIME DESTINATION bin COMPONENT ${PROJECT_NAME} # For executables (on Windows)
140+
FILE_SET cxx_modules DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/modules
141+
CXX_MODULES_BMI DESTINATION ${CMAKE_INSTALL_LIBDIR}/cxx/bmi
135142
)
136143

137144
# Install headers as part of omath_component
@@ -142,6 +149,7 @@ install(EXPORT ${PROJECT_NAME}Targets
142149
FILE ${PROJECT_NAME}Targets.cmake
143150
NAMESPACE ${PROJECT_NAME}::
144151
DESTINATION lib/cmake/${PROJECT_NAME} COMPONENT ${PROJECT_NAME}
152+
CXX_MODULES_DIRECTORY ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/cxx-modules
145153
)
146154

147155

examples/example_proj_mat_builder.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
#include <iostream>
77
#include <print>
8-
#include <omath/engines/opengl_engine/formulas.hpp>
8+
#include <sstream>
9+
import omath.opengl_engine.formulas;
910

1011

1112
int main()
@@ -36,5 +37,5 @@ int main()
3637
const auto mat =
3738
omath::opengl_engine::calc_perspective_projection_matrix(fov, view_port_width / view_port_height, near, far);
3839

39-
std::print("{}", mat.to_string());
40+
std::print("{}", mat);
4041
};

include/omath/3d_primitives/box.hpp

Lines changed: 0 additions & 16 deletions
This file was deleted.

include/omath/3d_primitives/plane.hpp

Lines changed: 0 additions & 16 deletions
This file was deleted.

include/omath/angles.hpp

Lines changed: 0 additions & 64 deletions
This file was deleted.

include/omath/collision/line_tracer.hpp

Lines changed: 0 additions & 37 deletions
This file was deleted.

include/omath/engines/iw_engine/camera.hpp

Lines changed: 0 additions & 13 deletions
This file was deleted.

include/omath/engines/iw_engine/formulas.hpp

Lines changed: 0 additions & 26 deletions
This file was deleted.

include/omath/engines/iw_engine/traits/camera_trait.hpp

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)