From 000f11136d88167dcb643caa815f1f712c2dfb55 Mon Sep 17 00:00:00 2001 From: atkawa7 Date: Sun, 3 Sep 2017 12:44:15 -0700 Subject: [PATCH] [jsonnet] init fixes #869 --- ports/jsonnet/CMakeLists.txt | 53 ++++++++++++++++++++++++++++++++++++ ports/jsonnet/CONTROL | 3 ++ ports/jsonnet/portfile.cmake | 29 ++++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 ports/jsonnet/CMakeLists.txt create mode 100644 ports/jsonnet/CONTROL create mode 100644 ports/jsonnet/portfile.cmake diff --git a/ports/jsonnet/CMakeLists.txt b/ports/jsonnet/CMakeLists.txt new file mode 100644 index 0000000000..4f749e5b83 --- /dev/null +++ b/ports/jsonnet/CMakeLists.txt @@ -0,0 +1,53 @@ +cmake_minimum_required(VERSION 3.5.1) +project(jsonnet) + +if(MSVC) + add_compile_options(/W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS) +endif() + +if(BUILD_SHARED_LIBS) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +endif() + +set( jsonnet_sources + core/desugarer.cpp + core/formatter.cpp + core/lexer.cpp + core/libjsonnet.cpp + core/parser.cpp + core/pass.cpp + core/static_analysis.cpp + core/string_utils.cpp + core/vm.cpp +) + +include_directories(third_party/md5 include cpp core stdlib) + +add_library(md5 STATIC third_party/md5/md5.cpp) + +add_library(libjsonnet ${jsonnet_sources}) +target_link_libraries(libjsonnet md5) + +add_library(libjsonnet++ cpp/libjsonnet++.cpp) +target_link_libraries(libjsonnet++ libjsonnet) + +add_executable(jsonnet cmd/jsonnet.cpp) +target_link_libraries(jsonnet libjsonnet) + + +install( + TARGETS libjsonnet libjsonnet++ + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) +if(NOT DISABLE_INSTALL_TOOLS) + install ( + TARGETS jsonnet + RUNTIME DESTINATION tools/jsonnet + ) +endif() + +if(NOT DISABLE_INSTALL_HEADERS) + install(FILES include/libjsonnet++.h include/libjsonnet.h DESTINATION include) +endif() diff --git a/ports/jsonnet/CONTROL b/ports/jsonnet/CONTROL new file mode 100644 index 0000000000..0254fc14c2 --- /dev/null +++ b/ports/jsonnet/CONTROL @@ -0,0 +1,3 @@ +Source: jsonnet +Version: 2017-09-02-11cf9fa9f2fe8acbb14b096316006082564ca580 +Description: Jsonnet - The data templating language diff --git a/ports/jsonnet/portfile.cmake b/ports/jsonnet/portfile.cmake new file mode 100644 index 0000000000..0fa1bf14d0 --- /dev/null +++ b/ports/jsonnet/portfile.cmake @@ -0,0 +1,29 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO google/jsonnet + REF 11cf9fa9f2fe8acbb14b096316006082564ca580 + SHA512 77d9c9e86c4c6501a00f089c72dea522dd818ac0c810b603d18bea111f8f8cf9a25039600a9ba158c5f02142e24d49074e7fe0ddf113665eedf4c3ef66bf421a + HEAD_REF master +) + +vcpkg_execute_required_process( + COMMAND Powershell -Command "((Get-Content -Encoding Byte ${SOURCE_PATH}/stdlib/std.jsonnet) -join ',') + ',0' > ${SOURCE_PATH}/core/std.jsonnet.h" + WORKING_DIRECTORY ${SOURCE_PATH} + LOGNAME "std.jsonnet" +) + + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON -DDISABLE_INSTALL_TOOLS=ON +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() +vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/jsonnet) + +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/jsonnet RENAME copyright)