I would like to try to build Kotlin/Native project with dependencies on some library.
As documentation explains, I need to create def file (which I was already created) and run cinterop tool.
However, I wasn't able to find this tool on my Mac and curious how this could be installed.
Can you please give me some advice?
I strongly advise you to use Gradle + Kotlin MPP plugin. Not only it will provide cinterop support, but it will ease further development, testing, and multiplatform support. It works on any OS, of course.
If you need an example, here is the official one for the cURL library: https://github.com/JetBrains/kotlin-native/blob/master/samples/libcurl/build.gradle.kts. Note the cinterops block under compilations["main"].
The nice thing about Kotlin MPP plugin is that it actually allows you to play with the Kotlin/Native tools directly. It will download the tools specifically for your platform automatically on the first run and place them in ~/.konan directory. So if you really want to use cinterop tool from CLI you'll be able to find it there: ~/.konan/kotlin-native-macos-1.3.61/bin/cinterop. klib and kotlinc are there as well.
Related
I'm getting started with Kotlin, and on the downloads page I see two different possibilities that look relevant for me:
kotlin-compiler
kotlin-native-windows
What's the difference? In what case would I need one or the other?
Most probably you won't use CLI to compile, build and run Kotlin projects a lot. Well, maybe you'll need a standalone compiler a few times compiling "Hello world" when starting with this language. BTW, you can use https://try.kotlinlang.org to compile simple programs and play with the language without local installations.
But as you proceed, it won't be enough. Most Kotlin projects today use either Gradle or Maven. Gradle scripts could be written in Kotlin themselves. I recommend you taking this extra step and use build tools instead of standalone compiler, as it will simplify a lot if things in future. IntelliJ IDEA, the most popular IDE for Kotlin made by JetBrains, the company behind Kotlin, allows you to create Gralde-based Kotlin projects in a few clicks.
Kotlin is a multi-platform language. It can be compiled to produce binaries compatible either with:
Java
JavaScript
A native platform (Windows, Linux, iOS, etc.)
Which compiler you should choose depends on your needs. If you don't need to make your code operate with a C library or a specific OS tool, I'd recommend the kotlin-compiler, so you'll get an app executable through Java, which (at least for now) produce more optimized programs, and also easily portable (install a jre on target computer and you're ready to execute your Kotlin program). Plus, you'll be able to use any Java lib you need in your kotlin program.
Note : Official documentation contains guides to get started:
Command line compiler for JVM
Command line compiler for native executables
i understand that i can use Kotlin Plugin comes with IntelliJ but i can also install Kotlin standalone compiler. Is there any pros/cons using standalone vs IntelliJ own integrated?
I'd say that:
Any real Kotlin project (including projects in IntelliJ) should use a build system such as Gradle or Maven.
Enabling Kotlin support in a Gradle/Maven project will automatically download the correct compiler (and switch it when you update the Kotlin version in the config file) and not care about whether you have a stand-alone version installed.
Any other Kotlin tool will likely be integrated with them as well.
So the standalone compiler is pretty much only useful when you want to try something quickly outside any project, but then https://play.kotlinlang.org/ or https://try.kotlinlang.org/ can work as well; and again let you switch between Kotlin versions simpler than a manually installed compiler.
Running Kotlin scripts may be the only case where I would use the stand-alone compiler.
Not much, but having own install have few advantages, but probably not needed by most people on their machines:
You don't need intellij, so you can use that compiler in other IDE or just for other applications
You can use different version of compiler than the one from plugin.
But in most cases integrated one is all you need.
I'm trying to use SocketRocket Objective-C library on my Kotlin MPP project and I need to import it using cinterop, but I can't seem to find it.
There is Kotlin Multiplatform Gradle plugin. The plugin delivers the cinterop tool for you. You may find more documentation here:
https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#cinterop-support
You may also follow one of (to be updated) tutorials for Kotlin/Native with the explanation on how to find the conterop tool
https://kotlinlang.org/docs/tutorials/native/interop-with-c.html
I want to write a custom IDE on top of IntelliJ Platform. Android Studio is an example. It was built based on IntelliJ Platform and was designed to support Android application development.
There are lots of git GUI out there. However, in Linux, I don't satisfy with any. That is my motivation to write a git IDE for Linux. IntelliJ IDEA already have a very good Git plugin. Using IntelliJ IDEA is a solution. But it is too heavy for opening entire project with different functionalities (Run, Debug, Refactor...) for just Git operations. Therefore, I want to make that plugin a complete IDE for only Git operation.
On IntelliJ Platform forum page, there are tutorials to write plugins. However, it doesn't have the guide for writing a complete IDE.
Are there any tutorials to help me get started?
IntelliJ platform is probably not the best choice for writing a general purpose RCP applications.
https://intellij-support.jetbrains.com/hc/en-us/community/posts/207769065-Developing-a-desktop-Business-Application-using-the-JetBrains-Platform
Git plugin has 65k lines of code, you are talking about gutting ~13M lines IDE (respectively 3M lines of pure Java source code).
i go to eclipse download website
i find Eclipse CDT - a version of eclipse that is standalone
in my standard Eclipse SDK(not cdt)
i can do this:
Help->install new software-> then i get a window popup and ask me to give the url
it looks like this:
so then you can install it
this is a separate standalone Eclipse CDT :
this is a standalone Eclipse SDK:
my question is:
1.what is the difference between separate Eclipse CDT and installing CDT plugin onto Eclipse SDK OR are they same thing?
2. what is better? is it better to use a separate Eclipse CDT or just install a plugin inside my Eclipse SDK?
thanks in advance!
Short answer: there is no important difference[1] between the two.
Longer answer: The Eclipse IDE is nothing more than a bunch of plugins that work together to create the functionality for code editing (and other things).
When you go to http://eclipse.org/downloads, you'll see a bunch of different packages. Each package provides a certain set of features, but this is no more than a convenience so that you don't have to install the vanilla SDK and then install the stuff that you really need on top of that. The php dev will not need the C++ compiler and vice-versa. But, you can install it if you want. At it's core, the same small set of plugins are re-used between all distributions.
You can compare the different distributions here: http://www.eclipse.org/downloads/compare.php
[1]: Actually, the difference is that the SDK includes source code for all features as well as the Java compiler and plugin development tools. The C++ tools do not include these.