Re: CMake and D

2022-08-07 Thread rempas via Digitalmars-d-learn
On Saturday, 6 August 2022 at 18:22:45 UTC, Jan Allersma wrote: I figured out a strategy to solve te problem: 1) Create a C++ function which will be called in D. 2) Build a static C++ library with CMake and add dependencies (In my case: SDL libraries) 3) Create a new project (`dub init`). 4)

Re: CMake and D

2022-08-06 Thread Jan Allersma via Digitalmars-d-learn
On Saturday, 6 August 2022 at 13:52:28 UTC, Jan Allersma wrote: I forgot that I have to add some DUB dependencies. So I have to use `dub` instead of `dmd`. My strategy is to 1) Create a D function which will be called in C++. 2) Build a static library containing the D function (using `dub buil

Re: CMake and D

2022-08-06 Thread Jan Allersma via Digitalmars-d-learn
I forgot that I have to add some DUB dependencies. So I have to use `dub` instead of `dmd`. My strategy is to 1) Create a D function which will be called in C++. 2) Build a static library containing the D function (using `dub build`). 3) Build an executable file with CMake. However, I get an

Re: CMake and D

2022-08-06 Thread Jan Allersma via Digitalmars-d-learn
On Thursday, 4 August 2022 at 20:59:50 UTC, Johan wrote: On Thursday, 4 August 2022 at 20:29:30 UTC, Jan Allersma wrote: So something goes wrong with linking, but I dont know what. Execute `dmd -v` on some test program. It will output the linker line at the end of the output, the line starti

Re: CMake and D

2022-08-04 Thread pascal111 via Digitalmars-d-learn
On Thursday, 4 August 2022 at 20:59:50 UTC, Johan wrote: On Thursday, 4 August 2022 at 20:29:30 UTC, Jan Allersma wrote: So something goes wrong with linking, but I dont know what. Execute `dmd -v` on some test program. It will output the linker line at the end of the output, the line starti

Re: CMake and D

2022-08-04 Thread Johan via Digitalmars-d-learn
On Thursday, 4 August 2022 at 20:29:30 UTC, Jan Allersma wrote: So something goes wrong with linking, but I dont know what. Execute `dmd -v` on some test program. It will output the linker line at the end of the output, the line starting with `cc yourcode.o -o yourcode ...`. On that linker l

CMake and D

2022-08-04 Thread Jan Allersma via Digitalmars-d-learn
Hello, I am trying to compile an application with both C++ and D source code. First I have `main.d`: ``` extern (C++) void init(); extern (C++) void draw(int row, int column, int x, int y); extern (C++) void render(); void main() { init(); draw(3, 3, 0, 0); draw(3, 3, 2, 2);