This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,4 @@
(env
(default
(c_flags "in bin")
(cxx_flags "in bin")))

View file

@ -0,0 +1,4 @@
(env
(default
(c_flags ":standard + in .")
(cxx_flags ":standard + in .")))

View file

@ -0,0 +1 @@
(lang dune 1.7)

View file

@ -0,0 +1,26 @@
$ alias dune_printenv="dune printenv --profile default --field c_flags --field cxx_flags"
$ dune_printenv .
(c_flags (":standard + in ."))
(cxx_flags (":standard + in ."))
$ dune_printenv src
(c_flags
(":standard + in ." ":standard + in src"))
(cxx_flags
(":standard + in ." ":standard + in src"))
$ dune_printenv bin
(c_flags ("in bin"))
(cxx_flags ("in bin"))
$ dune_printenv run
(c_flags (-DTEST_C))
(cxx_flags (-DTEST_CPP))
$ dune exec --profile default ./run/foo.exe
TEST_C defined.
$ dune exec --profile default ./run/bar.exe
TEST_CPP defined.

View file

@ -0,0 +1,11 @@
#include <stdio.h>
int main(int argc, char ** argv){
#ifdef TEST_CPP
printf("TEST_CPP defined.\n");
return 0;
#else
printf("TEST_CPP not defined.\n");
return 1;
#endif
}

View file

@ -0,0 +1,15 @@
(env
(default
(c_flags "-DTEST_C")
(cxx_flags "-DTEST_CPP")))
(rule
(targets foo.exe)
(deps foo.c)
(action (run %{cc} -o %{targets} %{deps})))
(rule
(targets bar.exe)
(deps bar.cpp)
(action (run %{cxx} -o %{targets} %{deps})))

View file

@ -0,0 +1,11 @@
#include <stdio.h>
int main(int argc, char ** argv){
#ifdef TEST_C
printf("TEST_C defined.\n");
return 0;
#else
printf("TEST_C not defined.\n");
return 1;
#endif
}

View file

@ -0,0 +1,4 @@
(env
(default
(c_flags :standard ":standard + in src")
(cxx_flags :standard ":standard + in src")))