Skip to content

Commit c4cb6d6

Browse files
Copilothzhangxyz
andauthored
Add vcpkg support (#62)
* Initial plan * Add vcpkg support with port files and CMake install targets Co-authored-by: hzhangxyz <[email protected]> * Add clarifying comments to portfile.cmake about placeholder values Co-authored-by: hzhangxyz <[email protected]> * Simplify CMakeLists.txt: remove LTO option and config template file Co-authored-by: hzhangxyz <[email protected]> * Update portfile.cmake: remove unused options and fixup call Co-authored-by: hzhangxyz <[email protected]> * Update vcpkg.json. * Update portfile.cmake. * Update CMakeLists.txt. * Update vcpkg.json. * Update portfile.cmake. * Update vcpkg.json. --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: hzhangxyz <[email protected]> Co-authored-by: Hao Zhang <[email protected]>
1 parent 42dbd14 commit c4cb6d6

File tree

3 files changed

+44
-3
lines changed

3 files changed

+44
-3
lines changed

CMakeLists.txt

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,26 @@ cmake_minimum_required(VERSION 3.30)
22
project(ds LANGUAGES CXX)
33
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
44

5-
file(GLOB_RECURSE SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc")
6-
add_library(${PROJECT_NAME} STATIC ${SOURCES})
7-
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
5+
include(GNUInstallDirs)
6+
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc")
7+
add_library(${PROJECT_NAME} STATIC)
8+
target_sources(${PROJECT_NAME} PRIVATE ${SOURCES})
9+
target_include_directories(${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
810
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)
911
set_property(TARGET ${PROJECT_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
1012

13+
install(TARGETS ${PROJECT_NAME}
14+
EXPORT ${PROJECT_NAME}-targets
15+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
16+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
17+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
18+
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
19+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
20+
install(EXPORT ${PROJECT_NAME}-targets
21+
FILE ${PROJECT_NAME}-config.cmake
22+
NAMESPACE ${PROJECT_NAME}::
23+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
24+
1125
file(GLOB EXECUTABLE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/examples/*.cc")
1226
foreach(EXEC_FILE ${EXECUTABLE_SOURCES})
1327
get_filename_component(EXEC_NAME ${EXEC_FILE} NAME_WE)

ports/ds/portfile.cmake

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
vcpkg_from_github(
2+
OUT_SOURCE_PATH SOURCE_PATH
3+
REPO USTC-KnowledgeComputingLab/ds
4+
REF main
5+
)
6+
7+
vcpkg_cmake_configure(
8+
SOURCE_PATH "${SOURCE_PATH}"
9+
)
10+
11+
vcpkg_cmake_build()
12+
13+
vcpkg_cmake_install()
14+
15+
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md")
16+
17+
vcpkg_cmake_config_fixup(PACKAGE_NAME ds CONFIG_PATH lib/cmake/ds)
18+
19+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

ports/ds/vcpkg.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "ds",
3+
"version-string": "0.0.0",
4+
"description": "A deductive system",
5+
"homepage": "https://github.com/USTC-KnowledgeComputingLab/ds",
6+
"license": "AGPL-3.0-or-later",
7+
"dependencies": []
8+
}

0 commit comments

Comments
 (0)