Browse Source

Started integrating CLI tool

Adam Kelly 5 years ago
parent
commit
f911714472
4 changed files with 21 additions and 5 deletions
  1. 7 5
      CMakeLists.txt
  2. 2 0
      extras/CMakeLists.txt
  3. 7 0
      extras/simulator_cli.cpp
  4. 5 0
      tangle/CMakeLists.txt

+ 7 - 5
CMakeLists.txt

@@ -1,9 +1,11 @@
 cmake_minimum_required(VERSION 3.9)
-
 project(tangle)
 
-find_package(PythonExtensions REQUIRED)
+# Source for the command line tool
+set(CLI_MAIN "${PROJECT_SOURCE_DIR}/extras/simulator_cli.cpp")
 
-add_library(_tangle MODULE tangle/_tangle.cxx)
-python_extension_module(_tangle)
-install(TARGETS _tangle LIBRARY DESTINATION tangle)
+if(SKBUILD) # Using Python
+    add_subdirectory(tangle)
+else() # Using Command Line Tool
+    add_subdirectory(extras)
+endif()

+ 2 - 0
extras/CMakeLists.txt

@@ -0,0 +1,2 @@
+add_executable(simulator ${CLI_MAIN})
+set_target_properties(simulator PROPERTIES LINKER_LANGUAGE CXX CXX_STANDARD 14)

+ 7 - 0
extras/simulator_cli.cpp

@@ -0,0 +1,7 @@
+#include <iostream>
+
+int main(int argc, char const *argv[])
+{
+    std::cout << "Hello from the Simulator" << std::endl;
+    return 0;
+}

+ 5 - 0
tangle/CMakeLists.txt

@@ -0,0 +1,5 @@
+find_package(PythonExtensions REQUIRED)
+
+add_library(_tangle MODULE tangle/_tangle.cxx)
+python_extension_module(_tangle)
+install(TARGETS _tangle LIBRARY DESTINATION tangle)