Skip to content

Commit

Permalink
Add prototype using C++
Browse files Browse the repository at this point in the history
Issue: #570

Signed-off-by: Nicolas Bock <nicolasbock@gmail.com>
  • Loading branch information
nicolasbock committed Jan 25, 2022
1 parent 41a394b commit ab01dfb
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cpp_prototype/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.10)

message(STATUS "CMake version ${CMAKE_VERSION}")

set(LANGUAGES C CXX)
set(BML_BUILD_FORTRAN_INTERFACE TRUE CACHE BOOL
"Build the Fortran API (requires a Fortran compiler)")
if(BML_BUILD_FORTRAN_INTERFACE)
list(APPEND LANGUAGES Fortran)
endif()

set(BML_BUILD_PYTHON_INTERFACE TRUE CACHE BOOL
"Build the Python API (requires Python dev package)")

project(bml ${LANGUAGES}) # don't move this line as it changes PROJECT_SOURCE_DIR

add_subdirectory(src)
add_subdirectory(tests)
2 changes: 2 additions & 0 deletions cpp_prototype/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
add_library(bml
bml_allocate.cc)
4 changes: 4 additions & 0 deletions cpp_prototype/src/bml.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef __BML_H
#define __BML_H

#endif
8 changes: 8 additions & 0 deletions cpp_prototype/src/bml_allocate.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "bml_types.h"

#include <stdlib.h>

void * bml_allocate(int rows)
{
return malloc(10);
}
6 changes: 6 additions & 0 deletions cpp_prototype/src/bml_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef __BML_TYPES_H
#define __BML_TYPES_H

typedef void * BML_MATRIX_DENSE_T;

#endif
3 changes: 3 additions & 0 deletions cpp_prototype/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include_directories(${CMAKE_SOURCE_DIR}/src)
add_executable(bml-test
bml-test.cc)
7 changes: 7 additions & 0 deletions cpp_prototype/tests/bml-test.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <bml.h>
#include <stdlib.h>
#include <stdio.h>

int main() {
printf("starting tests\n");
}

0 comments on commit ab01dfb

Please # to comment.