star-build

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

embree4.mk.in (4528B)


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