2019-05-10 04:52:36 +08:00
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
2019-11-02 07:51:08 +08:00
|
|
|
index 0418d4a..ac8f0f2 100644
|
2019-05-10 04:52:36 +08:00
|
|
|
--- a/CMakeLists.txt
|
|
|
|
+++ b/CMakeLists.txt
|
2019-11-02 07:51:08 +08:00
|
|
|
@@ -2,6 +2,8 @@
|
|
|
|
cmake_minimum_required(VERSION 2.8.7)
|
2019-05-10 04:52:36 +08:00
|
|
|
project(jsonnet C CXX)
|
|
|
|
|
|
|
|
+add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
|
|
|
+
|
2019-11-02 07:51:08 +08:00
|
|
|
include(ExternalProject)
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
|
|
|
@@ -89,6 +91,7 @@ else()
|
2019-05-10 04:52:36 +08:00
|
|
|
endif()
|
|
|
|
|
2019-08-19 23:55:29 +08:00
|
|
|
# Compiler flags.
|
|
|
|
+if (0)
|
|
|
|
if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" OR
|
|
|
|
${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
|
|
|
set(OPT "-O3")
|
2019-11-02 07:51:08 +08:00
|
|
|
@@ -98,6 +101,7 @@ else()
|
2019-08-19 23:55:29 +08:00
|
|
|
# TODO: Windows support.
|
|
|
|
message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER_ID} not supported")
|
|
|
|
endif()
|
|
|
|
+endif()
|
|
|
|
|
2019-05-10 04:52:36 +08:00
|
|
|
# Look for libraries in global output path.
|
|
|
|
link_directories(${GLOBAL_OUTPUT_PATH})
|
2019-08-19 23:55:29 +08:00
|
|
|
diff --git a/cmd/CMakeLists.txt b/cmd/CMakeLists.txt
|
2019-11-02 07:51:08 +08:00
|
|
|
index c032f02..d80d2a0 100644
|
2019-08-19 23:55:29 +08:00
|
|
|
--- a/cmd/CMakeLists.txt
|
|
|
|
+++ b/cmd/CMakeLists.txt
|
|
|
|
@@ -13,5 +13,5 @@ if (BUILD_JSONNETFMT OR BUILD_TESTS)
|
2019-11-02 07:51:08 +08:00
|
|
|
add_dependencies(jsonnetfmt libjsonnet_for_binaries)
|
|
|
|
target_link_libraries(jsonnetfmt libjsonnet_for_binaries)
|
2019-05-10 04:52:36 +08:00
|
|
|
|
2019-08-19 23:55:29 +08:00
|
|
|
- install(TARGETS jsonnetfmt DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
|
|
|
+ install(TARGETS jsonnetfmt DESTINATION tools/jsonnet)
|
|
|
|
endif()
|
2019-05-10 04:52:36 +08:00
|
|
|
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
|
2019-11-02 07:51:08 +08:00
|
|
|
index 60fdcb1..82fb7c2 100644
|
2019-05-10 04:52:36 +08:00
|
|
|
--- a/core/CMakeLists.txt
|
|
|
|
+++ b/core/CMakeLists.txt
|
|
|
|
@@ -28,7 +28,7 @@ set(LIBJSONNET_SOURCE
|
|
|
|
string_utils.cpp
|
|
|
|
vm.cpp)
|
|
|
|
|
|
|
|
-add_library(libjsonnet SHARED ${LIBJSONNET_HEADERS} ${LIBJSONNET_SOURCE})
|
|
|
|
+add_library(libjsonnet ${LIBJSONNET_HEADERS} ${LIBJSONNET_SOURCE})
|
|
|
|
add_dependencies(libjsonnet md5 stdlib)
|
2019-11-02 07:51:08 +08:00
|
|
|
target_link_libraries(libjsonnet md5 nlohmann_json::nlohmann_json)
|
2019-05-10 04:52:36 +08:00
|
|
|
|
2019-11-02 07:51:08 +08:00
|
|
|
@@ -46,7 +46,7 @@ set_target_properties(libjsonnet PROPERTIES OUTPUT_NAME jsonnet
|
|
|
|
PUBLIC_HEADER "${LIB_HEADER}")
|
2019-08-19 23:55:29 +08:00
|
|
|
install(TARGETS libjsonnet
|
|
|
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
2019-11-02 07:51:08 +08:00
|
|
|
- ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
|
|
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
2019-08-19 23:55:29 +08:00
|
|
|
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
2019-05-10 04:52:36 +08:00
|
|
|
|
2019-11-02 07:51:08 +08:00
|
|
|
if (BUILD_STATIC_LIBS)
|
2019-05-10 04:52:36 +08:00
|
|
|
diff --git a/stdlib/CMakeLists.txt b/stdlib/CMakeLists.txt
|
2019-11-02 07:51:08 +08:00
|
|
|
index a481d9f..0dc3ab6 100644
|
2019-05-10 04:52:36 +08:00
|
|
|
--- a/stdlib/CMakeLists.txt
|
|
|
|
+++ b/stdlib/CMakeLists.txt
|
2019-08-19 23:55:29 +08:00
|
|
|
@@ -2,6 +2,7 @@
|
2019-05-10 04:52:36 +08:00
|
|
|
|
|
|
|
add_executable(to_c_array to_c_array.cpp)
|
|
|
|
|
2019-08-19 23:55:29 +08:00
|
|
|
+if (0)
|
|
|
|
# Custom command that will only build stdlib when it changes.
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${PROJECT_SOURCE_DIR}/core/std.jsonnet.h
|
2019-11-02 07:51:08 +08:00
|
|
|
@@ -13,3 +14,4 @@ add_custom_command(
|
2019-05-10 04:52:36 +08:00
|
|
|
# Standard library build target that libjsonnet can depend on.
|
|
|
|
add_custom_target(stdlib ALL
|
2019-11-02 07:51:08 +08:00
|
|
|
DEPENDS ${PROJECT_SOURCE_DIR}/core/std.jsonnet.h)
|
|
|
|
+endif()
|
|
|
|
\ No newline at end of file
|