make a simple c++ project

This commit is contained in:
Johannes Jöns 2024-07-05 12:33:15 +02:00
parent 2757bd090c
commit 2d15d63dcb
8 changed files with 80 additions and 30 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@
# Added by cargo
/target
/result

27
flake.lock Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1720031269,
"narHash": "sha256-rwz8NJZV+387rnWpTYcXaRNvzUSnnF9aHONoJIYmiUQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "9f4128e00b0ae8ec65918efeba59db998750ead6",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

14
flake.nix Normal file
View file

@ -0,0 +1,14 @@
{
description = "License Managment tool";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = inputs@{ self, nixpkgs, ... }: {
packages = nixpkgs.lib.attrsets.genAttrs nixpkgs.lib.systems.flakeExposed (system: import ./nix {
inherit system inputs;
pkgs = nixpkgs.legacyPackages.${system};
});
};
}

View file

@ -1,35 +1,7 @@
project(
'lf2',
'c',
'cpp',
meson_version: '>=0.58.0',
default_options: [
'cpp_std=c++20',
'warning_level=2',
],
'cpp'
)
cppc = meson.get_compiler('cpp')
subdir('native')
prefix = get_option('prefix')
data_dir = get_option('datadir')
lib_dir = get_option('libdir')
add_project_arguments(cppc.get_supported_arguments([
'-Wno-unused-parameter',
'-Wno-missing-field-initializers',
'-Wno-c99-designator',
'-Wno-invalid-offsetof',
'-Wno-unused-const-variable',
'-Wno-volatile', # glm warning
'-Wno-deprecated-volatile',
]), language: 'cpp')
add_project_arguments(cppc.get_supported_arguments([
'-ffast-math',
]), language: 'cpp')
sqlite3_dep = dependency('sqlite3')
vulkan_dep = dependency('vulkan')
subdir('src')

6
native/main.cpp Normal file
View file

@ -0,0 +1,6 @@
#include <iostream>
int main() {
std::cout << "Hello World!";
return 0;
}

5
native/meson.build Normal file
View file

@ -0,0 +1,5 @@
executable(
'license-tool',
'main.cpp',
install: true,
)

5
nix/default.nix Normal file
View file

@ -0,0 +1,5 @@
{ system, pkgs, inputs }:
{
native = pkgs.callPackage ./native.nix {};
}

20
nix/native.nix Normal file
View file

@ -0,0 +1,20 @@
{
lib,
stdenv,
meson,
ninja,
}:
stdenv.mkDerivation {
pname = "native";
version = "0.1";
src = ../.;
nativeBuildInputs = [ meson ninja ];
meta = {
maintainers = with lib.maintainers; [ jopejoe1 ];
platforms = lib.platforms.all;
};
}