Skip to content

Commit

Permalink
[external] vendor dependencies get rid of vcpkg
Browse files Browse the repository at this point in the history
  • Loading branch information
jd28 committed Apr 3, 2024
1 parent 923be09 commit 6eb6e5a
Show file tree
Hide file tree
Showing 2,281 changed files with 1,442,151 additions and 159 deletions.
48 changes: 1 addition & 47 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,9 @@ on:

env:
buildDir: "${{ github.workspace }}/build/"
vcpkg-tag: "master"
VCPKG_ROOT: "${{ github.workspace }}/vcpkg/"
VCPKG_DEFAULT_BINARY_CACHE: "${{ github.workspace }}/vcpkg/.cache"
NWN_ROOT: "${{ github.workspace }}/nwn/"
CI_GITHUB_ACTIONS: "1"
MACOSX_DEPLOYMENT_TARGET: "12"
CMAKE_TOOLCHAIN_FILE: "${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake"

jobs:
build:
Expand Down Expand Up @@ -56,7 +52,7 @@ jobs:
choco upgrade ccache ninja
# macOS Dependencies
- name: macOS - install non-vcpkg dependencies
- name: macOS - install dependencies
if: matrix.os == 'macos-12'
env:
HOMEBREW_NO_ANALYTICS: "ON"
Expand Down Expand Up @@ -98,21 +94,6 @@ jobs:
# Install latest CMake.
- uses: lukka/get-cmake@latest

# vcpkg
- name: all - download vcpkg
run: |
git clone https://github.com/microsoft/vcpkg ${{ github.workspace }}/vcpkg || true
- name: all - cache vcpkg
id: cache-vcpkg
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/vcpkg/.cache
key: ${{ runner.os }}-build-${{ env.vcpkg-tag }}-${{ env.DATE }}-${{ hashFiles('vcpkg.json') }}
restore-keys: |
${{ runner.os }}-build-
- name: all - cache ccache
uses: actions/cache@v4
with:
Expand All @@ -122,18 +103,6 @@ jobs:
restore-keys: |
${{ runner.os }}-ccache-
- name: macOS|linux - bootstrap vcpkg
if: matrix.os != 'windows-latest' && steps.cache-vcpkg.outputs.cache-hit != 'true'
run: |
mkdir -p vcpkg/.cache
vcpkg/bootstrap-vcpkg.sh
- name: windows - bootstrap vcpkg
if: matrix.os == 'windows-latest' && steps.cache-vcpkg.outputs.cache-hit != 'true'
run: |
md vcpkg/.cache -ea 0
vcpkg/bootstrap-vcpkg.bat
# nwn
- name: all - cache nwn
id: cache-nwn
Expand All @@ -157,13 +126,6 @@ jobs:
with:
arch: x64

- name: Reset vcpkg env vars.
if: matrix.os == 'windows-latest'
run: |
echo "VCPKG_ROOT=${{ github.workspace }}/vcpkg/" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "CMAKE_TOOLCHAIN_FILE=${{env.CMAKE_TOOLCHAIN_FILE}}" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "VCPKG_DEFAULT_BINARY_CACHE=${{env.VCPKG_DEFAULT_BINARY_CACHE}}" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: setup ccache
run: |
ccache --set-config=cache_dir=${{ github.workspace }}/.ccache
Expand Down Expand Up @@ -219,14 +181,6 @@ jobs:
ls -la $HOST_CCACHE_DIR
ccache -s
- name: Download vcpkg Cache from Docker (linux only)
if: ${{ runner.os == 'Linux' }}
run: |
env
rm -rf $VCPKG_DEFAULT_BINARY_CACHE
mv ./wheelhouse/.vcpkg_cache $VCPKG_DEFAULT_BINARY_CACHE
ls -la $VCPKG_DEFAULT_BINARY_CACHE
- uses: actions/upload-artifact@v4
with:
name: artifact-${{matrix.os}}
Expand Down
20 changes: 2 additions & 18 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ jobs:
analyze:
env:
buildDir: "${{ github.workspace }}/build/"
vcpkg-tag: "2023.06.20"
VCPKG_ROOT: "${{ github.workspace }}/vcpkg/"
VCPKG_DEFAULT_BINARY_CACHE: "${{ github.workspace }}/vcpkg/.cache"
CCACHE_DIR: "${{ github.workspace }}/ccache/"

name: Analyze
Expand Down Expand Up @@ -88,28 +85,15 @@ jobs:
- name: Install latest CMake.
uses: lukka/get-cmake@latest

- name: download vcpkg
run: |
git clone https://github.com/microsoft/vcpkg ${{ github.workspace }}/vcpkg || true
pushd vcpkg
./bootstrap-vcpkg.sh
popd
- name: cache vcpkg
id: cache-vcpkg
- name: cache ccache
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/vcpkg/.cache
${{ github.workspace }}/ccache
key: ${{ runner.os }}-analyze-${{ env.vcpkg-tag }}-${{ env.DATE }}-${{ hashFiles('vcpkg.json') }}
key: ${{ runner.os }}-analyze-${{ env.DATE }}
restore-keys: |
${{ runner.os }}-analyze-
- name: Make cache dir
if: steps.cache-vcpkg.outputs.cache-hit != 'true'
run: mkdir -p "${{ github.workspace }}/vcpkg/.cache"

- name: Configure
run: |
cmake --preset ci-codeql
Expand Down
22 changes: 3 additions & 19 deletions .github/workflows/coverage-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ jobs:
build:
env:
buildDir: "${{ github.workspace }}/build/"
vcpkg-tag: "2023.06.20"
VCPKG_ROOT: "${{ github.workspace }}/vcpkg/"
VCPKG_DEFAULT_BINARY_CACHE: "${{ github.workspace }}/vcpkg/.cache"
ASAN_OPTIONS: "detect_leaks=0:detect_container_overflow=0" # Not read for this yet..
NWN_ROOT: "${{ github.workspace }}/nwn/"
CI_GITHUB_ACTIONS: "1"
Expand Down Expand Up @@ -59,28 +56,15 @@ jobs:
# Install latest CMake.
- uses: lukka/get-cmake@latest

- name: download vcpkg
run: |
git clone https://github.com/microsoft/vcpkg ${{ github.workspace }}/vcpkg || true
pushd vcpkg
./bootstrap-vcpkg.sh
popd
- name: cache vcpkg
id: cache-vcpkg
- name: cache ccache
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/vcpkg/.cache
${{ github.workspace }}/ccache
key: ${{ runner.os }}-coverage-${{ env.vcpkg-tag }}-${{ env.DATE }}-${{ hashFiles('vcpkg.json') }}
key: ${{ runner.os }}-coverage-${{ env.DATE }}
restore-keys: |
${{ runner.os }}-coverage-
- name: Make cache dir
if: steps.cache-vcpkg.outputs.cache-hit != 'true'
run: mkdir -p "${{ github.workspace }}/vcpkg/.cache"

- name: cache nwn
id: cache-nwn
uses: actions/cache@v4
Expand Down Expand Up @@ -111,7 +95,7 @@ jobs:
- name: Coverage
run: |
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' '/Library/*' $(pwd)'/tests/*' $(pwd)'/build/vcpkg_installed/*' $(pwd)'/external/*' --output-file coverage.info
lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' '/Library/*' $(pwd)'/tests/*' $(pwd)'/external/*' --output-file coverage.info
lcov --list coverage.info
bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov did not collect coverage reports"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Build
build/
!external/**/build
build-doc/
vcpkg/
vcpkg_installed/
Expand Down
22 changes: 22 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ else()
message(FATAL "Unsupported target platform")
endif()

set(ZLIB_BUILD_EXAMPLES OFF)
set(ZLIB_ENABLE_TESTS OFF)
add_subdirectory(external/zlib-1.3.1)

include_directories(SYSTEM external)
include_directories(SYSTEM external/immer)
include_directories(SYSTEM external/nowide/include)
Expand All @@ -68,8 +72,26 @@ add_subdirectory(external/fmt-10.2.1)
add_subdirectory(external/fzy)
add_subdirectory(external/immer)
add_subdirectory(external/inih)

add_subdirectory(external/libiconv)

include_directories(SYSTEM external/sqlite-3.45.2)
add_subdirectory(external/sqlite-3.45.2)

add_subdirectory(external/minizip)
include_directories(SYSTEM external/minizip/include)

add_subdirectory(external/nowide)
add_subdirectory(external/stb)

include_directories(SYSTEM external/zstd-1.5.6/lib)
set(ZSTD_BUILD_PROGRAMS OFF)
set(ZSTD_BUILD_STATIC ON)
set(ZSTD_BUILD_SHARED OFF)
set(ZSTD_BUILD_TESTS OFF)
set(ZSTD_BUILD_CONTRIB OFF)
add_subdirectory(external/zstd-1.5.6/build/cmake)

add_subdirectory(lib/nw)

if (ROLLNW_BUILD_TESTS)
Expand Down
8 changes: 0 additions & 8 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
"binaryDir": "${sourceDir}/build",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": {
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"type": "FILEPATH"
},
"ROLLNW_BUILD_BENCHMARKS": {
"type": "BOOL",
"value": "OFF"
Expand Down Expand Up @@ -116,10 +112,6 @@
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-windows-static",
"VCPKG_HOST_TRIPLET": "x64-windows-static"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ graft notebooks
graft rollnw-py
graft rollnw-stubs
graft tests
global-include CMakeLists.txt CMakePresets.json *.cmake vcpkg.json
global-include CMakeLists.txt CMakePresets.json *.cmake
prune **/__pycache__
prune **/rollnw-egg.info
global-exclude .DS_Store
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ A lot of what's here was written in the 2011-2015 range as part of personal mini
## Credits

- [Bioware](https://bioware.com), [Beamdog](https://beamdog.com) - The game itself
- [vcpkg](https://github.com/microsoft/vcpkg) - Package Management
- [abseil](https://abseil.io/) - Foundational
- [Catch2](https://github.com/catchorg/Catch2) - Testing
- [glm](https://www.opengl.org/sdk/libs/GLM/) - Mathematics
Expand Down
20 changes: 1 addition & 19 deletions docs/gs/building.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,6 @@ building
rollnw uses cmake as its build system and more specifically
`CMakePresets.json <https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html>`__.

Install `vcpkg <https://github.com/microsoft/vcpkg>`__. All vcpkg packages required will be built
automatically. Just export the vcpkg root path in an ENV var:

.. tabs::

.. tab:: Linux / MacOS

.. code:: bash
$ export VCPKG_ROOT=path/to/vcpkg
.. tab:: Windows

.. code:: batch
set VCPKG_ROOT=C:\path\to\vcpkg
To build the library, all one needs to do is use the following cmake commands. This example
also builds tests which are not enabled by default.

Expand All @@ -39,8 +22,7 @@ also builds tests which are not enabled by default.

.. note::

The deployment target is currently set to 10.15. Only x86_64 builds are supported
due to vcpkg.
The deployment target is currently set to 12.

.. code:: bash
Expand Down
1 change: 0 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ Credits
-------

- `Bioware <https://bioware.com>`__, `Beamdog <https://beamdog.com>`__ - The game itself
- `vcpkg <https://github.com/microsoft/vcpkg>`__ - Package Management
- `abseil <https://abseil.io/>`__ - Foundational
- `Catch2 <https://github.com/catchorg/Catch2>`__ - Testing
- `glm <https://www.opengl.org/sdk/libs/GLM/>`__ - Mathematics
Expand Down
69 changes: 69 additions & 0 deletions external/glm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
file(GLOB ROOT_SOURCE *.cpp)
file(GLOB ROOT_INLINE *.inl)
file(GLOB ROOT_HEADER *.hpp)
file(GLOB ROOT_TEXT ../*.txt)
file(GLOB ROOT_MD ../*.md)
file(GLOB ROOT_NAT ../util/glm.natvis)

file(GLOB_RECURSE CORE_SOURCE ./detail/*.cpp)
file(GLOB_RECURSE CORE_INLINE ./detail/*.inl)
file(GLOB_RECURSE CORE_HEADER ./detail/*.hpp)

file(GLOB_RECURSE EXT_SOURCE ./ext/*.cpp)
file(GLOB_RECURSE EXT_INLINE ./ext/*.inl)
file(GLOB_RECURSE EXT_HEADER ./ext/*.hpp)

file(GLOB_RECURSE GTC_SOURCE ./gtc/*.cpp)
file(GLOB_RECURSE GTC_INLINE ./gtc/*.inl)
file(GLOB_RECURSE GTC_HEADER ./gtc/*.hpp)

file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp)
file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl)
file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp)

file(GLOB_RECURSE SIMD_SOURCE ./simd/*.cpp)
file(GLOB_RECURSE SIMD_INLINE ./simd/*.inl)
file(GLOB_RECURSE SIMD_HEADER ./simd/*.h)

source_group("Text Files" FILES ${ROOT_TEXT} ${ROOT_MD})
source_group("Core Files" FILES ${CORE_SOURCE})
source_group("Core Files" FILES ${CORE_INLINE})
source_group("Core Files" FILES ${CORE_HEADER})
source_group("EXT Files" FILES ${EXT_SOURCE})
source_group("EXT Files" FILES ${EXT_INLINE})
source_group("EXT Files" FILES ${EXT_HEADER})
source_group("GTC Files" FILES ${GTC_SOURCE})
source_group("GTC Files" FILES ${GTC_INLINE})
source_group("GTC Files" FILES ${GTC_HEADER})
source_group("GTX Files" FILES ${GTX_SOURCE})
source_group("GTX Files" FILES ${GTX_INLINE})
source_group("GTX Files" FILES ${GTX_HEADER})
source_group("SIMD Files" FILES ${SIMD_SOURCE})
source_group("SIMD Files" FILES ${SIMD_INLINE})
source_group("SIMD Files" FILES ${SIMD_HEADER})

add_library(glm-header-only INTERFACE)
add_library(glm::glm-header-only ALIAS glm-header-only)

target_include_directories(glm-header-only INTERFACE
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)

if (GLM_BUILD_LIBRARY)
add_library(glm
${ROOT_TEXT} ${ROOT_MD} ${ROOT_NAT}
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
${EXT_SOURCE} ${EXT_INLINE} ${EXT_HEADER}
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}
${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER}
)
add_library(glm::glm ALIAS glm)
target_link_libraries(glm PUBLIC glm-header-only)
else()
add_library(glm INTERFACE)
add_library(glm::glm ALIAS glm)
target_link_libraries(glm INTERFACE glm-header-only)
endif()
Loading

0 comments on commit 6eb6e5a

Please sign in to comment.