From 69cb6b981ff1ca10553dd2d20498b590738aaadd Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Thu, 9 Sep 2021 02:50:32 +0300 Subject: [PATCH 01/16] bsputil: write ents in binary mode and print its crc in 4-digit hex (#317) --- bsputil/bsputil.cc | 5 +++-- common/cmdlib.cc | 9 +++++++++ include/common/cmdlib.hh | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bsputil/bsputil.cc b/bsputil/bsputil.cc index 4ce08b44..926b2c07 100644 --- a/bsputil/bsputil.cc +++ b/bsputil/bsputil.cc @@ -593,11 +593,12 @@ main(int argc, char **argv) WriteBSPFile(source, &bspdata); } else if (!strcmp(argv[i], "--extract-entities")) { + unsigned int crc = CRC_Block((unsigned char *)bsp->dentdata, bsp->entdatasize - 1); StripExtension(source); DefaultExtension(source, ".ent"); - printf("-> writing %s... ", source); + printf("-> writing %s [CRC: %04x]... ", source, crc); - f = fopen(source, "w"); + f = fopen(source, "wb"); if (!f) Error("couldn't open %s for writing\n", source); diff --git a/common/cmdlib.cc b/common/cmdlib.cc index acf6b921..2ed0e081 100644 --- a/common/cmdlib.cc +++ b/common/cmdlib.cc @@ -1115,6 +1115,15 @@ CRC_Value(unsigned short crcvalue) return crcvalue ^ CRC_XOR_VALUE; } +unsigned short CRC_Block (const unsigned char *start, int count) +{ + unsigned short crc; + CRC_Init (&crc); + while (count--) + crc = (crc << 8) ^ crctable[(crc >> 8) ^ *start++]; + return crc; +} + /* ========================================================================= */ /* diff --git a/include/common/cmdlib.hh b/include/common/cmdlib.hh index b2f203ec..763b90fe 100644 --- a/include/common/cmdlib.hh +++ b/include/common/cmdlib.hh @@ -125,6 +125,7 @@ char *copystring(const char *s); void CRC_Init(unsigned short *crcvalue); void CRC_ProcessByte(unsigned short *crcvalue, uint8_t data); unsigned short CRC_Value(unsigned short crcvalue); +unsigned short CRC_Block (const unsigned char *start, int count); void CreatePath(char *path); void Q_CopyFile(const char *from, char *to); From b2911290a79245962a9c6d903b233a2e65881df6 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sat, 11 Sep 2021 20:46:03 +0300 Subject: [PATCH 02/16] fix hexen2 hull sizes (#318) --- qbsp/brush.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/qbsp/brush.cc b/qbsp/brush.cc index b0d2e595..4a7f872a 100644 --- a/qbsp/brush.cc +++ b/qbsp/brush.cc @@ -944,7 +944,7 @@ brush_t *LoadBrush(const mapentity_t *src, const mapbrush_t *mapbrush, int conte facelist = CreateBrushFaces(src, &hullbrush, rotate_offset, rottype, hullnum); } else if (hullnum == 3) { - vec3_t size[2] = { {-16, -16, -12}, {16, 16, 16} }; + vec3_t size[2] = { {-16, -16, -16}, {16, 16, 12} }; ExpandBrush(&hullbrush, size, facelist); FreeBrushFaces(facelist); facelist = CreateBrushFaces(src, &hullbrush, rotate_offset, rottype, hullnum); @@ -966,10 +966,20 @@ brush_t *LoadBrush(const mapentity_t *src, const mapbrush_t *mapbrush, int conte } } else if (hullnum == 5) { +#if 0 + if (options.hexen2 == 1) { /*original game*/ vec3_t size[2] = { {-48, -48, -50}, {48, 48, 50} }; ExpandBrush(&hullbrush, size, facelist); FreeBrushFaces(facelist); facelist = CreateBrushFaces(src, &hullbrush, rotate_offset, rottype, hullnum); + } else +#endif + { + vec3_t size[2] = { {-28, -28, -40}, {28, 28, 40} }; + ExpandBrush(&hullbrush, size, facelist); + FreeBrushFaces(facelist); + facelist = CreateBrushFaces(src, &hullbrush, rotate_offset, rottype, hullnum); + } } } else From 8b0090554998acd466278108d5e6a29f50ea18a3 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sat, 11 Sep 2021 11:50:10 -0600 Subject: [PATCH 03/16] ci: github actions starter script --- .github/workflows/cmake.yml | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/cmake.yml diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 00000000..e282e389 --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,38 @@ +name: CMake + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + +jobs: + build: + # The CMake configure and build commands are platform agnostic and should work equally + # well on Windows or Mac. You can convert this to a matrix build if you need + # cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Test + working-directory: ${{github.workspace}}/build + # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: ctest -C ${{env.BUILD_TYPE}} + From 82cd5e43ea6ec6471c609adbcdba0122f02b7e69 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sat, 11 Sep 2021 12:41:49 -0600 Subject: [PATCH 04/16] cmake.yml: run existing build scripts --- .github/workflows/cmake.yml | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index e282e389..403d1257 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -6,33 +6,24 @@ on: pull_request: branches: [ master ] -env: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release - jobs: build: - # The CMake configure and build commands are platform agnostic and should work equally - # well on Windows or Mac. You can convert this to a matrix build if you need - # cross-platform coverage. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + # Don't cancel the macOS build if the Linux build fails, etc. + fail-fast: false + matrix: + os: [ubuntu-18.04, macos-10.15] steps: - uses: actions/checkout@v2 - - name: Configure CMake - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + - name: Linux Build + if: runner.os == 'Linux' + run: | + sudo apt install -y groff + ./build-linux-64.sh - - name: Build - # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - - name: Test - working-directory: ${{github.workspace}}/build - # Execute tests defined by the CMake configuration. - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: ctest -C ${{env.BUILD_TYPE}} - + - name: macOS Build + if: runner.os == 'macOS' + ./build-osx.sh From 2c3afefa5000e7f6381b5eb3e66433f74c370f0b Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sat, 11 Sep 2021 12:42:44 -0600 Subject: [PATCH 05/16] cmake.yml: fix typo --- .github/workflows/cmake.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 403d1257..1e28fcde 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -26,4 +26,5 @@ jobs: - name: macOS Build if: runner.os == 'macOS' + run: | ./build-osx.sh From 3d9d1673606d9b86e5f12c77a578c12bc1a487d7 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sat, 11 Sep 2021 13:12:25 -0600 Subject: [PATCH 06/16] build: fix build-osx.sh --- build-osx.sh | 26 +++++++------------------- light/CMakeLists.txt | 1 + 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/build-osx.sh b/build-osx.sh index ebaa992f..dd29a5de 100755 --- a/build-osx.sh +++ b/build-osx.sh @@ -1,34 +1,22 @@ #!/bin/bash BUILD_DIR=build-osx -EMBREE_TGZ="https://github.com/embree/embree/releases/download/v2.17.7/embree-2.17.7.x86_64.macosx.tar.gz" -EMBREE_TGZ_NAME=$(basename "$EMBREE_TGZ") -EMBREE_DIR_NAME=$(basename "$EMBREE_TGZ" ".tar.gz") -EMBREE_WITH_VERSION=$(basename "$EMBREE_TGZ" ".x86_64.macosx.tar.gz") - -TBB_TGZ="https://github.com/intel/tbb/releases/download/2017_U7/tbb2017_20170604oss_mac.tgz" -TBB_TGZ_NAME=$(basename "$TBB_TGZ") -TBB_DIR_NAME="tbb2017_20170604oss" if [ -d "$BUILD_DIR" ]; then echo "$BUILD_DIR already exists, remove it first" exit 1 fi +brew install embree tbb + mkdir "$BUILD_DIR" cd "$BUILD_DIR" -wget "$EMBREE_TGZ" -wget "$TBB_TGZ" -tar xf "$EMBREE_TGZ_NAME" -tar xf "$TBB_TGZ_NAME" -EMBREE_CMAKE_DIR="$(pwd)/$EMBREE_DIR_NAME" -TBB_CMAKE_DIR="$(pwd)/${TBB_DIR_NAME}/cmake" -cmake .. -DCMAKE_BUILD_TYPE=Release -Dembree_DIR="$EMBREE_CMAKE_DIR" -DTBB_DIR="$TBB_CMAKE_DIR" -make -j8 -make -j8 testlight -make -j8 testqbsp -cpack +cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$(brew --prefix embree);$(brew --prefix tbb)" +make -j8 || exit 1 +make -j8 testlight || exit 1 +make -j8 testqbsp || exit 1 +cpack || exit 1 # run tests ./light/testlight || exit 1 diff --git a/light/CMakeLists.txt b/light/CMakeLists.txt index b8e129bd..e706ad7a 100644 --- a/light/CMakeLists.txt +++ b/light/CMakeLists.txt @@ -64,6 +64,7 @@ if (embree_FOUND) find_file(EMBREE_LICENSE LICENSE.txt "${embree_DIR}/doc" "${embree_DIR}/../embree3/embree3" # vcpkg puts it here + "${embree_DIR}/../../.." # homebrew puts it here NO_DEFAULT_PATH) if (EMBREE_LICENSE STREQUAL EMBREE_LICENSE-NOTFOUND) message(WARNING "Couldn't find embree license") From 66f63627733c790eac8f94f89ab04823abbee4ad Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sat, 11 Sep 2021 13:27:11 -0600 Subject: [PATCH 07/16] ci: checkout recursive --- .github/workflows/cmake.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 1e28fcde..6665cdea 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -17,6 +17,8 @@ jobs: steps: - uses: actions/checkout@v2 + with: + submodules: 'recursive' - name: Linux Build if: runner.os == 'Linux' From 81d58e5e89ac84f12220d0a64894093b32c32007 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sat, 11 Sep 2021 13:47:36 -0600 Subject: [PATCH 08/16] test: add -noverbose to qbsp invocations --- testmaps/automatated_tests.sh | 2 +- testmaps/quake_map_source/leaktest.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/testmaps/automatated_tests.sh b/testmaps/automatated_tests.sh index 532d31b7..58ce205d 100755 --- a/testmaps/automatated_tests.sh +++ b/testmaps/automatated_tests.sh @@ -2,6 +2,6 @@ set -x -qbsp invalid_texture_axes.map || exit 1 +qbsp -noverbose invalid_texture_axes.map || exit 1 light invalid_texture_axes.map || exit 1 diff --git a/testmaps/quake_map_source/leaktest.sh b/testmaps/quake_map_source/leaktest.sh index 3d8e264e..bcf384df 100755 --- a/testmaps/quake_map_source/leaktest.sh +++ b/testmaps/quake_map_source/leaktest.sh @@ -3,6 +3,6 @@ set -x for file in *.map; do - qbsp -leaktest "$file" || exit 1 + qbsp -leaktest -noverbose "$file" || exit 1 done From 4a1feadaabc1189c0d1e155f2b6a22b8ff08bd65 Mon Sep 17 00:00:00 2001 From: xDShot Date: Sun, 12 Sep 2021 09:15:02 +0300 Subject: [PATCH 09/16] #include (#319) Fixes error about undefined INT_MAX in common/bspfile.cc --- common/bspfile.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/bspfile.cc b/common/bspfile.cc index 3d985849..560a6928 100644 --- a/common/bspfile.cc +++ b/common/bspfile.cc @@ -21,6 +21,8 @@ #include #include +#include + const bspversion_t bspver_generic { NO_VERSION, NO_VERSION, "mbsp", "generic BSP" }; const bspversion_t bspver_q1 { BSPVERSION, NO_VERSION, "bsp29", "Quake BSP" }; /* Hexen II doesn't use a separate version, but we can still use a separate tag/name for it */ @@ -3626,4 +3628,4 @@ DecompressRow (const uint8_t *in, const int numbytes, uint8_t *decompressed) c--; } } while (out - decompressed < row); -} \ No newline at end of file +} From 1b586e62d9c614d7d4a23383209dd7d2ae9eb4d2 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sat, 11 Sep 2021 15:35:46 -0600 Subject: [PATCH 10/16] ci: mac: print shared library deps --- build-osx.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build-osx.sh b/build-osx.sh index dd29a5de..bd57dcc9 100755 --- a/build-osx.sh +++ b/build-osx.sh @@ -18,6 +18,13 @@ make -j8 testlight || exit 1 make -j8 testqbsp || exit 1 cpack || exit 1 +# print shared libraries used +otool -L ./light/light +otool -L ./qbsp/qbsp +otool -L ./vis/vis +otool -L ./bspinfo/bspinfo +otool -L ./bsputil/bsputil + # run tests ./light/testlight || exit 1 ./qbsp/testqbsp || exit 1 From 527c63f55fd53c4b2f332bf92fc3c645383e9abe Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sat, 11 Sep 2021 15:36:23 -0600 Subject: [PATCH 11/16] build: remove obsolete cmake min required in subprojects --- lightpreview/CMakeLists.txt | 1 - man/CMakeLists.txt | 1 - vis/CMakeLists.txt | 1 - 3 files changed, 3 deletions(-) diff --git a/lightpreview/CMakeLists.txt b/lightpreview/CMakeLists.txt index 5b371627..1cb7df55 100644 --- a/lightpreview/CMakeLists.txt +++ b/lightpreview/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required (VERSION 3.0) project (lightpreview CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt index 6a54a3ae..b5f2b425 100644 --- a/man/CMakeLists.txt +++ b/man/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required (VERSION 2.8) project (man) find_program (GROFF groff) diff --git a/vis/CMakeLists.txt b/vis/CMakeLists.txt index 4ec49686..8f0abb7c 100644 --- a/vis/CMakeLists.txt +++ b/vis/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required (VERSION 2.8) project (vis CXX) set(VIS_INCLUDES From bd3452bfdcdc65c48721c42f56d3221bf83783c4 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sat, 11 Sep 2021 23:49:29 -0600 Subject: [PATCH 12/16] build: simplify light build (embree handling) --- light/CMakeLists.txt | 50 +++++++++----------------------------------- 1 file changed, 10 insertions(+), 40 deletions(-) diff --git a/light/CMakeLists.txt b/light/CMakeLists.txt index e706ad7a..26b48559 100644 --- a/light/CMakeLists.txt +++ b/light/CMakeLists.txt @@ -60,7 +60,7 @@ target_link_libraries (light PRIVATE ${CMAKE_THREAD_LIBS_INIT}) if (embree_FOUND) target_link_libraries (light PRIVATE embree) add_definitions(-DHAVE_EMBREE) - + find_file(EMBREE_LICENSE LICENSE.txt "${embree_DIR}/doc" "${embree_DIR}/../embree3/embree3" # vcpkg puts it here @@ -72,48 +72,18 @@ if (embree_FOUND) message(STATUS "Found embree license: ${EMBREE_LICENSE}") endif() - if(WIN32) - file(GLOB EMBREE_DLLS "${embree_DIR}/bin/*.dll") - foreach(EMBREE_DLL ${EMBREE_DLLS}) - add_custom_command(TARGET light POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${EMBREE_DLL} $) - endforeach(EMBREE_DLL) - - add_custom_command(TARGET light POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${EMBREE_LICENSE} $/LICENSE-embree.txt) + add_custom_command(TARGET light POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${EMBREE_LICENSE}" "$/LICENSE-embree.txt") - install(FILES ${EMBREE_DLLS} DESTINATION bin) - endif() - if(UNIX) - if (APPLE) - set(SHARED_LIB_EXT dylib) - elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") - set(SHARED_LIB_EXT "so.*") - else () - message(FATAL_ERROR "only Linux and macOS currently supported") - endif() - - - file(GLOB EMBREE_DYLIBS_WITH_SYMLINKS "${embree_DIR}/lib/*.${SHARED_LIB_EXT}") - - # Gather all .dylib's that are not symlinks - foreach(EMBREE_DYLIB ${EMBREE_DYLIBS_WITH_SYMLINKS}) - if(NOT IS_SYMLINK ${EMBREE_DYLIB}) - list(APPEND EMBREE_DYLIBS ${EMBREE_DYLIB}) - endif() - endforeach() - - foreach(EMBREE_DYLIB ${EMBREE_DYLIBS}) - message(STATUS "Copying dylib: ${EMBREE_DYLIB}") - add_custom_command(TARGET light POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${EMBREE_DYLIB} $) - endforeach() - - # so the executable will search for dylib's in the same directory as the executable - if(APPLE) - add_custom_command(TARGET light POST_BUILD COMMAND bash ARGS -c \"install_name_tool -add_rpath @loader_path $ || true\") - endif() - - install(FILES ${EMBREE_DYLIBS} DESTINATION bin) + # so the executable will search for dylib's in the same directory as the executable + if(APPLE) + add_custom_command(TARGET light POST_BUILD + COMMAND bash ARGS -c \"install_name_tool -add_rpath @loader_path $ || true\") endif() + install(FILES "$" "$" DESTINATION bin) install(FILES ${EMBREE_LICENSE} DESTINATION bin RENAME LICENSE-embree.txt) endif(embree_FOUND) From 3f2d8c57c1c0d56c8f52c94bcfd5cef2234c74e7 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sun, 12 Sep 2021 01:17:09 -0600 Subject: [PATCH 13/16] build: fix finding embree license with mac package --- light/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/light/CMakeLists.txt b/light/CMakeLists.txt index 26b48559..71a1637c 100644 --- a/light/CMakeLists.txt +++ b/light/CMakeLists.txt @@ -63,11 +63,12 @@ if (embree_FOUND) find_file(EMBREE_LICENSE LICENSE.txt "${embree_DIR}/doc" + "${embree_DIR}/../../../doc" "${embree_DIR}/../embree3/embree3" # vcpkg puts it here "${embree_DIR}/../../.." # homebrew puts it here NO_DEFAULT_PATH) if (EMBREE_LICENSE STREQUAL EMBREE_LICENSE-NOTFOUND) - message(WARNING "Couldn't find embree license") + message(WARNING "Couldn't find embree license. embree_DIR is ${embree_DIR}") else() message(STATUS "Found embree license: ${EMBREE_LICENSE}") endif() From ac79487e4d7dfe6255368907371ea6f5ecd08fb6 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sun, 12 Sep 2021 01:30:04 -0600 Subject: [PATCH 14/16] ci: mac: use embree's official package over homebrew. Has @rpath set up already --- build-osx.sh | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/build-osx.sh b/build-osx.sh index bd57dcc9..3c486ff0 100755 --- a/build-osx.sh +++ b/build-osx.sh @@ -1,18 +1,35 @@ #!/bin/bash BUILD_DIR=build-osx +EMBREE_ZIP="https://github.com/embree/embree/releases/download/v3.13.0/embree-3.13.0.x86_64.macosx.zip" + +# embree-3.13.1.x86_64.macosx.zip +EMBREE_ZIP_NAME=$(basename "$EMBREE_ZIP") + +# embree-3.13.1.x86_64.macosx +EMBREE_DIR_NAME=$(basename "$EMBREE_ZIP_NAME" ".zip") + +TBB_TGZ="https://github.com/oneapi-src/oneTBB/releases/download/v2021.2.0/oneapi-tbb-2021.2.0-mac.tgz" +TBB_TGZ_NAME=$(basename "$TBB_TGZ") +TBB_DIR_NAME="oneapi-tbb-2021.2.0" if [ -d "$BUILD_DIR" ]; then echo "$BUILD_DIR already exists, remove it first" exit 1 fi -brew install embree tbb - mkdir "$BUILD_DIR" cd "$BUILD_DIR" -cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$(brew --prefix embree);$(brew --prefix tbb)" +wget "$EMBREE_ZIP" +unzip "$EMBREE_ZIP_NAME" + +wget "$TBB_TGZ" +tar xf "$TBB_TGZ_NAME" + +EMBREE_CMAKE_DIR="$(pwd)/$EMBREE_DIR_NAME/lib/cmake/embree-3.13.0" +TBB_CMAKE_DIR="$(pwd)/${TBB_DIR_NAME}/lib/cmake" +cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$EMBREE_CMAKE_DIR;$TBB_CMAKE_DIR" make -j8 || exit 1 make -j8 testlight || exit 1 make -j8 testqbsp || exit 1 From f284b963756233b786e4b55d1ac44ef1845862d9 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sun, 12 Sep 2021 14:35:28 -0600 Subject: [PATCH 15/16] ci: quiet some log spam --- build-osx.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build-osx.sh b/build-osx.sh index 3c486ff0..f26104ed 100755 --- a/build-osx.sh +++ b/build-osx.sh @@ -21,10 +21,10 @@ fi mkdir "$BUILD_DIR" cd "$BUILD_DIR" -wget "$EMBREE_ZIP" -unzip "$EMBREE_ZIP_NAME" +wget -q "$EMBREE_ZIP" +unzip -q "$EMBREE_ZIP_NAME" -wget "$TBB_TGZ" +wget -q "$TBB_TGZ" tar xf "$TBB_TGZ_NAME" EMBREE_CMAKE_DIR="$(pwd)/$EMBREE_DIR_NAME/lib/cmake/embree-3.13.0" From 28b4ec7f3f0be79a920d15217dabe0a1c5358f71 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sun, 12 Sep 2021 16:40:56 -0600 Subject: [PATCH 16/16] ci: fix linux CI (#321) --- build-linux-64.sh | 21 +++++++++++++-------- light/CMakeLists.txt | 17 ++++++++++++++++- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/build-linux-64.sh b/build-linux-64.sh index b6dcdc08..5b0a9828 100755 --- a/build-linux-64.sh +++ b/build-linux-64.sh @@ -1,6 +1,6 @@ #!/bin/bash -BUILD_DIR=build +BUILD_DIR=build-linux if [ -d "$BUILD_DIR" ]; then echo "$BUILD_DIR already exists, remove it first" @@ -11,15 +11,20 @@ cmake --version mkdir "$BUILD_DIR" cd "$BUILD_DIR" -wget https://github.com/embree/embree/releases/download/v2.17.7/embree-2.17.7.x86_64.linux.tar.gz -O embree.tgz -wget https://github.com/intel/tbb/releases/download/2017_U7/tbb2017_20170604oss_lin.tgz -O tbb.tgz +wget -q https://github.com/embree/embree/releases/download/v3.13.1/embree-3.13.1.x86_64.linux.tar.gz -O embree.tgz +wget -q https://github.com/oneapi-src/oneTBB/releases/download/v2021.3.0/oneapi-tbb-2021.3.0-lin.tgz -O tbb.tgz + tar xf embree.tgz tar xf tbb.tgz -cmake .. -DCMAKE_BUILD_TYPE=Release -Dembree_DIR="$(pwd)/embree-2.17.7.x86_64.linux" -DTBB_DIR="$(pwd)/tbb2017_20170604oss/cmake" -make -j8 VERBOSE=1 -make -j8 VERBOSE=1 testlight -make -j8 VERBOSE=1 testqbsp -cpack + +EMBREE_CMAKE_DIR="$(pwd)/embree-3.13.1.x86_64.linux/lib/cmake/embree-3.13.1" +TBB_CMAKE_DIR="$(pwd)/oneapi-tbb-2021.3.0/lib/cmake" + +cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$EMBREE_CMAKE_DIR;$TBB_CMAKE_DIR" +make -j8 VERBOSE=1 || exit 1 +make -j8 VERBOSE=1 testlight || exit 1 +make -j8 VERBOSE=1 testqbsp || exit 1 +cpack || exit 1 # run tests ./light/testlight || exit 1 diff --git a/light/CMakeLists.txt b/light/CMakeLists.txt index 71a1637c..cd62153c 100644 --- a/light/CMakeLists.txt +++ b/light/CMakeLists.txt @@ -83,8 +83,23 @@ if (embree_FOUND) add_custom_command(TARGET light POST_BUILD COMMAND bash ARGS -c \"install_name_tool -add_rpath @loader_path $ || true\") endif() + + install(FILES $ DESTINATION bin) + + # install TBB + if(UNIX) + # HACK: preferred method is installing the symlink instead of the actual .so + get_target_property(TBB_SO_FILE_SYMLINK TBB::tbb IMPORTED_LOCATION_RELEASE) + get_filename_component(TBB_SO_FILE "${TBB_SO_FILE_SYMLINK}" REALPATH) + + message(STATUS "TBB .so file: ${TBB_SO_FILE}") + + install(FILES ${TBB_SO_FILE} DESTINATION bin) + else() + # preferred method + install(FILES $ DESTINATION bin) + endif() - install(FILES "$" "$" DESTINATION bin) install(FILES ${EMBREE_LICENSE} DESTINATION bin RENAME LICENSE-embree.txt) endif(embree_FOUND)