File tree Expand file tree Collapse file tree 3 files changed +30
-3
lines changed
Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -7,23 +7,34 @@ all: build-library build-executable
77
88JULIA ?= julia
99GCC ?= gcc
10+
1011DLEXT := $(shell $(JULIA ) --startup-file=no -e 'import Libdl; print(Libdl.dlext) ')
1112
1213TARGET ="MyLibCompiled"
1314
1415MYLIB_INCLUDES = $(TARGET ) /include/julia_init.h $(TARGET ) /include/mylib.h
1516MYLIB_PATH := $(TARGET ) /lib/libmylib.$(DLEXT )
1617
18+ DEPS_build_library := src/MyLib.jl
19+ DEPS_build_library += build/build.jl
20+ DEPS_build_library += build/generate_precompile.jl build/additional_precompile.jl
21+ DEPS_build_library += build/mylib.h
22+ DEPS_build_library += build/Project.toml build/Manifest.toml
23+
1724.PHONY : build-library
18- build-library : build/build.jl src/MyLib.jl
25+ build-library : MyLibCompiled/lib/libmylib.dylib
26+
27+ MyLibCompiled/lib/libmylib.dylib : $(DEPS_build_library )
1928 $(JULIA ) --startup-file=no --project=. -e ' import Pkg; Pkg.instantiate(); Pkg.precompile()'
2029 $(JULIA ) --startup-file=no --project=build -e ' import Pkg; Pkg.instantiate(); Pkg.precompile()'
2130 $(JULIA ) --startup-file=no --project=build -e ' include("build/build.jl")'
2231
2332INCLUDE_DIR = $(TARGET ) /include
2433
2534.PHONY : build-executable
26- build-executable :
35+ build-executable : my_application.out
36+
37+ my_application.out : MyLibCompiled/lib/libmylib.dylib
2738 $(GCC ) my_application.c -o my_application.out -I$(INCLUDE_DIR ) -L$(TARGET ) /lib -ljulia -lmylib
2839
2940.PHONY : clean
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -euf -o pipefail
4+
5+ if [[ " $OSTYPE " == " darwin" * ]]; then
6+ export DYLD_FALLBACK_LIBRARY_PATH=" ./MyLibCompiled/lib/:./MyLibCompiled/lib/julia"
7+ else
8+ export LD_LIBRARY_PATH=" ./MyLibCompiled/lib/"
9+ fi
10+
11+ ./my_application.out " $@ "
Original file line number Diff line number Diff line change 277277 cmd = ` $(Base. julia_cmd ()[1 ]) --project="./build" -e "$(code) "`
278278 run (cmd)
279279
280-
280+
281281 # We don't want to assume that the machine running the tests has `make` installed
282282 # and available in the PATH. Therefore, we use the `GNUMake_jll.jl`` package.
283283 my_run (` $(GNUMake_jll. make ()) ` )
295295 expected_str = " Incremented count: 4 (Cint)\n Incremented value: 4"
296296 @test observed_str == expected_str
297297
298+ # Yes, we do have a convenience wrapper script at `examples/MyLib/runme.bash`
299+ # However, for the PackageCompiler test suite, we don't want to make any assumptions
300+ # about Bash being available on the machine that's running the tests.
301+ # So instead, we manaully run the `./my_application.out` executable ourselves.
302+
298303 # Finally, exercise a few more `Makefile` targets, to make sure that they
299304 # don't bitrot.
300305 my_run (` $(GNUMake_jll. make ()) all` )
You can’t perform that action at this time.
0 commit comments