Added vcpkg file and unix build commands

This commit is contained in:
Alejandro Saucedo 2020-08-29 09:14:40 +01:00
parent ae68570512
commit 0d4a81cfe5
4 changed files with 84 additions and 32 deletions

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.18.0)
cmake_minimum_required(VERSION 3.17.0)
project(kompute VERSION 0.1.0)
set(CMAKE_CXX_STANDARD 17)
@ -13,8 +13,6 @@ set(CMAKE_VERBOSE_MAKEFILE on)
option(KOMPUTE_OPT_BUILD_TESTS "Enable if you want to build tests" ON)
option(KOMPUTE_OPT_BUILD_DOCS "Enable if you want to build documentation" ON)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/config" ${CMAKE_MODULE_PATH})
# Allow scripts to call main kompute Makefile
function(kompute_make KOMPUTE_MAKE_TARGET)
add_custom_target(${KOMPUTE_MAKE_TARGET}
@ -24,6 +22,7 @@ endfunction()
add_subdirectory(src)
if(KOMPUTE_OPT_BUILD_DOCS)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/config" ${CMAKE_MODULE_PATH})
add_subdirectory(docs)
endif()

100
Makefile
View file

@ -1,57 +1,99 @@
# This makefile is optimized to be run from WSL and to interact with the
# Windows host as there are limitations when building GPU programs. This
# makefile contains the commands for interacting with the visual studio
# build via command line for faster iterations, as the intention is to
# support other editors (optimised for vim). There are also commands that
# support the builds for linux-native compilations and these are the commands
# starting with mk_.
VCPKG_WIN_PATH ?= "C:\\Users\\axsau\\Programming\\lib\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake"
VCPKG_UNIX_PATH ?= "/c/Users/axsau/Programming/lib/vcpkg/scripts/buildsystems/vcpkg.cmake"
ifeq ($(OS),Windows_NT) # is Windows_NT on XP, 2000, 7, Vista, 10...
CMAKE_BIN ?= "C:\Program Files\CMake\bin\cmake.exe"
SCMP_BIN="C:\\VulkanSDK\\1.2.141.2\\Bin32\\glslangValidator.exe"
MSBUILD_BIN ?= "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe"
VCPKG_CMAKE ?= "C:\\Users\\axsau\\Programming\\lib\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake"
else
CLANG_FORMAT_BIN ?= "/home/alejandro/Programming/lib/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang-format"
CMAKE_BIN ?= "/c/Program Files/CMake/bin/cmake.exe"
SCMP_BIN ?= "/c/VulkanSDK/1.2.141.2/Bin32/glslangValidator.exe"
MSBUILD_BIN ?= "/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe"
VCPKG_CMAKE ?= "C:\\Users\\axsau\\Programming\\lib\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake"
endif
####### Main Target Rules #######
run_cmake:
$(CMAKE_BIN) \
-Bbuild \
-DCMAKE_TOOLCHAIN_FILE=$(VCPKG_CMAKE) \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-G "Visual Studio 16 2019"
push_docs_to_ghpages:
GIT_DEPLOY_DIR="build/docs/sphinx/" \
GIT_DEPLOY_BRANCH="gh-pages" \
GIT_DEPLOY_REPO="origin" \
./scripts/push_folder_to_branch.sh
####### Visual studio build shortcut commands #######
build_all:
$(MSBUILD_BIN) build/kompute.sln
build_docs:
$(MSBUILD_BIN) build/docs/gendocsall.vcxproj
build_kompute:
$(MSBUILD_BIN) build/src/kompute.vcxproj
build_tests:
$(MSBUILD_BIN) build/test/test_kompute.vcxproj
run_docs: build_docs
(cd build/docs/sphinx && python2.7 -m SimpleHTTPServer)
run_tests: build_tests
./build/test/Debug/test_kompute.exe
####### CMAKE quickstart commands #######
clean_cmake:
rm -rf build/
####### Visual studio build shortcut commands #######
mk_cmake:
$(CMAKE_BIN) \
-Bbuild \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=$(VCPKG_UNIX_PATH) \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-G "Unix Makefiles"
mk_build_all:
make -C build/
mk_build_docs:
make -C build/ docs
mk_build_kompute:
make -C build/ kompute
mk_build_tests:
make -C build/ test_kompute
mk_run_docs: mk_build_docs
(cd build/docs/sphinx && python2.7 -m SimpleHTTPServer)
mk_run_tests: mk_build_tests
./build/test/test_kompute
####### Visual studio build shortcut commands #######
vs_cmake:
$(CMAKE_BIN) \
-Bbuild \
-DCMAKE_TOOLCHAIN_FILE=$(VCPKG_WIN_PATH) \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-G "Visual Studio 16 2019"
vs_build_all:
$(MSBUILD_BIN) build/kompute.sln
vs_build_docs:
$(MSBUILD_BIN) build/docs/gendocsall.vcxproj
vs_build_kompute:
$(MSBUILD_BIN) build/src/kompute.vcxproj
vs_build_tests:
$(MSBUILD_BIN) build/test/test_kompute.vcxproj
vs_run_docs: vs_build_docs
(cd build/docs/sphinx && python2.7 -m SimpleHTTPServer)
vs_run_tests: vs_build_tests
./build/test/Debug/test_kompute.exe
####### General project commands #######
install_python_reqs:
python -m pip install -r scripts/requirements.txt

View file

@ -6,6 +6,7 @@
TEST_CASE("Tensor should have same vector as initialised") {
std::vector<uint32_t> vec{0,1,2};
kp::Tensor tensor(vec);
REQUIRE( tensor.size() == vec.size() );
REQUIRE( tensor.data() == vec );
}

10
vcpkg.json Normal file
View file

@ -0,0 +1,10 @@
{
"name": "example",
"version-string": "0.0.1",
"dependencies": [
"fmt",
"spdlog",
"vulkan",
"catch2"
]
}