@@ -11,15 +11,19 @@ option(OMATH_BUILD_AS_SHARED_LIBRARY "Build Omath as .so or .dll" OFF)
11
11
option (OMATH_USE_AVX2 "Omath will use AVX2 to boost performance" ON )
12
12
option (OMATH_IMGUI_INTEGRATION "Omath will define method to convert omath types to imgui types" OFF )
13
13
option (OMATH_BUILD_EXAMPLES "Build example projects with you can learn & play" OFF )
14
- option (OMATH_STATIC_MSVC_RUNTIME_LIBRARY "Force Omath to link static runtime" OFF )
14
+ option (OMATH_STATIC_MSVC_RUNTIME_LIBRARY "Force Omath to link static runtime" OFF )
15
15
option (OMATH_SUPRESS_SAFETY_CHECKS "Supress some safety checks in release build to improve general performance" ON )
16
16
option (OMATH_USE_UNITY_BUILD "Will enable unity build to speed up compilation" ON )
17
17
18
+ file (GLOB_RECURSE OMATH_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR} /source/*.cpp" )
19
+ file (GLOB_RECURSE OMATH_HEADERS CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR} /include/*.hpp" )
20
+
21
+
18
22
if (OMATH_BUILD_AS_SHARED_LIBRARY )
19
- add_library (omath SHARED source /matrix.cpp )
20
- else ()
21
- add_library (omath STATIC source /matrix.cpp )
22
- endif ()
23
+ add_library (omath SHARED ${OMATH_SOURCES} ${OMATH_HEADERS} )
24
+ else ()
25
+ add_library (omath STATIC ${OMATH_SOURCES} ${OMATH_HEADERS} )
26
+ endif ()
23
27
24
28
message (STATUS "Building on ${CMAKE_HOST_SYSTEM_NAME} " )
25
29
add_library (omath::omath ALIAS omath )
@@ -28,28 +32,28 @@ if (OMATH_IMGUI_INTEGRATION)
28
32
target_compile_definitions (omath PUBLIC OMATH_IMGUI_INTEGRATION )
29
33
30
34
# IMGUI is being linked as submodule
31
- if (TARGET imgui )
35
+ if (TARGET imgui )
32
36
target_link_libraries (omath PUBLIC imgui )
33
37
install (TARGETS imgui
34
38
EXPORT omathTargets
35
39
ARCHIVE DESTINATION lib
36
40
LIBRARY DESTINATION lib
37
41
RUNTIME DESTINATION bin )
38
- else ()
42
+ else ()
39
43
# Assume that IMGUI linked via VCPKG.
40
44
find_package (imgui CONFIG REQUIRED )
41
45
target_link_libraries (omath PUBLIC imgui::imgui )
42
- endif ()
46
+ endif ()
43
47
44
- endif ()
48
+ endif ()
45
49
46
50
if (OMATH_USE_AVX2 )
47
51
target_compile_definitions (omath PUBLIC OMATH_USE_AVX2 )
48
- endif ()
52
+ endif ()
49
53
50
54
if (OMATH_SUPRESS_SAFETY_CHECKS )
51
55
target_compile_definitions (omath PUBLIC OMATH_SUPRESS_SAFETY_CHECKS )
52
- endif ()
56
+ endif ()
53
57
54
58
set_target_properties (omath PROPERTIES
55
59
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR} /out/${CMAKE_BUILD_TYPE} "
@@ -61,37 +65,35 @@ if (OMATH_USE_UNITY_BUILD)
61
65
set_target_properties (omath PROPERTIES
62
66
UNITY_BUILD ON
63
67
UNITY_BUILD_BATCH_SIZE 20 )
64
- endif ()
68
+ endif ()
65
69
66
70
if (OMATH_STATIC_MSVC_RUNTIME_LIBRARY )
67
71
set_target_properties (omath PROPERTIES
68
72
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
69
73
)
70
- endif ()
74
+ endif ()
71
75
72
76
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
73
77
target_compile_options (omath PRIVATE -mavx2 -mfma )
74
- endif ()
78
+ endif ()
75
79
76
80
target_compile_features (omath PUBLIC cxx_std_23 )
77
81
78
82
79
- add_subdirectory (source )
80
-
81
- if (OMATH_BUILD_TESTS )
83
+ if (OMATH_BUILD_TESTS )
82
84
add_subdirectory (extlibs )
83
85
add_subdirectory (tests )
84
- endif ()
86
+ endif ()
85
87
86
88
if (OMATH_BUILD_EXAMPLES )
87
89
add_subdirectory (examples )
88
- endif ()
90
+ endif ()
89
91
90
92
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND OMATH_THREAT_WARNING_AS_ERROR )
91
93
target_compile_options (omath PRIVATE /W4 /WX )
92
- elseif (OMATH_THREAT_WARNING_AS_ERROR )
94
+ elseif (OMATH_THREAT_WARNING_AS_ERROR )
93
95
target_compile_options (omath PRIVATE -Wall -Wextra -Wpedantic -Werror )
94
- endif ()
96
+ endif ()
95
97
96
98
target_include_directories (omath
97
99
PUBLIC
0 commit comments