Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ocamltest/ocaml_actions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,7 @@ let config_variables _log env =
Ocaml_variables.cpp, Ocamltest_config.cpp;
Ocaml_variables.cppflags, Ocamltest_config.cppflags;
Ocaml_variables.cc, Ocamltest_config.cc;
Ocaml_variables.outputobj, Ocamltest_config.outputobj;
Ocaml_variables.cflags, Ocamltest_config.cflags;
Ocaml_variables.cxx, Ocamltest_config.cxx;
Ocaml_variables.ccomp_type, Ocamltest_config.ccomp_type;
Expand Down
4 changes: 4 additions & 0 deletions ocamltest/ocaml_variables.ml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ let cppflags = make ("cppflags",
let cc = make ("cc",
"Command to use to invoke the C compiler")

let outputobj = make ("outputobj",
"Exact string to prefix a call to cc -c to name the object")

let cflags = make ("cflags",
"Flags passed to the C compiler")

Expand Down Expand Up @@ -259,6 +262,7 @@ let _ = List.iter register_variable
cppflags;
cc;
cflags;
outputobj;
cxx;
caml_ld_library_path;
codegen_exit_status;
Expand Down
2 changes: 2 additions & 0 deletions ocamltest/ocaml_variables.mli
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ val cppflags : Variables.t

val cc : Variables.t

val outputobj : Variables.t

val cflags : Variables.t

val cxx : Variables.t
Expand Down
2 changes: 2 additions & 0 deletions ocamltest/ocamltest_config.ml.in
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ let exe = {@QS@|@EXEEXT@|@QS@}
let mkdll = {@QS@|@mkdll_exp@|@QS@}
let mkexe = {@QS@|@mkexe_exp@|@QS@}

let outputobj = {@QS@|@outputobj@|@QS@}

let bytecc_libs = {@QS@|@zstd_libs@ @cclibs@|@QS@}

let nativecc_libs = {@QS@|@cclibs@|@QS@}
Expand Down
3 changes: 3 additions & 0 deletions ocamltest/ocamltest_config.mli
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ val cppflags : string
val cc : string
(** Command to use to invoke the C compiler *)

val outputobj : string
(** The exact string to use when running [cc -c] to name the object file *)

val cflags : string
(** Flags to pass to the C compiler *)

Expand Down
12 changes: 0 additions & 12 deletions testsuite/tests/cxx-api/all-includes.h.sh

This file was deleted.

40 changes: 0 additions & 40 deletions testsuite/tests/cxx-api/all_includes.ml

This file was deleted.

93 changes: 0 additions & 93 deletions testsuite/tests/cxx-api/cxx-sarif.sh

This file was deleted.

44 changes: 44 additions & 0 deletions testsuite/tests/cxx-api/cxx_api.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
(* TEST
has-cxx;
hassysthreads;
readonly_files = "stubs.cpp cxx.sh";
include runtime_events;
include systhreads;
{
setup-ocamlopt.byte-build-env;
script = "${cxx} ${cppflags} ${cflags} \
-I ${ocamlsrcdir}/runtime \
-I ${ocamlsrcdir}/otherlibs/systhreads \
-I ${ocamlsrcdir}/otherlibs/unix \
${outputobj}${test_build_directory}/stubs.${objext} \
-c ${test_source_directory}/stubs.cpp";
script;
all_modules = "stubs.${objext} cxx_api.ml";
ocamlopt.byte;
output = "${test_build_directory}/program-output";
stdout = "${output}";
run;
check-program-output;
}
{
setup-ocamlc.byte-build-env;
script = "${cxx} ${cppflags} ${cflags} \
-I ${ocamlsrcdir}/runtime \
-I ${ocamlsrcdir}/otherlibs/systhreads \
-I ${ocamlsrcdir}/otherlibs/unix \
${outputobj}${test_build_directory}/stubs.${objext} \
-c ${test_source_directory}/stubs.cpp";
script;
all_modules = "stubs.${objext} cxx_api.ml";
flags = "-output-complete-exe -cclib -lunixbyt -cclib -lthreads -cclib -lcamlruntime_eventsbyt";
ocamlc.byte;
output = "${test_build_directory}/program-output";
stdout = "${output}";
run;
check-program-output;
}
*)

external test_cxx : unit -> string = "test_cxx"

let () = print_string (test_cxx ())
33 changes: 0 additions & 33 deletions testsuite/tests/cxx-api/deps.sh

This file was deleted.

4 changes: 3 additions & 1 deletion testsuite/tests/cxx-api/stubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
#error "A C++ compiler is required!"
#endif

#include "all-includes.h"
#include <caml/alloc.h>
#include <caml/memory.h>
#include <caml/threads.h>
#include <ctime>

extern "C" {
Expand Down
19 changes: 0 additions & 19 deletions testsuite/tests/lib-unix/unix-sockaddr/cxx.sh

This file was deleted.

14 changes: 11 additions & 3 deletions testsuite/tests/lib-unix/unix-sockaddr/sockaddr_cxx.ml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
(* TEST
has-cxx;
readonly_files = "sockaddr_cxx_aux.cpp cxx.sh";
readonly_files = "sockaddr_cxx_aux.cpp";
hasunix;
include unix;
{
setup-ocamlopt.byte-build-env;
script = "sh cxx.sh";
script = "${cxx} ${cppflags} ${cflags} \
-I ${ocamlsrcdir}/runtime \
-I ${ocamlsrcdir}/otherlibs/unix \
${outputobj}${test_build_directory}/sockaddr_cxx_aux.${objext} \
-c ${test_source_directory}/sockaddr_cxx_aux.cpp";
script;
all_modules = "sockaddr_cxx_aux.${objext} sockaddr_cxx.ml";
ocamlopt.byte;
Expand All @@ -16,7 +20,11 @@
}
{
setup-ocamlc.byte-build-env;
script = "sh cxx.sh";
script = "${cxx} ${cppflags} ${cflags} \
-I ${ocamlsrcdir}/runtime \
-I ${ocamlsrcdir}/otherlibs/unix \
${outputobj}${test_build_directory}/sockaddr_cxx_aux.${objext} \
-c ${test_source_directory}/sockaddr_cxx_aux.cpp";
script;
all_modules = "sockaddr_cxx_aux.${objext} sockaddr_cxx.ml";
flags = "-output-complete-exe -cclib -lunixbyt";
Expand Down