Last active
October 24, 2019 17:15
-
-
Save madebr/339d016f8ae44be891bdd32b5ab3073a to your computer and use it in GitHub Desktop.
SWIG issue 1001
This file contains hidden or 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
cmake_minimum_required(VERSION 3.14) | |
project(swig_test C) | |
include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") | |
conan_basic_setup() | |
find_package(PythonInterp REQUIRED) | |
find_package(PythonLibs REQUIRED) | |
find_package(SWIG REQUIRED) | |
include_directories(${PYTHON_INCLUDE_DIR}) | |
link_libraries(${PYTHON_LIBRARIES}) | |
cmake_policy(SET CMP0078 NEW) | |
cmake_policy(SET CMP0086 NEW) | |
include(UseSWIG) | |
swig_add_library(mymod TYPE MODULE LANGUAGE python SOURCES example.i example.c) | |
option(WITH_CSHARP "Add C#") | |
if(WITH_CSHARP) | |
enable_language(CSharp) | |
add_executable(main main.cs) | |
endif() |
This file contains hidden or 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
from conans import ConanFile, CMake | |
class Build(ConanFile): | |
requires = ('swig_installer/4.0.1@madebr/testing',) | |
settings = 'os', 'arch', 'build_type', 'compiler', | |
generators = 'virtualenv', 'cmake', | |
def build(self): | |
print('settings.arch', str(self.settings.arch)) | |
cmake = CMake(self) | |
cmake.configure() | |
cmake.build() |
This file contains hidden or 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
/* File : example.c */ | |
double My_variable = 3.0; | |
/* Compute factorial of n */ | |
int fact(int n) { | |
if (n <= 1) return 1; | |
else return n*fact(n-1); | |
} | |
/* Compute n mod m */ | |
int my_mod(int n, int m) { | |
return(n % m); | |
} |
This file contains hidden or 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
/* File : example.i */ | |
%module example | |
%{ | |
/* Put headers and other declarations here */ | |
extern double My_variable; | |
extern int fact(int); | |
extern int my_mod(int n, int m); | |
%} | |
extern double My_variable; | |
extern int fact(int); | |
extern int my_mod(int n, int m); |
This file contains hidden or 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
using System; | |
namespace ConsoleApp1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("Hello, world!"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment