-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
cmake_minimum_required(VERSION 3.12) | ||
project(hakoniwa_multi_language_project) | ||
|
||
find_package(SWIG REQUIRED) | ||
include(${SWIG_USE_FILE}) | ||
set(CMAKE_SWIG_FLAGS "") | ||
|
||
# ヘッダーファイルのインクルードパスを設定 | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../src/include) | ||
# SWIGインターフェースファイルの相対パスを設定 | ||
set(SWIG_INTERFACE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/hako_asset.i) | ||
set_source_files_properties(${SWIG_INTERFACE_FILE} PROPERTIES CPLUSPLUS ON) | ||
# ライブラリのフルパスを検索 | ||
find_library(ASSETS_LIBRARY | ||
NAMES assets | ||
PATHS /usr/local/lib/hakoniwa | ||
) | ||
|
||
add_subdirectory(python) | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
%module hako_asset | ||
|
||
%{ | ||
#include "hako_asset.h" | ||
%} | ||
|
||
%include "hako_primitive_types.h" | ||
|
||
|
||
%typemap(in) hako_asset_callbacks_t *callbacks (void *ptr) { | ||
$1 = (hako_asset_callbacks_t *)malloc(sizeof(hako_asset_callbacks_t)); | ||
if (!$1) { | ||
PyErr_NoMemory(); | ||
return NULL; | ||
} | ||
$1->on_initialize = NULL; | ||
$1->on_simulation_step = NULL; | ||
$1->on_manual_timing_control = NULL; | ||
$1->on_reset = NULL; | ||
ptr = $1; | ||
} | ||
|
||
%typemap(freearg) hako_asset_callbacks_t *callbacks { | ||
free($1); | ||
} | ||
%include "hako_asset.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.12) | ||
project(hakoniwa_python_swig_project) | ||
|
||
find_package(PythonLibs REQUIRED) | ||
include_directories(${PYTHON_INCLUDE_PATH}) | ||
|
||
swig_add_library(hako_asset_py LANGUAGE python SOURCES ${SWIG_INTERFACE_FILE}) | ||
swig_link_libraries(hako_asset_py ${PYTHON_LIBRARIES} ${ASSETS_LIBRARY}) |