Skip to content

Commit d845c21

Browse files
committed
vcpkg: initial files
1 parent 2c297bc commit d845c21

File tree

8 files changed

+159
-0
lines changed

8 files changed

+159
-0
lines changed

cmake/CMakeLists.txt

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
cmake_minimum_required(VERSION 3.10)
2+
3+
include(GNUInstallDirs)
4+
5+
set(name cssom)
6+
7+
project(${name})
8+
9+
find_package(utki CONFIG REQUIRED)
10+
find_package(papki CONFIG REQUIRED)
11+
12+
file(GLOB_RECURSE srcs "../src/${name}/*.cpp")
13+
14+
add_library(
15+
${name}
16+
STATIC
17+
${srcs}
18+
)
19+
20+
target_compile_features(${name} PUBLIC cxx_std_17)
21+
set_target_properties(${name} PROPERTIES CXX_STANDARD_REQUIRED ON)
22+
set_target_properties(${name} PROPERTIES CXX_EXTENSIONS OFF)
23+
24+
target_include_directories(
25+
${name}
26+
INTERFACE
27+
$<BUILD_INTERFACE:>
28+
$<INSTALL_INTERFACE:include>
29+
)
30+
31+
target_link_libraries(
32+
${name}
33+
PUBLIC
34+
utki::utki
35+
papki::papki
36+
)
37+
38+
# install library header files preserving directory hierarchy
39+
install(
40+
DIRECTORY
41+
"${CMAKE_CURRENT_SOURCE_DIR}/../src/${name}"
42+
DESTINATION
43+
"${CMAKE_INSTALL_INCLUDEDIR}"
44+
FILES_MATCHING PATTERN
45+
"*.hpp"
46+
)
47+
48+
install(
49+
TARGETS
50+
${name}
51+
EXPORT # generate cmake configs
52+
${name}-config
53+
)
54+
55+
# install cmake configs
56+
install(
57+
EXPORT
58+
${name}-config
59+
FILE
60+
${name}-config.cmake
61+
DESTINATION
62+
${CMAKE_INSTALL_DATAROOTDIR}/${name}
63+
NAMESPACE
64+
${name}::
65+
)

vcpkg/portfile.cmake.in

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
2+
3+
vcpkg_from_github(
4+
OUT_SOURCE_PATH SOURCE_PATH
5+
REPO cppfw/${PORT}
6+
REF $(git_ref)
7+
SHA512 $(archive_hash)
8+
HEAD_REF main
9+
)
10+
11+
vcpkg_cmake_configure(
12+
SOURCE_PATH "${SOURCE_PATH}/cmake"
13+
)
14+
15+
vcpkg_cmake_install()
16+
17+
vcpkg_cmake_config_fixup()
18+
19+
# Delete the include directory from the debug installation to prevent overlap.
20+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
21+
22+
# Install the LICENSE file to the package's share directory and rename it to copyright.
23+
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
24+
25+
# Copy the usage instruction file to the package's share directory.
26+
configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" COPYONLY)

vcpkg/test/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
cmake_minimum_required(VERSION 3.10)
2+
3+
set(CMAKE_TOOLCHAIN_FILE $ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
4+
5+
project(test)
6+
7+
find_package(utki CONFIG REQUIRED)
8+
find_package(cssom CONFIG REQUIRED)
9+
10+
add_executable(test main.cpp)
11+
12+
target_link_libraries(test PRIVATE cssom::cssom)

vcpkg/test/main.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <cssom/om.hpp>
2+
3+
int main(int argc, const char** argv){
4+
cssom::sheet css;
5+
6+
std::cout << "num styles = " << css.styles.size() << std::endl;
7+
8+
return 0;
9+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"default-registry": {
3+
"kind": "git",
4+
"baseline": "5e5d0e1cd7785623065e77eff011afdeec1a3574",
5+
"repository": "https://github.com/microsoft/vcpkg"
6+
},
7+
"registries": [
8+
{
9+
"kind": "git",
10+
"repository": "https://github.com/cppfw/vcpkg-repo/",
11+
"baseline": "",
12+
"reference": "main",
13+
"packages": [ "utki", "papki" ]
14+
}
15+
],
16+
"overlay-ports": [
17+
"../overlay"
18+
]
19+
}

vcpkg/test/vcpkg.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"dependencies": [
3+
"cssom"
4+
]
5+
}

vcpkg/usage

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
cssom provides CMake targets:
2+
3+
find_package(cssom CONFIG REQUIRED)
4+
target_link_libraries(main PRIVATE cssom::cssom)

vcpkg/vcpkg.json.in

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "cssom",
3+
"version": "$(version)",
4+
"homepage": "https://github.com/cppfw/cssom",
5+
"description": "filesystem abstraction in C++",
6+
"license": "MIT",
7+
"dependencies": [
8+
{
9+
"name" : "vcpkg-cmake",
10+
"host" : true
11+
},
12+
{
13+
"name" : "vcpkg-cmake-config",
14+
"host" : true
15+
},
16+
"utki",
17+
"papki"
18+
]
19+
}

0 commit comments

Comments
 (0)