star-build

Automation tool for project installation
git clone git://git.meso-star.com/star-build.git
Log | Files | Refs | README | LICENSE

embree4.mk.in (4559B)


      1 # Copyright (C) 2023-2026 |Méso|Star> (contact@meso-star.com)
      2 #
      3 # This file is part of Star-Build.
      4 #
      5 # Star-Build is free software: you can redistribute it and/or modify
      6 # it under the terms of the GNU General Public License as published by
      7 # the Free Software Foundation, either version 3 of the License, or
      8 # (at your option) any later version.
      9 #
     10 # Star-Build is distributed in the hope that it will be useful,
     11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     13 # GNU General Public License for more details.
     14 #
     15 # You should have received a copy of the GNU General Public License
     16 # along with Star-Build. If not, see <http://www.gnu.org/licenses/>.
     17 
     18 # Configuration macros
     19 EMBREE_TAG = @TAG@
     20 EMBREE_VERSION = @VERSION@
     21 EMBREE_URL_ONLINE = https://github.com/embree/embree/
     22 EMBREE_URL_OFFLINE = $(MIRROR)/embree
     23 EMBREE_URL = $(EMBREE_URL_$(NETWORK))
     24 
     25 # Helper macros
     26 EMBREE_DIR = $(CACHE)/embree/$(EMBREE_TAG)
     27 EMBREE_CMAKE_OPTIONS =\
     28  -G "Unix Makefiles"\
     29  -DCMAKE_BUILD_TYPE=Release\
     30  -DCMAKE_INSTALL_LIBDIR="lib"\
     31  -DEMBREE_BACKFACE_CULLING=OFF\
     32  -DEMBREE_COMPACT_POLYS=OFF\
     33  -DEMBREE_DISC_POINT_SELF_INTERSECTION_AVOIDANCE=OFF\
     34  -DEMBREE_FILTER_FUNCTION=ON\
     35  -DEMBREE_GEOMETRY_CURVE=OFF\
     36  -DEMBREE_GEOMETRY_GRID=OFF\
     37  -DEMBREE_GEOMETRY_INSTANCE=ON\
     38  -DEMBREE_GEOMETRY_POINT=OFF\
     39  -DEMBREE_GEOMETRY_QUAD=ON\
     40  -DEMBREE_GEOMETRY_SUBDIVISION=OFF\
     41  -DEMBREE_GEOMETRY_TRIANGLE=ON\
     42  -DEMBREE_GEOMETRY_USER=ON\
     43  -DEMBREE_MAX_ISA=AVX\
     44  -DEMBREE_RAY_PACKETS=OFF\
     45  -DEMBREE_STACK_PROTECTOR=OFF\
     46  -DEMBREE_STATIC_LIB=OFF\
     47  -DEMBREE_STAT_COUNTERS=OFF\
     48  -DEMBREE_SYCL_SUPPORT=OFF\
     49  -DEMBREE_TUTORIALS=OFF
     50 
     51 EMBREE_DOC =\
     52  $(EMBREE_DIR)/LICENSE.txt\
     53  $(EMBREE_DIR)/CHANGELOG.md\
     54  $(EMBREE_DIR)/third-party-programs.txt\
     55  $(EMBREE_DIR)/third-party-programs-TBB.txt\
     56  $(EMBREE_DIR)/third-party-programs-OIDN.txt\
     57  $(EMBREE_DIR)/third-party-programs-DPCPP.txt\
     58  $(EMBREE_DIR)/third-party-programs-oneAPI-DPCPP.txt
     59 
     60 EMBREE_LIB =\
     61  $(EMBREE_DIR)/build/libembree4.so\
     62  $(EMBREE_DIR)/build/libembree4.so.4
     63 
     64 EMBREE_INC =\
     65  $(EMBREE_DIR)/include/embree4/rtcore.h \
     66  $(EMBREE_DIR)/include/embree4/rtcore_buffer.h \
     67  $(EMBREE_DIR)/include/embree4/rtcore_builder.h \
     68  $(EMBREE_DIR)/include/embree4/rtcore_common.h \
     69  $(EMBREE_DIR)/include/embree4/rtcore_config.h \
     70  $(EMBREE_DIR)/include/embree4/rtcore_device.h \
     71  $(EMBREE_DIR)/include/embree4/rtcore_geometry.h \
     72  $(EMBREE_DIR)/include/embree4/rtcore_quaternion.h \
     73  $(EMBREE_DIR)/include/embree4/rtcore_ray.h \
     74  $(EMBREE_DIR)/include/embree4/rtcore_scene.h
     75 
     76 embree4: build_embree4 prefix $(EMBREE_DIR)/embree4.pc
     77 	prefix="$$(cat .prefix)" && \
     78 	mkdir -p "$${prefix}/lib" && \
     79 	mkdir -p "$${prefix}/lib/pkgconfig" && \
     80 	mkdir -p "$${prefix}/include/embree4" && \
     81 	mkdir -p "$${prefix}/share/doc/embree4" && \
     82 	cp -P $(EMBREE_LIB) "$${prefix}/lib/" && \
     83 	cp -P $(EMBREE_DIR)/embree4.pc "$${prefix}/lib/pkgconfig/" && \
     84 	cp -P $(EMBREE_INC) "$${prefix}/include/embree4/" && \
     85 	cp -P $(EMBREE_DOC) "$${prefix}/share/doc/embree4/"
     86 
     87 build_embree4: $(EMBREE_DIR) prefix tbb
     88 	@prefix=$$(cat .prefix) && \
     89 	cd -- $(EMBREE_DIR)/build && \
     90 	cmake $(EMBREE_CMAKE_OPTIONS) -DTBB_DIR="$${prefix}/lib/cmake/TBB" .. && \
     91 	$(MAKE)
     92 
     93 $(EMBREE_DIR)/embree4.pc: $(EMBREE_DIR) prefix
     94 	prefix="$$(cat .prefix)" && \
     95 	{ \
     96 	  printf 'prefix="%s"\n' "$${prefix}"; \
     97 	  printf 'includedir="$${prefix}/include"\n'; \
     98 	  printf 'libdir="$${prefix}/lib"\n'; \
     99 	  printf 'Name: embree4\n'; \
    100 	  printf 'Description: Embree ray tracing kernels\n'; \
    101 	  printf 'Version: %s\n' "$(EMBREE_VERSION)"; \
    102 	  printf 'Libs: -L$${libdir} -lembree4\n'; \
    103 	  printf 'Cflags: -I$${includedir}\n'; \
    104 	} > "$@"
    105 
    106 $(EMBREE_DIR):
    107 	git clone --branch "$(EMBREE_TAG)" --depth 1 $(EMBREE_URL) "$@"
    108 	mkdir -p "$@/build"
    109 
    110 clean_embree4:
    111 	if [ -d $(EMBREE_DIR)/build ]; then\
    112 		cd -- $(EMBREE_DIR)/build && $(MAKE) clean;\
    113 	fi
    114 
    115 uninstall_embree4: prefix
    116 	prefix="$$(cat .prefix)" && \
    117 	rm -f "$${prefix}/lib/pkgconfig/embree4.pc" && \
    118 	for i in $(EMBREE_LIB); do rm -f "$${prefix}/lib/$${i##*/}"; done && \
    119 	for i in $(EMBREE_INC); do rm -f "$${prefix}/include/embree4/$${i##*/}"; done  && \
    120 	for i in $(EMBREE_DOC); do rm -f "$${prefix}/share/doc/embree4/$${i##*/}"; done
    121 
    122 mirror_embree4:
    123 	repo="$$(echo $(EMBREE_URL) | sed 's/[\/]\{0,\}$$//g')" && \
    124 	repo="$(MIRROR)/$${repo##*/}" && \
    125 	rm -rf "$${repo}" && \
    126 	git clone --bare --branch $(EMBREE_TAG) $(MIRROR_GIT_OPT) \
    127 	  $(EMBREE_URL) "$${repo}"
    128 
    129 clean_all: clean_embree4
    130 install_all: embree4
    131 uninstall_all: uninstall_embree4
    132 mirror_all: mirror_embree4