samples
samples copied to clipboard
Add Windows CMake instructions
Hi, I try to run the example as is and after running cmake command running the command make and getting error: make: *** No targets specified and no makefile found
By default, cmake
on Windows generates a VSCode solution file. You should be able to pass cmake the appropriate flags to generate an appropriate Makefile, but I'm not a CMake expert.
but it from your example: https://github.com/dart-lang/samples/tree/master/ffi
Readme: Building native libraries Each sample uses CMake to generate a Makefile. To build the native library for each sample:
cd hello_world/hello_library cmake . make The make command creates a libhello.dylib (macOS), libhello.dll (Windows) or libhello.so (Linux) library file.
@domesticmouse By passing <-G "Unix Makefiles"> flag with cmake command, we can generate appropriate makefiles for "make" command, but using it in this way, the path of generated dynamic library will be "..\hello_library\libhello.dll" instead of "..\hello_library\Debug\hello.dll" as expected by the code. So, either we can change path in code or use visual studio to build sln file. However, the documentation for windows must be update in either case.
Running make in windows is not so trivial as in Linux. Here are the steps:
- Run
cmake .
. This will create a visual studio project structure. - Double click on
hello_library.vcxproj
to open with visual studio (you should havevisual studio
installed, community version works just fine) - Default build option is
debug
, change it torelease
- Click
Build
or pressF7
You should find 4 files including hello.dll
in a newly created Release
folder.
Hello! I'm trying to do what the READ.ME explains but it is not working. Somebody can help-me? I just copy the project called "Hello World", my code is exactly the same.
Also this one @cbracken.