diff --git a/external/toxcore/CMakeLists.txt b/external/toxcore/CMakeLists.txt index 29d6594..7974ddc 100644 --- a/external/toxcore/CMakeLists.txt +++ b/external/toxcore/CMakeLists.txt @@ -166,22 +166,22 @@ if (NOT TARGET toxcore) # TODO: add the others configure_file( ${TOX_DIR}toxcore/tox.h - ${TOX_DIR}tox/tox.h + ${toxcore_BINARY_DIR}/include/tox/tox.h @ONLY ) configure_file( ${TOX_DIR}toxcore/tox_events.h - ${TOX_DIR}tox/tox_events.h + ${toxcore_BINARY_DIR}/include/tox/tox_events.h @ONLY ) configure_file( ${TOX_DIR}toxcore/tox_private.h - ${TOX_DIR}tox/tox_private.h + ${toxcore_BINARY_DIR}/include/tox/tox_private.h @ONLY ) target_include_directories(toxcore PRIVATE "${TOX_DIR}toxcore") - target_include_directories(toxcore PUBLIC "${TOX_DIR}") + target_include_directories(toxcore PUBLIC "${toxcore_BINARY_DIR}/include/") target_compile_definitions(toxcore PUBLIC USE_IPV6=1) #target_compile_definitions(toxcore PUBLIC MIN_LOGGER_LEVEL=LOGGER_LEVEL_DEBUG) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..91862b1 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1694553957, + "narHash": "sha256-8o15HEax53lBJjjcr5VHMpuuT6vBcrzSNB6y2iGlPaU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e7fe745d22df5fa282b321e577fe18d4f62e0f0b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "release-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..8115acb --- /dev/null +++ b/flake.nix @@ -0,0 +1,58 @@ +{ + description = "totato flake"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/release-23.05"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + toxcore-src = pkgs.fetchFromGitHub { + owner = "Green-Sky"; + repo = "c-toxcore"; + fetchSubmodules = true; + rev = "d4b06edc2a35bad51b0f0950d74f61c8c70630ab"; # ngc_events + hash = "sha256-P7wTojRQRtvTx+h9+QcFdO381hniWWpAy5Yv63KWWZA="; + }; + in { + packages.default = pkgs.stdenv.mkDerivation { + pname = "totato"; + version = "0.0.0-dev"; + + src = ./.; + + nativeBuildInputs = with pkgs; [ + cmake + ninja + pkg-config + git # cmake FetchContent + ]; + + cmakeFlags = [ + #"-DFETCHCONTENT_SOURCE_DIR_TOXCORE=${pkgs.libtoxcore.src}" + "-DFETCHCONTENT_SOURCE_DIR_TOXCORE=${toxcore-src}" + ]; + + buildInputs = with pkgs; [ + #(libsodium.override { stdenv = pkgs.pkgsStatic.stdenv; }) + #pkgsStatic.libsodium + libsodium + ]; + + # TODO: replace with install command + installPhase = '' + mkdir -p $out/bin + mv bin/totato $out/bin + ''; + }; + + #apps.default = { + #type = "app"; + #program = "${self.packages.${system}.default}/bin/tomato"; + #}; + } + ); +} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e69de29..b6ffced 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.9 FATAL_ERROR) + +add_executable(totato + ./main.cpp +) + +target_compile_features(totato PUBLIC cxx_std_17) +target_link_libraries(totato PUBLIC + toxcore +) + diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..061ed7e --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,3 @@ +int main(void) { + return 0; +}