Alien-LibJQ
view release on metacpan or search on metacpan
],
'%{make}',
'%{make} install',
];
plugin 'Gather::IsolateDynamic';
# save correct package settings
# for now there is no good way to retrieve them from cmake
gather sub {
my ( $build ) = @_;
my $prefix = $build->runtime_prop->{prefix};
$build->runtime_prop->{cflags} = "-I$prefix/include";
$build->runtime_prop->{cflags_static} = "-I$prefix/include";
my $extra_libs = ' -lm';
$extra_libs .= ' -lshlwapi' if $^O eq 'MSWin32';
$build->runtime_prop->{libs} = "-L$prefix/lib -ljq -lonig". $extra_libs;
$build->runtime_prop->{libs_static} = "-L$prefix/lib -ljq -lonig". $extra_libs;
};
};
jq/CMakeLists.txt view on Meta::CPAN
cmake_minimum_required(VERSION 3.13)
project(jq C)
set(PACKAGE jq)
set(PACKAGE_VERSION "1.6")
set(SO_VERSION "1:4:0")
# interface target holding all compile flags, includes and link dependencies
add_library(jq_compiler_flags INTERFACE)
target_compile_features(jq_compiler_flags INTERFACE c_std_11)
target_compile_options(jq_compiler_flags INTERFACE
"$<$<COMPILE_LANG_AND_ID:C,GNU>:$<BUILD_INTERFACE:-Wall;-Wextra;-Wno-missing-field-initializers;-Wno-unused-parameter;-Wno-unused-function>>"
"$<$<COMPILE_LANG_AND_ID:C,MSVC>:$<BUILD_INTERFACE:-W4>>"
)
target_include_directories(jq_compiler_flags INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)
# control where the static and shared libraries are built so that on windows
# we don't need to tinker with the path to run the executable
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
#if(APPLE)
# set(CMAKE_INSTALL_RPATH "@executable_path/../lib")
#elseif(UNIX)
# set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib")
#endif()
function(target_compile_definitions_if_true)
foreach(arg IN LISTS ARGN)
if(${arg})
#message(STATUS "define ${arg}")
target_compile_definitions(jq_compiler_flags INTERFACE ${arg}=1)
endif()
endforeach()
endfunction()
#option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
#if(MSVC)
# option(MSVC_STATIC_RUNTIME "Build with static runtime" OFF)
#endif()
option(ENABLE_MAINTAINER_MODE "Enable maintainer mode" ON)
option(ENABLE_VALGRIND "Run tests under Valgrind" ON)
jq/CMakeLists.txt view on Meta::CPAN
if(ENABLE_DOCS)
find_program(BUNDLE_cmd bundle DOC "bundle is required to build jq documentation")
if(NOT BUNDLE_cmd)
option(ENABLE_DOCS "Build docs" OFF)
message(WARNING "Ruby dependencies for building jq documentation not found")
endif()
endif()
set(VERSION ${PACKAGE_VERSION})
target_compile_definitions(jq_compiler_flags INTERFACE PACKAGE=${PACKAGE} VERSION=${VERSION})
include(modules/oniguruma/cmake/dist.cmake)
include(CheckCSourceCompiles)
include(CheckIncludeFiles)
include(CheckFunctionExists)
include(CheckSymbolExists)
include(CheckStructHasMember)
include(TestBigEndian)
if(MINGW OR WIN32)
set(HAVE_WIN32 1)
target_compile_definitions(jq_compiler_flags INTERFACE WIN32=1)
endif()
check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS)
check_include_files(sys/types.h HAVE_SYS_TYPES_H)
check_include_files(sys/stat.h HAVE_SYS_STAT_H)
check_include_files(stdlib.h HAVE_STDLIB_H)
check_include_files(string.h HAVE_STRING_H)
check_include_files(memory.h HAVE_MEMORY_H)
check_include_files(strings.h HAVE_STRINGS_H)
check_include_files(inttypes.h HAVE_INTTYPES_H)
check_include_files(stdint.h HAVE_STDINT_H)
jq/CMakeLists.txt view on Meta::CPAN
if(CMAKE_USE_PTHREADS_INIT)
#set(CMAKE_REQUIRED_LIBRARIES "pthread")
check_symbol_exists(pthread_key_create "pthread.h" HAVE_PTHREAD_KEY_CREATE)
check_symbol_exists(pthread_once "pthread.h" HAVE_PTHREAD_ONCE)
check_symbol_exists(atexit "stdlib.h" HAVE_ATEXIT)
target_compile_definitions_if_true(
HAVE_PTHREAD_KEY_CREATE
HAVE_PTHREAD_ONCE
HAVE_ATEXIT
)
target_link_libraries(jq_compiler_flags Threads::Threads)
endif()
endif()
set(CMAKE_REQUIRED_LIBRARIES "m")
check_symbol_exists(acos "math.h" HAVE_ACOS)
check_symbol_exists(acosh "math.h" HAVE_ACOSH)
check_symbol_exists(asin "math.h" HAVE_ASIN)
check_symbol_exists(asinh "math.h" HAVE_ASINH)
check_symbol_exists(atan2 "math.h" HAVE_ATAN2)
check_symbol_exists(atan "math.h" HAVE_ATAN)
jq/CMakeLists.txt view on Meta::CPAN
HAVE_Y0
HAVE_Y1
HAVE_YN
)
CHECK_C_SOURCE_COMPILES("static __thread int x = 1; int main() { return x; }" HAVE___THREAD)
target_compile_definitions_if_true(HAVE___THREAD)
TEST_BIG_ENDIAN(TEST_BYTE_ORDER_BIG_ENDIAN)
if(TEST_BYTE_ORDER_BIG_ENDIAN)
target_compile_definitions(jq_compiler_flags INTERFACE IEEE_MC68k=1)
else()
target_compile_definitions(jq_compiler_flags INTERFACE IEEE_8087=1)
endif()
set(HAVE_LIBONIG 0)
if(WITH_ONIGURUMA STREQUAL "builtin")
message(STATUS "build and link builtin oniguruma library")
add_subdirectory(modules/oniguruma)
set(HAVE_LIBONIG 1)
elseif(IS_DIRECTORY ${WITH_ONIGURUMA})
message(STATUS "link oniguruma library from ${WITH_ONIGURUMA}")
find_package(oniguruma REQUIRED PATHS ${WITH_ONIGURUMA} NO_DEFAULT_PATH)
jq/CMakeLists.txt view on Meta::CPAN
src/builtin.c src/bytecode.c src/compile.c src/execute.c
src/jq_test.c src/jv.c src/jv_alloc.c src/jv_aux.c
src/jv_dtoa.c src/jv_file.c src/jv_parse.c src/jv_print.c
src/jv_unicode.c src/linker.c src/locfile.c src/util.c
src/builtin.h src/bytecode.h src/compile.h
src/exec_stack.h src/jq_parser.h src/jv_alloc.h src/jv_dtoa.h
src/jv_unicode.h src/jv_utf8_tables.h src/lexer.l src/libm.h
src/linker.h src/locfile.h src/opcode_list.h src/parser.y
src/util.h
)
target_link_libraries(jq PUBLIC "$<BUILD_INTERFACE:jq_compiler_flags>")
target_link_libraries(jq PUBLIC -lm)
target_link_options(jq PRIVATE -export-symbols-regex '^j[qv]_' -version-info ${SO_VERSION})
#target_link_options(jq PRIVATE -export-symbols-regex '^j[qv]_')
set_target_properties(jq PROPERTIES
VERSION ${VERSION}
SOVERSION ${SO_VERSION}
)
if(HAVE_WIN32)
target_link_libraries(jq PUBLIC -lshlwapi)
endif()
jq/jq.pc.cmake.in view on Meta::CPAN
libdir=${exec_prefix}/lib
includedir=${prefix}/include
datarootdir=${prefix}/share
datadir=${prefix}/share
Name: jq
Description: lightweight and flexible command-line JSON processor
Version: @PACKAGE_VERSION@
Requires:
Libs: -L${libdir} -ljq -lonig -lm
Cflags: -I${includedir}
( run in 1.964 second using v1.01-cache-2.11-cpan-94b05bcf43c )