this repo has no description
1project(darling-libsystem_m)
2
3cmake_minimum_required(VERSION 3.13)
4enable_language(C ASM)
5
6set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__DARWIN_UNIX03 -fPIC -w -ggdb -O0 -DBUILDING_FOR_CARBONCORE_LEGACY -funroll-loops") # -DBUILDING_FOR_CARBONCORE_LEGACY")
7set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -DBUILDING_FOR_CARBONCORE_LEGACY")
8set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -nostdlib")
9
10include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Source)
11include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../libc/darwin)
12add_definitions(-DPRIVATE)
13
14if (TARGET_i386 OR TARGET_x86_64)
15 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse -msse2 -msse3")
16 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Source/Intel)
17 add_definitions(-Dmovsxw=movsw)
18endif ()
19
20set(libm_sources
21 Source/abs.c
22 Source/sincos.c
23 Source/exp10.c
24 #Source/nan.c
25 #Source/nanl.c
26 #Source/version_info.c
27)
28
29if (TARGET_i386 OR TARGET_x86_64)
30 set(libm_sources ${libm_sources}
31 Source/Intel/acos.c
32 Source/Intel/asin.c
33 Source/Intel/atan.c
34 Source/Intel/complex.c
35 Source/Intel/containsNothingIntel.c
36 Source/Intel/e_acosh.c
37 Source/Intel/e_atanh.c
38 Source/Intel/e_cosh.c
39 Source/Intel/e_j0.c
40 Source/Intel/e_j1.c
41 Source/Intel/e_jn.c
42 Source/Intel/e_sinh.c
43 Source/Intel/expf_logf_powf.c
44 Source/Intel/fenv.c
45 Source/Intel/fmaf.c
46 Source/Intel/nan.c
47 Source/Intel/nanl.c
48 Source/Intel/rndtol.c
49 Source/Intel/s_asinh.c
50 Source/Intel/sincostan.c
51 Source/Intel/s_matherr.c
52 Source/Intel/s_tanh.c
53 Source/Intel/xmm_arcsincostan.c
54 Source/Intel/xmm_erfgamma.c
55 Source/Intel/xmm_exp.c
56 Source/Intel/xmm_fma.c
57 Source/Intel/xmm_log.c
58 Source/Intel/xmm_misc.c
59 Source/Intel/xmm_nextafter.c
60 Source/Intel/xmm_power.c
61 Source/Intel/xmm_remainder.c
62 Source/Intel/xmm_sqrt.c
63
64 Source/Intel/acosf.S
65 Source/Intel/acoshf.S
66 Source/Intel/asinf.S
67 Source/Intel/asinhf.S
68 Source/Intel/atan2f.S
69 Source/Intel/atanf.S
70 Source/Intel/atanhf.S
71 Source/Intel/cbrtf.S
72 Source/Intel/ceilf.S
73 Source/Intel/ceill.S
74 Source/Intel/ceil.S
75 Source/Intel/copysign.S
76 Source/Intel/coshf.S
77 Source/Intel/cosh.S
78 Source/Intel/e_acos.S
79 Source/Intel/e_asin.S
80 Source/Intel/e_atan2.S
81 Source/Intel/e_cbrtl.S
82 Source/Intel/e_exp.S
83 Source/Intel/e_log10.S
84 Source/Intel/e_log.S
85 Source/Intel/e_remainder.S
86 #Source/Intel/e_remquol.S
87 Source/Intel/e_sqrt.S
88 Source/Intel/exp2f.S
89 Source/Intel/exp2.S
90 Source/Intel/expf.S
91 Source/Intel/expl.S
92 Source/Intel/expm1f.S
93 Source/Intel/expm1.S
94 Source/Intel/exp.S
95 Source/Intel/floorf.S
96 Source/Intel/floorl.S
97 Source/Intel/floor.S
98 Source/Intel/fmaxfminfdim.S
99 Source/Intel/fmod.S
100 Source/Intel/frexp.S
101 Source/Intel/fyl2x.S
102 Source/Intel/hypotf.S
103 Source/Intel/hypotl.S
104 Source/Intel/hypot.S
105 Source/Intel/ilogb.S
106 Source/Intel/log10f.S
107 Source/Intel/log2f.S
108 Source/Intel/log2.S
109 Source/Intel/logf.S
110 #Source/Intel/log.S
111 Source/Intel/lrintl.S
112 Source/Intel/lroundf.S
113 Source/Intel/lroundl.S
114 Source/Intel/lround.S
115 Source/Intel/modff.S
116 Source/Intel/modfl.S
117 Source/Intel/modf.S
118 Source/Intel/nearbyintf.S
119 Source/Intel/nearbyintl.S
120 Source/Intel/nearbyint.S
121 Source/Intel/nextafterf.S
122 Source/Intel/nextafterl.S
123 Source/Intel/nextafter.S
124 #Source/Intel/powf.S
125 Source/Intel/rintf.S
126 Source/Intel/rintl.S
127 Source/Intel/rint.S
128 Source/Intel/roundf.S
129 Source/Intel/roundl.S
130 Source/Intel/round.S
131 Source/Intel/s_atan.S
132 Source/Intel/scalbnf.S
133 Source/Intel/scalbnl.S
134 Source/Intel/scalbn.S
135 Source/Intel/s_cosisin.S
136 Source/Intel/s_cos.S
137 #Source/Intel/s_ilogb.S
138 Source/Intel/sinfcosf.S
139 Source/Intel/sinhf.S
140 Source/Intel/sinh.S
141 Source/Intel/s_log1p.S
142 #Source/Intel/s_logb.S
143 Source/Intel/s_rint.S
144 #Source/Intel/s_significand.S
145 Source/Intel/s_sin.S
146 Source/Intel/s_tan.S
147 Source/Intel/tanf.S
148 Source/Intel/tanhf.S
149 Source/Intel/tanh.S
150 Source/Intel/truncf.S
151 Source/Intel/truncl.S
152 Source/Intel/trunc.S
153 )
154endif ()
155
156# Gross hack to rename symbols in $fenv_access_off variants
157set(CMAKE_AR "${CMAKE_CURRENT_SOURCE_DIR}/rename_wrapper")
158
159if (TARGET_i386 OR TARGET_x86_64)
160 add_darling_object_library(system_m_extra Source/Intel/xmm_misc.c Source/Intel/xmm_log.c Source/Intel/fmaxfminfdim.S Source/Intel/nextafter.S Source/Intel/xmm_remainder.c Source/Intel/e_remquol.S)
161 set_target_properties(system_m_extra PROPERTIES COMPILE_FLAGS "-UBUILDING_FOR_CARBONCORE_LEGACY -O0 -ggdb")
162else ()
163 add_darling_object_library(system_m_extra Source/empty.c)
164endif ()
165make_fat(system_m_extra)
166
167set(DYLIB_INSTALL_NAME "/usr/lib/system/libsystem_m.dylib")
168add_circular(system_m FAT
169 SOURCES
170 ${libm_sources}
171 OBJECTS
172 $<TARGET_OBJECTS:system_m_extra>
173 SIBLINGS
174 system_c
175 system_dyld
176 LINK_FLAGS
177 "-Wl,-alias_list,${CMAKE_CURRENT_SOURCE_DIR}/Exports/libm_Intel.a.alias -Wl,-alias_list,${CMAKE_CURRENT_SOURCE_DIR}/Exports/libmathCommonIntel.alias"
178)
179#set_property(TARGET system_m APPEND_STRING PROPERTY LINK_FLAGS
180# "-Wl,-alias_list,${CMAKE_CURRENT_SOURCE_DIR}/Exports/libm_Intel.a.alias -Wl,-alias_list,${CMAKE_CURRENT_SOURCE_DIR}/Exports/libmathCommonIntel.alias")
181#target_link_libraries(system_m)
182#make_fat(system_m)
183
184install(TARGETS system_m DESTINATION libexec/darling/usr/lib/system)
185
186set(CMAKE_AR "${CMAKE_BINARY_DIR}/src/external/cctools-port/cctools/ar/${APPLE_TARGET_TRIPLET_PRIMARY}-ar")
187set(CMAKE_RANLIB "${CMAKE_BINARY_DIR}/src/external/cctools-port/cctools/ar/${APPLE_TARGET_TRIPLET_PRIMARY}-ranlib")
188add_darling_static_library(system_m_static SOURCES ${libm_sources} $<TARGET_OBJECTS:system_m_extra>)
189make_fat(system_m_static)