+ xo-cmake build
This commit is contained in:
parent
2cb4df32e9
commit
c88807597e
3 changed files with 213 additions and 0 deletions
104
CMakeLists.txt
Normal file
104
CMakeLists.txt
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
# xo/CMakeLists.txt
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
project(xo-submodule3 VERSION 1.0)
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# global build settings
|
||||
|
||||
# Adopting submodule builds directly into this cmake.
|
||||
# Submodule builds will pickup dependent xo artifacts directly
|
||||
# from sibling build dirs.
|
||||
# (Contrast with a build that relies on install step).
|
||||
# In particular, configure step in satellite projects
|
||||
# needs to avoid using cmake find_package() on sibling xo projects:
|
||||
# 1. .cmake support files
|
||||
# fooConfig.cmake
|
||||
# fooConfigVersion.cmake
|
||||
# fooTargets.cmake
|
||||
# won't have been installed
|
||||
# 2. In any case, they point to final install location;
|
||||
# we need build location
|
||||
#
|
||||
set(XO_SUBMODULE_BUILD True)
|
||||
|
||||
# toplevel source directory; used only with XO_SUBMODULE_BUILD
|
||||
set(XO_UMBRELLA_SOURCE_DIR ${CMAKE_SOURCE_DIR})
|
||||
set(XO_UMBRELLA_REPO_SUBDIR .)
|
||||
# toplevel binary directory; used only with XO_SUBMODULE_BUILD
|
||||
set(XO_UMBRELLA_BINARY_DIR ${CMAKE_BINARY_DIR})
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/xo-cmake/cmake)
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# unit test setup
|
||||
|
||||
enable_testing()
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# global c++ settings.
|
||||
|
||||
enable_language(CXX)
|
||||
|
||||
# temporary compiler flags here
|
||||
set(PROJECT_CXX_FLAGS "")
|
||||
add_definitions(${PROJECT_CXX_FLAGS})
|
||||
|
||||
if(NOT CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "")
|
||||
|
||||
if(NOT CMAKE_INSTALL_RPATH)
|
||||
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib CACHE STRING "runpath for installed libraries/executables")
|
||||
endif()
|
||||
|
||||
message("-- CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}")
|
||||
message("-- CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
|
||||
message("-- CMAKE_INSTALL_RPATH=${CMAKE_INSTALL_RPATH}")
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# xo satellite projects
|
||||
|
||||
add_subdirectory(xo-cmake)
|
||||
#add_subdirectory(xo-indentlog)
|
||||
#add_subdirectory(xo-refcnt)
|
||||
#add_subdirectory(xo-subsys)
|
||||
#add_subdirectory(xo-randomgen)
|
||||
#add_subdirectory(xo-ordinaltree)
|
||||
#add_subdirectory(xo-pyutil)
|
||||
#add_subdirectory(xo-flatstring)
|
||||
#add_subdirectory(xo-reflectutil)
|
||||
#add_subdirectory(xo-reflect)
|
||||
#add_subdirectory(xo-pyreflect)
|
||||
#add_subdirectory(xo-ratio)
|
||||
#add_subdirectory(xo-unit)
|
||||
#add_subdirectory(xo-pyunit)
|
||||
#add_subdirectory(xo-expression)
|
||||
#add_subdirectory(xo-pyexpression)
|
||||
#add_subdirectory(xo-tokenizer)
|
||||
#add_subdirectory(xo-reader)
|
||||
#add_subdirectory(xo-jit)
|
||||
#add_subdirectory(xo-pyjit)
|
||||
#add_subdirectory(xo-callback)
|
||||
#add_subdirectory(xo-webutil)
|
||||
#add_subdirectory(xo-pywebutil)
|
||||
#add_subdirectory(xo-printjson)
|
||||
#add_subdirectory(xo-pyprintjson)
|
||||
#add_subdirectory(xo-reactor)
|
||||
#add_subdirectory(xo-pyreactor)
|
||||
#add_subdirectory(xo-websock)
|
||||
#add_subdirectory(xo-pywebsock)
|
||||
#add_subdirectory(xo-statistics)
|
||||
#add_subdirectory(xo-distribution)
|
||||
#add_subdirectory(xo-pydistribution)
|
||||
#add_subdirectory(xo-simulator)
|
||||
#add_subdirectory(xo-pysimulator)
|
||||
#add_subdirectory(xo-process)
|
||||
#add_subdirectory(xo-pyprocess)
|
||||
#add_subdirectory(xo-kalmanfilter)
|
||||
#add_subdirectory(xo-pykalmanfilter)
|
||||
94
default.nix
Normal file
94
default.nix
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
#{ pkgs ? import <nixpkgs> { overlays = [ (final: prev: { llvmPackages = prev.llvmPackages_17; }) ]; } }:
|
||||
#pkgs.mkShell {
|
||||
# buildInputs = [ pkgs.coreutils ];
|
||||
#}
|
||||
|
||||
|
||||
{
|
||||
nixpkgs-path ? ../nixpkgs,
|
||||
|
||||
# pkgs ? import (fetchTarball {
|
||||
# # 24.05-darwin works on macos, clang17, llvm 18 (copying from xo-nix2)
|
||||
# url = "https://github.com/NixOS/nixpkgs/archive/dd868b7bd4d1407d607da0d1d9c5eca89132e2f7.tar.gz";
|
||||
# }),
|
||||
} :
|
||||
|
||||
let
|
||||
# this approach (overlays) is effective, but has super wide cross-section,
|
||||
# since absolutely everything has to be rebuilt from source
|
||||
#
|
||||
|
||||
llvm-overlay = self: super: {
|
||||
# use 'super' when you want to override the terms of a package.
|
||||
# use 'self' when pointing to an existing package
|
||||
|
||||
llvmPackages = super.llvmPackages_18;
|
||||
};
|
||||
|
||||
xo-overlay = self: super:
|
||||
let
|
||||
# Choose the LLVM version you want
|
||||
llvmPackages = self.llvmPackages_18;
|
||||
in
|
||||
|
||||
let
|
||||
# Rebuild stdenv to use that LLVM version
|
||||
customStdenv = super.overrideCC super.stdenv llvmPackages.clang;
|
||||
in
|
||||
|
||||
{
|
||||
xo-cmake = self.callPackage pkgs/xo-cmake.nix {};
|
||||
# xo-indentlog = self.callPackage pkgs/xo-indentlog.nix {};
|
||||
# xo-refcnt = self.callPackage pkgs/xo-refcnt.nix {};
|
||||
# xo-subsys = self.callPackage pkgs/xo-subsys.nix {};
|
||||
# xo-randomgen = self.callPackage pkgs/xo-randomgen.nix {};
|
||||
# xo-ordinaltree = self.callPackage pkgs/xo-ordinaltree.nix {};
|
||||
# xo-pyutil = self.callPackage pkgs/xo-pyutil.nix {};
|
||||
# xo-flatstring = self.callPackage pkgs/xo-flatstring.nix {};
|
||||
# xo-reflectutil = self.callPackage pkgs/xo-reflectutil.nix {};
|
||||
# xo-reflect = self.callPackage pkgs/xo-reflect.nix {};
|
||||
# xo-pyreflect = self.callPackage pkgs/xo-pyreflect.nix {};
|
||||
# xo-ratio = self.callPackage pkgs/xo-ratio.nix {};
|
||||
# xo-unit = self.callPackage pkgs/xo-unit.nix {};
|
||||
# xo-pyunit = self.callPackage pkgs/xo-pyunit.nix {};
|
||||
# xo-expression = self.callPackage pkgs/xo-expression.nix {};
|
||||
# xo-pyexpression = self.callPackage pkgs/xo-pyexpression.nix {};
|
||||
# xo-tokenizer = self.callPackage pkgs/xo-tokenizer.nix {};
|
||||
# xo-reader = self.callPackage pkgs/xo-reader.nix {};
|
||||
# xo-jit = self.callPackage pkgs/xo-jit.nix { stdenv = customStdenv;
|
||||
# clang = llvmPackages.clang;
|
||||
# llvm = llvmPackages.llvm; };
|
||||
# xo-pyjit = self.callPackage pkgs/xo-pyjit.nix {};
|
||||
# xo-callback = self.callPackage pkgs/xo-callback.nix {};
|
||||
# xo-webutil = self.callPackage pkgs/xo-webutil.nix {};
|
||||
# xo-pywebutil = self.callPackage pkgs/xo-pywebutil.nix {};
|
||||
# xo-printjson = self.callPackage pkgs/xo-printjson.nix {};
|
||||
# xo-pyprintjson = self.callPackage pkgs/xo-pyprintjson.nix {};
|
||||
# xo-reactor = self.callPackage pkgs/xo-reactor.nix {};
|
||||
# xo-pyreactor = self.callPackage pkgs/xo-pyreactor.nix {};
|
||||
# xo-websock = self.callPackage pkgs/xo-websock.nix {};
|
||||
# xo-pywebsock = self.callPackage pkgs/xo-pywebsock.nix {};
|
||||
# xo-statistics = self.callPackage pkgs/xo-statistics.nix {};
|
||||
# xo-distribution = self.callPackage pkgs/xo-distribution.nix {};
|
||||
# xo-pydistribution = self.callPackage pkgs/xo-pydistribution.nix {};
|
||||
# xo-simulator = self.callPackage pkgs/xo-simulator.nix {};
|
||||
# xo-pysimulator = self.callPackage pkgs/xo-pysimulator.nix {};
|
||||
# xo-process = self.callPackage pkgs/xo-process.nix {};
|
||||
# xo-pyprocess = self.callPackage pkgs/xo-pyprocess.nix {};
|
||||
# xo-kalmanfilter = self.callPackage pkgs/xo-kalmanfilter.nix {};
|
||||
# xo-pykalmanfilter = self.callPackage pkgs/xo-pykalmanfilter.nix {};
|
||||
#
|
||||
# xo-userenv = self.callPackage pkgs/xo-userenv.nix {};
|
||||
# xo-userenv-slow = self.callPackage pkgs/xo-userenv-slow.nix {};
|
||||
};
|
||||
|
||||
in
|
||||
let
|
||||
pkgs = import nixpkgs-path {
|
||||
overlays = [
|
||||
# llvm-overlay
|
||||
xo-overlay
|
||||
];
|
||||
};
|
||||
in
|
||||
pkgs
|
||||
15
pkgs/xo-cmake.nix
Normal file
15
pkgs/xo-cmake.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
# dependencies
|
||||
|
||||
stdenv,
|
||||
cmake
|
||||
} :
|
||||
|
||||
stdenv.mkDerivation (finalattrs:
|
||||
{
|
||||
name = "xo-cmake";
|
||||
|
||||
src = ../xo-cmake;
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue