mirror of
https://github.com/hanzoai/insights.git
synced 2026-10-30 16:15:31 +00:00
The tree was a debranded snapshot of upstream taken around 2026-02-20, and upstream has moved about five months since. This replaces it with upstream master, mechanically re-derived: bin/debrand does the rename, and the pipeline and squashed migrations are restored from the shipped tree. Not a merge. The previous import replaced the tree wholesale in a single commit, so there is no shared content history to merge against. Reproducing the rename on the new tree is what actually converges. What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints, compose files, LLM.md, and insights/migrations. The squashed initial migration is load-bearing — the live database records it by name, so upstream's ~918 individual migrations cannot come back. Nine products are dropped as unreferenced. Twenty-one more that we do not run are kept anyway because the core app still imports them; unpicking those is a refactor and does not belong in a rebase. This base does not build yet, and the reasons are not in the rename: upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against our 4.2, and the dependency manifests still name upstream packages that we republish under our own names. Those are decisions, not renames.
104 lines
3.5 KiB
CMake
104 lines
3.5 KiB
CMake
cmake_minimum_required(VERSION 3.10)
|
|
project(insightsql_parser LANGUAGES CXX)
|
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
include(FetchContent)
|
|
|
|
FetchContent_Declare(
|
|
antlr4
|
|
GIT_REPOSITORY https://github.com/antlr/antlr4.git
|
|
GIT_TAG 4.13.2
|
|
)
|
|
|
|
set(ANTLR_BUILD_CPP_TESTS OFF CACHE BOOL "" FORCE)
|
|
set(ANTLR_BUILD_SHARED OFF CACHE BOOL "" FORCE)
|
|
set(ANTLR4_WITH_STATIC_CRT OFF CACHE BOOL "" FORCE)
|
|
|
|
# Using FetchContent_Populate instead of FetchContent_MakeAvailable:
|
|
# - ANTLR4: Only need runtime/Cpp subdirectory, not the full project
|
|
FetchContent_Populate(antlr4)
|
|
|
|
add_subdirectory(${antlr4_SOURCE_DIR}/runtime/Cpp EXCLUDE_FROM_ALL)
|
|
|
|
set(ANTLR_INCLUDE_DIR ${antlr4_SOURCE_DIR}/runtime/Cpp/runtime/src/)
|
|
|
|
set(PARSER_SOURCES
|
|
InsightsQLLexer.cpp
|
|
InsightsQLParser.cpp
|
|
InsightsQLParserBaseVisitor.cpp
|
|
InsightsQLParserVisitor.cpp
|
|
json.cpp
|
|
error.cpp
|
|
string.cpp
|
|
)
|
|
|
|
add_library(
|
|
insightsql_parser
|
|
${PARSER_SOURCES})
|
|
|
|
target_include_directories(
|
|
insightsql_parser
|
|
PRIVATE ${ANTLR_INCLUDE_DIR}
|
|
)
|
|
|
|
target_link_libraries(insightsql_parser
|
|
PRIVATE antlr4_static
|
|
)
|
|
|
|
if(EMSCRIPTEN)
|
|
# Global: all targets (including antlr4) need native WASM exceptions
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fwasm-exceptions")
|
|
|
|
# Shared link flags for all WASM targets
|
|
set(WASM_COMMON_LINK_FLAGS "\
|
|
-lembind \
|
|
-s WASM=1 \
|
|
-s MODULARIZE=1 \
|
|
-s EXPORT_NAME='createInsightsQLParser' \
|
|
-s ALLOW_MEMORY_GROWTH=1 \
|
|
-s SINGLE_FILE=1 \
|
|
")
|
|
|
|
# ESM build (for Node.js ESM — includes Node.js createRequire support)
|
|
add_executable(insightsql_parser_wasm parser_wasm.cpp)
|
|
target_include_directories(insightsql_parser_wasm PRIVATE ${ANTLR_INCLUDE_DIR})
|
|
target_link_libraries(insightsql_parser_wasm PRIVATE insightsql_parser antlr4_static)
|
|
set_target_properties(insightsql_parser_wasm PROPERTIES
|
|
SUFFIX ".js"
|
|
LINK_FLAGS "${WASM_COMMON_LINK_FLAGS} -s EXPORT_ES6=1"
|
|
)
|
|
|
|
# Browser ESM build (web/worker only — no Node.js import("module") references)
|
|
add_executable(insightsql_parser_wasm_browser parser_wasm.cpp)
|
|
target_include_directories(insightsql_parser_wasm_browser PRIVATE ${ANTLR_INCLUDE_DIR})
|
|
target_link_libraries(insightsql_parser_wasm_browser PRIVATE insightsql_parser antlr4_static)
|
|
set_target_properties(insightsql_parser_wasm_browser PROPERTIES
|
|
OUTPUT_NAME "insightsql_parser_wasm_browser"
|
|
SUFFIX ".js"
|
|
LINK_FLAGS "${WASM_COMMON_LINK_FLAGS} -s EXPORT_ES6=1 -s ENVIRONMENT='web,worker'"
|
|
)
|
|
|
|
# CJS build (for Jest and other CommonJS environments)
|
|
add_executable(insightsql_parser_wasm_cjs parser_wasm.cpp)
|
|
target_include_directories(insightsql_parser_wasm_cjs PRIVATE ${ANTLR_INCLUDE_DIR})
|
|
target_link_libraries(insightsql_parser_wasm_cjs PRIVATE insightsql_parser antlr4_static)
|
|
set_target_properties(insightsql_parser_wasm_cjs PROPERTIES
|
|
OUTPUT_NAME "insightsql_parser_wasm"
|
|
SUFFIX ".cjs"
|
|
LINK_FLAGS "${WASM_COMMON_LINK_FLAGS}"
|
|
)
|
|
|
|
# Install WASM outputs to dist/
|
|
# Usage: cmake --install build_wasm --prefix .
|
|
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR} CACHE PATH "" FORCE)
|
|
install(TARGETS insightsql_parser_wasm insightsql_parser_wasm_browser insightsql_parser_wasm_cjs RUNTIME DESTINATION dist)
|
|
install(FILES
|
|
${PROJECT_SOURCE_DIR}/index.d.ts
|
|
${PROJECT_SOURCE_DIR}/index.cjs
|
|
DESTINATION dist
|
|
)
|
|
endif()
|