Skip to content

Commit

Permalink
Merge pull request #37 from mseri/win32-compat
Browse files Browse the repository at this point in the history
Workaround configurator bug in windows
  • Loading branch information
mseri authored May 16, 2022
2 parents 2eebbc0 + 1d38d42 commit 56e7605
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 36 deletions.
21 changes: 3 additions & 18 deletions eigen/configure/configure.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

module C = Configurator.V1

let detect_system_header =
let detect_system_os =
{|
#if __APPLE__
#include <TargetConditionals.h>
Expand Down Expand Up @@ -48,15 +48,8 @@ let default_cflags c =
with
| Not_found ->
let os =
let header =
let file = Filename.temp_file "discover" "os.h" in
let fd = open_out file in
output_string fd detect_system_header;
close_out fd;
file
in
let platform =
C.C_define.import c ~includes:[ header ] [ "PLATFORM_NAME", String ]
C.C_define.import c ~includes:[ ] ~prelude:detect_system_os [ "PLATFORM_NAME", String ]
in
match List.map snd platform with
| [ String "android" ] -> `android
Expand All @@ -67,15 +60,8 @@ let default_cflags c =
| _ -> `unknown
in
let arch =
let header =
let file = Filename.temp_file "discover" "arch.h" in
let fd = open_out file in
output_string fd detect_system_arch;
close_out fd;
file
in
let arch =
C.C_define.import c ~includes:[ header ] [ "PLATFORM_ARCH", String ]
C.C_define.import c ~includes:[ ] ~prelude:detect_system_arch [ "PLATFORM_ARCH", String ]
in
match List.map snd arch with
| [ String "x86_64" ] -> `x86_64
Expand All @@ -87,7 +73,6 @@ let default_cflags c =
[ (* Basic optimisation *) "-g"; "-O3"; "-Ofast" ]
@ (match arch, os with
| `arm64, `mac -> [ "-mcpu=apple-m1" ]
| `arm64, _ -> [ "-march=native" ]
| `x86_64, _ -> [ "-march=native"; "-mfpmath=sse"; "-msse2" ]
| _ -> [])
@ [ (* Experimental switches, -ffast-math may break IEEE754 semantics*)
Expand Down
22 changes: 4 additions & 18 deletions eigen_cpp/configure/configure.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

module C = Configurator.V1

let detect_system_header =
let detect_system_os =
{|
#if __APPLE__
#include <TargetConditionals.h>
Expand Down Expand Up @@ -48,15 +48,8 @@ let default_cppflags c =
with
| Not_found ->
let os =
let header =
let file = Filename.temp_file "discover" "os.h" in
let fd = open_out file in
output_string fd detect_system_header;
close_out fd;
file
in
let platform =
C.C_define.import c ~includes:[ header ] [ "PLATFORM_NAME", String ]
C.C_define.import c ~includes:[ ] ~prelude:detect_system_os [ "PLATFORM_NAME", String ]
in
match List.map snd platform with
| [ String "android" ] -> `android
Expand All @@ -67,15 +60,8 @@ let default_cppflags c =
| _ -> `unknown
in
let arch =
let header =
let file = Filename.temp_file "discover" "arch.h" in
let fd = open_out file in
output_string fd detect_system_arch;
close_out fd;
file
in
let arch =
C.C_define.import c ~includes:[ header ] [ "PLATFORM_ARCH", String ]
C.C_define.import c ~includes:[ ] ~prelude:detect_system_arch [ "PLATFORM_ARCH", String ]
in
match List.map snd arch with
| [ String "x86_64" ] -> `x86_64
Expand All @@ -90,9 +76,9 @@ let default_cppflags c =
; "-pedantic"
; "-O3"
; "-std=c++11"
; "-Ofast"
] @ (match arch, os with
| `arm64, `mac -> [ "-mcpu=apple-m1" ]
| `arm64, _ -> [ "-march=native" ]
| `x86_64, _ -> [ "-march=native"; "-mfpmath=sse"; "-msse2" ]
| _ -> [])
@ [ (* Experimental switches, -ffast-math may break IEEE754 semantics*)
Expand Down

0 comments on commit 56e7605

Please sign in to comment.