Skip to content

Turn some .i files into .swig #4711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Turn some .i files into .swig #4711

wants to merge 1 commit into from

Conversation

gchatelet
Copy link
Collaborator

@gchatelet gchatelet commented Jul 2, 2025

This helps with the import / export process.

@Mizux
Copy link
Collaborator

Mizux commented Jul 2, 2025

you are missing all CMakeLists.txt e.g. https://github.com/google/or-tools/blob/main/ortools/algorithms/csharp/CMakeLists.txt#L14-L16

@gchatelet gchatelet force-pushed the keep_swig_extension branch 2 times, most recently from 89fdf54 to f6d56e5 Compare July 2, 2025 14:17
@gchatelet gchatelet changed the title Use .swig extensions instead of .i. Turn some .swig files into .i Jul 2, 2025
@gchatelet gchatelet force-pushed the keep_swig_extension branch from f6d56e5 to 4a525f2 Compare July 2, 2025 14:27
This helps with the import / export process.
Note there are still `.i` used in the codebase, they will be cleaned up
later.
@gchatelet gchatelet force-pushed the keep_swig_extension branch from 4a525f2 to 5aec009 Compare July 2, 2025 14:31
@gchatelet gchatelet closed this Jul 2, 2025
@gchatelet gchatelet deleted the keep_swig_extension branch July 2, 2025 14:52
@Mizux
Copy link
Collaborator

Mizux commented Jul 2, 2025

For the record:

SWIG documentation

SWIG interface file which is usually denoted with a special .i or .swg suffix

ref: https://www.swig.org/Doc4.3/SWIG.html#SWIG_nn3

CMake

builtin UseSWIG.cmake
by default use on .i but you can also use set(SWIG_SOURCE_FILE_EXTENSIONS ".i" ".swig") to override it

cf: https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/UseSWIG.cmake?ref_type=heads#L341-L347

Vim

Vim IDE support .swig and .swg and .i (with conflicts ?) as SWIG file type

[0]─[/usr/share/vim/vim91]
[v]─mizux@host %grepc -inH -A 2 "swig" filetype.vim
filetype.vim:2004:" Progress or assembly or Swig
filetype.vim-2005-au BufNewFile,BufRead *.i            call dist#ft#FTi()
filetype.vim-2006-
--
filetype.vim:2537:" Swig
filetype.vim:2538:au BufNewFile,BufRead .swg,.swig setf swig
filetype.vim-2539-

GitHub

rely on linguist to detect file type using:

We use Linguist to perform language detection and to select third-party grammars for syntax highlighting.

ref: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks#syntax-highlighting

SWIG:
  type: programming
  extensions:
  - ".i"
  tm_scope: source.c++
  ace_mode: c_cpp
  codemirror_mode: clike
  codemirror_mime_type: text/x-c++src
  language_id: 1066250075

ref: https://github.com/github-linguist/linguist/blob/ddd7a2b4a7f6c8b34345a12a3b87703cbaaebf16/lib/linguist/languages.yml#L6813-L6821

@Mizux Mizux changed the title Turn some .swig files into .i Turn some .i files into .swig Jul 2, 2025
@gchatelet
Copy link
Collaborator Author

New attempt here #4712

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants