mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-06-28 16:58:39 -04:00
a08663c7b9
# Description of Changes <!-- Please describe your change, mention any related tickets, and so on here. --> - Bumps version to 2.7.0 # API and ABI breaking changes <!-- If this is an API or ABI breaking change, please apply the corresponding GitHub label. --> None # Expected complexity level and risk - 1 - this is just a version bump <!-- How complicated do you think these changes are? Grade on a scale from 1 to 5, where 1 is a trivial change, and 5 is a deep-reaching and complex change. This complexity rating applies not only to the complexity apparent in the diff, but also to its interactions with existing and future code. If you answered more than a 2, explain what is complex about the PR, and what other components it interacts with in potentially concerning ways. --> # Testing <!-- Describe any testing you've done, and any testing you'd like your reviewers to do, so that you're confident that all the changes work as expected! --> - [x] Version number is correct (`2.7.0`) - [x] BSL license file has been updated with the new date and version number
66 lines
2.5 KiB
CMake
66 lines
2.5 KiB
CMake
# SpacetimeDB C++ Module Library CMake Configuration
|
|
|
|
cmake_minimum_required(VERSION 3.15)
|
|
project(SpacetimeDBCppModuleLibrary
|
|
VERSION 2.7.0
|
|
LANGUAGES CXX)
|
|
|
|
# Generate version header from template
|
|
configure_file(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include/spacetimedb/version.h.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/include/spacetimedb/version.h
|
|
@ONLY
|
|
)
|
|
|
|
# Module Library source files
|
|
set(LIBRARY_SOURCES
|
|
src/abi/module_exports.cpp
|
|
src/abi/wasi_shims.cpp
|
|
src/internal/Module.cpp
|
|
src/internal/AlgebraicType.cpp # Required for V9 autogen types
|
|
src/internal/v9_builder.cpp # V9 incremental module builder
|
|
src/internal/v10_builder.cpp # V10 facade over module definition assembly
|
|
src/internal/module_type_registration.cpp # Unified type registration system
|
|
)
|
|
|
|
add_library(spacetimedb_cpp_library STATIC)
|
|
add_library(spacetimedb::spacetimedb_cpp_library ALIAS spacetimedb_cpp_library)
|
|
|
|
target_sources(spacetimedb_cpp_library PRIVATE ${LIBRARY_SOURCES})
|
|
|
|
# Require C++20 for consumers of this library without forcing global flags
|
|
target_compile_features(spacetimedb_cpp_library PUBLIC cxx_std_20)
|
|
target_compile_definitions(spacetimedb_cpp_library PRIVATE SPACETIMEDB_UNSTABLE_FEATURES)
|
|
|
|
# Set include directories
|
|
target_include_directories(spacetimedb_cpp_library
|
|
PUBLIC
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
|
|
$<INSTALL_INTERFACE:include>
|
|
)
|
|
|
|
# Create an alias target for better namespacing
|
|
add_library(spacetimedb::spacetimedb_cpp_library ALIAS spacetimedb_cpp_library)
|
|
|
|
# Set compile options if building for WASM
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
|
|
target_compile_options(spacetimedb_cpp_library PRIVATE
|
|
-O2 # Optimize for performance
|
|
-fno-exceptions # Disable exceptions for WASM compatibility
|
|
-ffunction-sections # Place each function in its own section
|
|
-fdata-sections # Place each data item in its own section
|
|
-Wall -Wextra # Enable warnings
|
|
)
|
|
# Note: -g0 should be set in the final executable's linker flags, not here
|
|
# This allows debugging the library during development if needed
|
|
endif()
|
|
|
|
# Export compile commands for better IDE support (top-level only)
|
|
if(PROJECT_IS_TOP_LEVEL)
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
endif()
|
|
|
|
# Unit/compile/smoke test harnesses live under `tests/` as standalone runners
|
|
# rather than being built through the top-level library CMake target.
|