Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 40 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DINKCPP_PY=ON
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DINKCPP_PY=OFF

# Build using CMake and OS toolkit
- name: Build
Expand Down Expand Up @@ -125,17 +125,6 @@ jobs:
name: ${{ matrix.artifact }}-unreal
path: build/comp_unreal/

# - name: Install PythonLib
# working-directory: ${{github.workspace}}/build
# shell: bash
# run: cmake --install . --config $BUILD_TYPE --prefix comp_py --component py

# - name: Upload Binary Artifact
# uses: actions/upload-artifact@v3
# with:
# name: ${{ matrix.artifact }}-py
# path: build/comp_py/

# Make sure Inkproof has everything it needs to run our executable
- name: Setup Ink Proof
if: ${{ matrix.proof }}
Expand Down Expand Up @@ -181,6 +170,39 @@ jobs:
name: ${{ matrix.artifact }}-www
path: proofing/ink-proof/out

build-doc:
name: Build Doxygen documentation
needs: [compilation, build-python]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set upt Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install Doxygen
run: sudo apt-get install doxygen graphviz -y
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.21.x'
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DINKCPP_PY=ON
- name: Build
working-directory: ${{github.workspace}}/build
shell: bash
run: cmake --build . --target doc
- name: Upload
uses: actions/upload-artifact@v3
with:
name: doxygen
path: Documentation/

build-python:
name: Build Python package
Expand Down Expand Up @@ -293,12 +315,17 @@ jobs:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# Download Ink Proof page for Linux
- uses: actions/download-artifact@v2
with:
name: linux-www
path: www/proof

- uses: actions/download-artifact@v2
with:
name: doxygen
path: www

# Deploy to Github Pages
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ inkcpp_cl/*.ink

# Doxygen
Documentation/*
!Documentation/cmake_example/
!Documentation/cmake_example.zip

# Output
Build/*
Expand Down
20 changes: 19 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,25 @@ include(CPack)
find_package(Doxygen)
if (DOXYGEN_FOUND)
set(DOXYGEN_PROJECT_NAME ${PROJECT_NAME})
doxygen_add_docs(doc ${PROJECT_SOURCE_DIR} COMMENT "Generate docs")
doxygen_add_docs(doc WORKING_DIR ${PROJECT_SOURCE_DIR} CONFIG_FILE "${PROJECT_SOURCE_DIR}/Doxyfile" COMMENT "Generate docs")
set(PY_HTML "${PROJECT_SOURCE_DIR}/Documentation/inkcpp_py.html")
if (INKCPP_PY)
find_package(
Python3
REQUIRED
COMPONENTS Interpreter
)
add_custom_target(inkcpp_py_doc
python -m pydoc -w inkcpp_py
COMMAND mv "./inkcpp_py.html" ${PY_HTML}
DEPENDS inkcpp_py
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/inkcpp_py"
COMMENT "Generates simple python documentation")
add_dependencies(doc inkcpp_py_doc)
else()
message(WARNING "The python target is disabled, therfore no python documentation will be build. Set INKCPP_PY to change this")
file(WRITE ${PY_HTML} "<html><head></head><body><h2>Python Documenattion was not build!</h2></body></html>")
endif(INKCPP_PY)
else(DOXYGEN_FOUND)
message("Doxygen needed to generate documntation!")
endif(DOXYGEN_FOUND)
Binary file added Documentation/cmake_example.zip
Binary file not shown.
8 changes: 8 additions & 0 deletions Documentation/cmake_example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.16)
project(main)

find_package(inkcpp CONFIG REQUIRED)

add_executable(main main.cpp)
set_property(TARGET main PROPERTY CXX_STANDARD 17)
target_link_libraries(main inkcpp inkcpp_compiler)
40 changes: 40 additions & 0 deletions Documentation/cmake_example/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include <ink/system.h>
#include <ink/choice.h>
#include <ink/runner.h>
#include <ink/story.h>
#include <ink/compiler.h>

#include <iostream>

using namespace ink::runtime;

int MyInkFunction(int a, int b) { return a + b; }

int main()
{
ink::compiler::run("test.ink.json", "test.bin");
// Load ink binary story, generated from the inkCPP compiler
story* myInk = story::from_file("test.bin");

// Create a new thread
runner thread = myInk->new_runner();

// Register external functions (glue automatically generated via templates)
thread->bind("my_ink_function", &MyInkFunction);

// Write to cout
while (thread->can_continue())
std::cout << thread->getline();

// Iterate choices
int id = 0;
for (const choice& c : *thread) {
std::cout << (id++) << ". " << c.text() << std::endl;
}
std::cin >> id;
thread->choose(id);

// Write to cout
while (thread->can_continue())
std::cout << thread->getline();
}
8 changes: 8 additions & 0 deletions Documentation/cmake_example/test.ink
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
EXTERNAL my_ink_function(a,b)

Hello world!
* Hello back!
Nice to hear from you!
* Bye
BTW 3 + 5 = {my_ink_function(3,5)}
-> END
Loading