diff --git a/.gitignore b/.gitignore index 1098acc..72be43c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,5 @@ main plot out.yaml .ccls-cache -.xmake/ +.cache build/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..0dea36f --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.14) +project(ufo VERSION 0.0.0 LANGUAGES CXX) +enable_testing() +include(GNUInstallDirs) + +set_property(GLOBAL PROPERTY CXX_STANDARD 23) +set_property(GLOBAL PROPERTY CXX_STANDARD_REQUIRED ON) +set_property(GLOBAL PROPERTY CXX_EXTENSIONS OFF) + +find_package(yaml-cpp REQUIRED) +find_package(Eigen3 REQUIRED) +find_package(fmt REQUIRED) +find_package(concurrencpp REQUIRED) +find_package(HighFive REQUIRED) +find_package(TBB REQUIRED) +find_package(Matplot++ REQUIRED) +find_path(ZPP_BITS_INCLUDE_DIR zpp_bits.h REQUIRED) + +add_executable(ufo src/ufo.cpp) +target_include_directories(ufo PRIVATE ${PROJECT_SOURCE_DIR}/include ${ZPP_BITS_INCLUDE_DIR}) +target_link_libraries(ufo PRIVATE + yaml-cpp Eigen3::Eigen fmt::fmt concurrencpp::concurrencpp HighFive_HighFive TBB::tbb Matplot++::matplot) + +get_property(ImportedTargets DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS) +message("Imported targets: ${ImportedTargets}") +message("List of compile features: ${CMAKE_CXX_COMPILE_FEATURES}") diff --git a/flake.lock b/flake.lock index a62e708..76e2f3f 100644 --- a/flake.lock +++ b/flake.lock @@ -807,11 +807,11 @@ "touchix": "touchix" }, "locked": { - "lastModified": 1695648380, - "narHash": "sha256-8zQct7OdcAtzwsvyPy07wImEtO6v0Rz//grrDtol+Jo=", + "lastModified": 1695703232, + "narHash": "sha256-JqKKV5Zh3r4SAmK1Y0WdZaN5chRuaWRxw5hv9YPCRlQ=", "owner": "CHN-beta", "repo": "nixos", - "rev": "e21c7a916a66de6894c3e785a3a0d5f621458272", + "rev": "6318b938c2b3742874982d5d1a338656a50e493b", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index eb57543..2b1932a 100644 --- a/flake.nix +++ b/flake.nix @@ -5,20 +5,17 @@ outputs = inputs: let pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux; - localPackages = inputs.nixos.nixosConfigurations.pc.pkgs.localPackages; + localPackages = import "${inputs.nixos}/local/pkgs" { inherit pkgs; inherit (inputs.nixpkgs) lib; }; in { - devShell.x86_64-linux = pkgs.mkShell.override { stdenv = pkgs.stdenvNoCC; } + devShell.x86_64-linux = pkgs.mkShell.override { stdenv = pkgs.gcc13Stdenv; } { - packages = with pkgs; [ xmake gcc13 pkg-config cmake ]; - inputsFrom = with pkgs; + packages = with pkgs; [ pkg-config cmake ninja ]; + buildInputs = with pkgs; [ - yaml-cpp eigen fmt localPackages.concurrencpp highfive - hdf5.dev tbb_2021_8.dev localPackages.matplotplusplus + yaml-cpp eigen fmt localPackages.concurrencpp highfive tbb_2021_8.dev localPackages.matplotplusplus localPackages.zpp-bits ]; - PKG_CONFIG_PATH = "${pkgs.tbb_2021_8.dev}/lib/pkgconfig:${pkgs.yaml-cpp}/share/pkgconfig"; - yaml-cpp_DIR = "${pkgs.yaml-cpp}/share/cmake/yaml-cpp"; hardeningDisable = [ "all" ]; NIX_DEBUG = "1"; }; diff --git a/test.cpp b/test.cpp new file mode 100644 index 0000000..9a5d3e6 --- /dev/null +++ b/test.cpp @@ -0,0 +1,26 @@ +# include +# include +# include +# include + +namespace Eigen +{ + constexpr auto serialize(auto & archive, Eigen::Matrix3d& matrix) + { + return archive(std::span(matrix.data(), 9)); + } + constexpr auto serialize(auto & archive, const Eigen::Matrix3d& matrix) + { + return archive(std::span(matrix.data(), 9)); + } +} + +int main() +{ + auto [data, in, out] = zpp::bits::data_in_out(); + Eigen::Matrix3d PrimativeCell = Eigen::Matrix3d::Identity(); + out(PrimativeCell); + Eigen::Matrix3d PrimativeCell2; + in(PrimativeCell2); + std::cout << PrimativeCell2 << std::endl; +} \ No newline at end of file