Skip to content

Commit

Permalink
Added helper commands and configuration to make it easier to install
Browse files Browse the repository at this point in the history
  • Loading branch information
axsaucedo committed Sep 13, 2020
1 parent 2e8a5aa commit b1a0dd3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.17.0)
project(kompute VERSION 0.1.0)
project(kompute VERSION 0.3.0)

set(CMAKE_CXX_STANDARD 17)

Expand All @@ -9,7 +9,6 @@ set(CMAKE_VERBOSE_MAKEFILE on)
# Enable or disable targets
option(KOMPUTE_OPT_BUILD_TESTS "Enable if you want to build tests" 1)
option(KOMPUTE_OPT_BUILD_DOCS "Enable if you want to build documentation" 1)
option(KOMPUTE_OPT_DEBUG_SYMBOLS "Enable if you want to build debug with symbols" 0)
option(KOMPUTE_OPT_ENABLE_SPDLOG "Extra compile flags for Kompute, see docs for full list" 1)

set(KOMPUTE_EXTRA_CXX_FLAGS "" CACHE STRING "Extra compile flags for Kompute, see docs for full list")
Expand Down
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ clean_cmake:
####### Visual studio build shortcut commands #######

MK_BUILD_TYPE ?= "Release"
MK_INSTALL_PATH ?= "build/src/CMakeFiles/Export/" # Set to "" if prefer default

mk_cmake:
cmake \
-Bbuild \
-DCMAKE_BUILD_TYPE=$(MK_BUILD_TYPE) \
-DKOMPUTE_OPT_BUILD_DOCS=0 \
-DCMAKE_INSTALL_PREFIX=$(MK_INSTALL_PATH) \
-DCMAKE_TOOLCHAIN_FILE=$(VCPKG_UNIX_PATH) \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-G "Unix Makefiles"
Expand Down Expand Up @@ -74,15 +76,20 @@ mk_run_tests: mk_build_tests

VS_BUILD_TYPE ?= "Debug"
# Run with multiprocessin / parallel build by default
VS_CMAKE_EXTRA_FLAGS ?= "/MP"
VS_CMAKE_EXTRA_FLAGS ?= ""
VS_KOMPUTE_EXTRA_CXX_FLAGS ?= "/MP"
VS_INSTALL_PATH ?= "build/src/CMakeFiles/Export/" # Set to "" if prefer default

vs_cmake:
$(CMAKE_BIN) \
-Bbuild \
-DCMAKE_TOOLCHAIN_FILE=$(VCPKG_WIN_PATH) \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
$(VS_CMAKE_EXTRA_FLAGS) \
-DKOMPUTE_EXTRA_CXX_FLAGS=$(VS_KOMPUTE_EXTRA_CXX_FLAGS) \
-DCMAKE_INSTALL_PREFIX=$(VS_INSTALL_PATH) \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD=ON \
-G "Visual Studio 16 2019"

vs_build_all:
Expand All @@ -91,6 +98,9 @@ vs_build_all:
vs_build_docs:
$(MSBUILD_BIN) build/docs/gendocsall.vcxproj -p:Configuration=$(VS_BUILD_TYPE)

vs_install_kompute:
$(MSBUILD_BIN) build/src/INSTALL.vcxproj -p:Configuration=$(VS_BUILD_TYPE)

vs_build_kompute:
$(MSBUILD_BIN) build/src/kompute.vcxproj -p:Configuration=$(VS_BUILD_TYPE)

Expand Down
8 changes: 5 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,18 @@ add_dependencies(kompute

add_library(kompute::kompute ALIAS kompute)


install(TARGETS kompute EXPORT KomputeTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
INCLUDES DESTINATION include)

install(DIRECTORY include/ DESTINATION include)

install(DIRECTORY ${PROJECT_SOURCE_DIR}/single_include/
DESTINATION include)

install(EXPORT KomputeTargets
FILE KomputeTargets.cmake
NAMESPACE kp::
FILE komputeConfig.cmake
NAMESPACE kompute::
DESTINATION lib/cmake/kompute)

0 comments on commit b1a0dd3

Please sign in to comment.