Re: cmake-d and gdc/gdmd compiler

2017-04-14 Thread timvol via Digitalmars-d-learn

On Tuesday, 4 April 2017 at 19:59:19 UTC, Dragos Carp wrote:

On Tuesday, 4 April 2017 at 18:42:45 UTC, timvol wrote:

Hi guys,

I'm trying to cross-compile a project using CMake and gdc (or 
better: the gdmd port). My CMakeLists-file is the following:




For cross-compiling, CMake uses a so called "toolchain" file 
[1] where you define the system paths similar to the target 
system.


I confess that never cross-compiled any code with cmake-d, but 
in principle it should work.


Dragos

[1] 
https://cmake.org/cmake/help/v3.7/manual/cmake-toolchains.7.html#cross-compiling-for-linux


I tried using a toolchain file but unfortunately, I'm still 
getting the same error. Using the dmd compiler works fine but not 
the GDC compiler for cross compiling :(.

Any other idea(s) what can cause the error?


Re: cmake-d and gdc/gdmd compiler

2017-04-05 Thread timvol via Digitalmars-d-learn

On Tuesday, 4 April 2017 at 19:59:19 UTC, Dragos Carp wrote:

On Tuesday, 4 April 2017 at 18:42:45 UTC, timvol wrote:

Hi guys,

I'm trying to cross-compile a project using CMake and gdc (or 
better: the gdmd port). My CMakeLists-file is the following:




For cross-compiling, CMake uses a so called "toolchain" file 
[1] where you define the system paths similar to the target 
system.


I confess that never cross-compiled any code with cmake-d, but 
in principle it should work.


Dragos

[1] 
https://cmake.org/cmake/help/v3.7/manual/cmake-toolchains.7.html#cross-compiling-for-linux


Alright. Thank you Dragos. I thought it's possible without using 
a toolchain file but I'll give it a try :)


Re: cmake-d and gdc/gdmd compiler

2017-04-04 Thread Dragos Carp via Digitalmars-d-learn

On Tuesday, 4 April 2017 at 18:42:45 UTC, timvol wrote:

Hi guys,

I'm trying to cross-compile a project using CMake and gdc (or 
better: the gdmd port). My CMakeLists-file is the following:




For cross-compiling, CMake uses a so called "toolchain" file [1] 
where you define the system paths similar to the target system.


I confess that never cross-compiled any code with cmake-d, but in 
principle it should work.


Dragos

[1] 
https://cmake.org/cmake/help/v3.7/manual/cmake-toolchains.7.html#cross-compiling-for-linux


cmake-d and gdc/gdmd compiler

2017-04-04 Thread timvol via Digitalmars-d-learn

Hi guys,

I'm trying to cross-compile a project using CMake and gdc (or 
better: the gdmd port). My CMakeLists-file is the following:


cmake_minimum_required(VERSION 2.8.1)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} 
"${CMAKE_SOURCE_DIR}/cmake-d")

SET(CMAKE_SYSTEM_NAME Linux)

project(myapp D)
set(CMAKE_D_FLAGS "${CMAKE_D_FLAGS} ${GLOBAL_DMD_DEFS}")

set(SOURCES
main.d
generic.d
)

include_directories(.)

add_executable(myapp ${SOURCES})

I'm working on Windows and I want compile the project for the 
target linux system. So, I downloaded the gdc (x86_64-linux-gnu), 
extracted it and set the PATH variable. Unfortunately, when I 
configure my project using CMake, I'm getting the following 
message:


CMake Error at 
C:/Users/User/Desktop/Project/cmake-d/CMakeDetermineDCompiler.cmake:32 (MESSAGE):

  Could not find compiler set in environment variable C:

  CMAKE_D_COMPILER-NOTFOUND.
Call Stack (most recent call first):
  CMakeLists.txt:6 (project)


CMake Error: CMAKE_D_COMPILER not set, after EnableLanguage

I think CMake cannot find the compiler because the executables of 
gdc are named like "x86_64-unknown-linux-gnu-gdc". So, I've added 
the following to my CMakeLists-file:


set(CMAKE_D_COMPILER x86_64-unknown-linux-gnu-gdmd)

But this also fails with the following error:

The D compiler identification is GNU
Check for working D compiler: 
C:/Users/User/Compiler/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-gdmd.exe
Check for working D compiler: 
C:/Users/User/Compiler/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-gdmd.exe -- broken

To force a specific D compiler set the DC environment variable
ie - export DC="/usr/bin/dmd"
CMake Error at 
C:/Users/User/Desktop/cmake-d/CMakeTestDCompiler.cmake:45 
(message):

  The D compiler
  
"C:/Users/User/Compiler/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-gdmd.exe"

  is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: 
C:/Users/User/Desktop/Project.linux/CMakeFiles/CMakeTmp




  Run Build Command:"C:/Users/User/Compiler/ninja.exe"
  "cmTC_365e1"

  [1/2] Building D object CMakeFiles\cmTC_365e1.dir\testDCompiler


  FAILED: CMakeFiles/cmTC_365e1.dir/testDCompiler



  
C:\Users\User\Entwicklung\Compiler\x86_64-unknown-linux-gnu\bin\x86_64-unknown-linux-gnu-gdmd.exe

  CMakeFiles\cmTC_365e1.dir\testDCompiler -c
  
C:\Users\User\Desktop\Project.linux\CMakeFiles\3.7.2\CMakeTmp\testDCompiler.d




  x86_64-unknown-linux-gnu-gdc.exe: error:
  CMakeFiles\cmTC_365e1.dir\testDCompiler.d: No such file or 
directory





  x86_64-unknown-linux-gnu-gdc.exe: fatal error: no input files




  compilation terminated.




  Compile of ["CMakeFiles\\cmTC_365e1.dir\\testDCompiler.d"] 
failed




  ninja: build stopped: subcommand failed.






  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:7 (project)


Configuring incomplete, errors occurred!
See also 
"C:/Users/User/Desktop/Project.linux/CMakeFiles/CMakeOutput.log".


Does anyone know what can cause the problem here? I've also set 
the DC environment variable but I'm still getting the errors :(