Giter Site home page Giter Site logo

cmake-d's People

Contributors

baruch avatar blackedder avatar boris-barboris avatar carun avatar dcarp avatar jkm avatar obko avatar steveking-gh avatar yoplitein avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cmake-d's Issues

Build error: Key not found: downloadUrl

CMakeLists.txt

# A more complex library test.
file(GLOB SRC_LIST "*.d")

include(UseDub)

DubProject_Add(vibe-d ~0.9.2)

add_executable(app_10 ${SRC_LIST})
add_test(app_10 app_10)

main.d

module main;

import vibe.core.core;
import vibe.http.fileserver;
import vibe.http.server;

void main()
{
    listenHTTP(new HTTPServerSettings(":9090"), serveStaticFiles("./"));
    runApplication();
}
2020-09-24 11:17:46 ~/code/d/tests-cmake-d/b
$ cmake -DCMAKE_MODULE_PATH:PATH=$SETUP/cmake-d/cmake-d ..
-- The C compiler identification is GNU 9.3.0
-- The D compiler identification is DigitalMars
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working D compiler: /usr/bin/dmd
-- Check for working D compiler: /usr/bin/dmd -- works
-- Detecting D compiler ABI info
-- Detecting D compiler ABI info - done
std.json.JSONException@std/json.d(627): Key not found: downloadUrl
----------------
??:? pure @safe void std.exception.bailOut!(std.json.JSONException).bailOut(immutable(char)[], ulong, scope const(char)[]) [0x5626c25b248f]
??:? pure @safe inout(std.json.JSONValue)* std.exception.enforce!(std.json.JSONException).enforce!(inout(std.json.JSONValue)*).enforce(inout(std.json.JSONValue)*, lazy const(char)[], immutable(char)[], ulong) [0x5626c25b2505]
??:? inout pure ref @safe inout(std.json.JSONValue) std.json.JSONValue.opIndex(immutable(char)[]) [0x5626c2582f09]
??:? _Dmain [0x5626c250a307]
CMake Error at /opt/dev-setup/cmake-d/cmake-d/UseDub.cmake:70 (include):
  include could not find load file:

    /home/arun/code/d/tests-cmake-d/b/UseDub/vibe-d.cmake
Call Stack (most recent call first):
  app_10/CMakeLists.txt:6 (DubProject_Add)


-- Configuring incomplete, errors occurred!
See also "/home/arun/code/d/tests-cmake-d/b/CMakeFiles/CMakeOutput.log".
2020-09-24 11:18:13 ~/code/d/tests-cmake-d/b
$

Working with Git repository

What is the idiomatic way of working with the Git repository rather than downloading a pre-built archive?

LDC doesn't know about -inline in release build

When trying to use set(CMAKE_BUILD_TYPE Release) together with ldc2 (linux), I got a message, that ldc doesn't know -inline.

LDC - the LLVM D compiler (1.1.0):
based on DMD v2.071.2 and LLVM 3.8.1
built with LDC - the LLVM D compiler (1.0.0)

DMD: enable MinSizeRel with -L-s

Since CMake works by forcing a two-step process for compilation and linking, at the moment DMD seems to include debug info into every file and thus bloat the resulting binaries by quite a bit. This problem can be circumvented by stripping debug info altogether.

At the moment there's a line in Linux-dmd.cmake that deals with CMAKE_D_FLAGS_MINSIZEREL_INIT, but it sets it to -Os (which doesn't actually exist) and is commented out. Instead, this works (thanks to ld):

SET (CMAKE_D_FLAGS_MINSIZEREL_INIT "-O -L-s ${DDOC_FLAGS}")

For my test case, a default build gives a binary size of 1515480 B, a release build is 1498992 B and a MinSizeRel build is 1023736 B, so that's a hefty reduction in file size.

Make use of dub describe

Using dub describe would allow parsing of dub.sdl file easily without adding a parser, and ease the dependency parsing.

ldc not auto detected

I happened to install only ldc2 on my machine and cmake wouldn't auto detect it. I changed the auto-detect logic to search for it as well and it just works. Is there a reason why ldc2 wasn't added to the auto-detect?

Error on OSX

On OSx 10.11.1 with CMake 3.3.2. Last time I checked there is the same error when this is run on a Windows machine.

DMD64 D Compiler v2.068
and
LDC - the LLVM D compiler (0.15.2): based on DMD v2.066.1 and LLVM 3.6.2

When running ccmake -DCMAKE_MODULE_PATH:PATH=../cmake-d ./build . in the tests directory, I get the following error:

CMake Error: Could not find cmake module file: CMakeDInformation.cmake

 CMake Error: Internal CMake error, TryCompile configure of cmake failed

 CMake Error at /Users/zelimdamian/Downloads/cmake-d-master
 2/cmake-d/CMakeTestDCompiler.cmake:45 (message):
   The D compiler "/usr/local/bin/dmd" is not able to compile a simple test
   program.

   It fails with the following output:



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

Unable to cross-compile: No such file or directory

Hi,
when I try to use the GDC for ARM compiler I'm getting the following error:

`CMake Error at C:/arm/cmake-d/cmake-d/CMakeTestDCompiler.cmake:45 (message):
The D compiler
"C:/compiler/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-gdmd.exe"
is not able to compile a simple test program.

It fails with the following output:

Change Dir: C:/arm.build/CMakeFiles/CMakeTmp

Run Build Command:"C:/Compiler/ninja.exe"
"cmTC_59a64"

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

FAILED: CMakeFiles/cmTC_59a64.dir/testDCompiler

C:\Compiler\arm-unknown-linux-gnueabihf\bin\arm-unknown-linux-gnueabihf-gdmd.exe
CMakeFiles\cmTC_59a64.dir\testDCompiler -c
C:\arm.build\CMakeFiles\3.7.2\CMakeTmp\testDCompiler.d

arm-unknown-linux-gnueabihf-gdc.exe: error:
CMakeFiles\cmTC_59a64.dir\testDCompiler.d: No such file or directory

arm-unknown-linux-gnueabihf-gdc.exe: fatal error: no input files

compilation terminated.

Compile of ["CMakeFiles\cmTC_59a64.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)`

My CMakeLists.txt file is very simple:

`cmake_minimum_required(VERSION 2.8.1)

set(CMAKE_D_COMPILER arm-unknown-linux-gnueabihf-gdmd)

project(arm D)

set(CMAKE_D_FLAGS "${CMAKE_D_FLAGS} ${GLOBAL_DMD_DEFS}")

set(SOURCES
main.d
)

add_executable(arm ${SOURCES})`

Am I doing something wrong or is it impossible to do the cross compilation like this?

I already asked in the D forum (http://forum.dlang.org/thread/[email protected]) without success. After investing some days to figure out what's going wrong here, I finally decided to ask here if it's a bug somewhere in the CMake port or CMake itself. I'm using CMake 3.7.2.

CMakeTestDCompiler failure on OS X

OS X 10.13.1
cmake 3.10.3
dmd v2.079.0

$ git clone https://github.com/dcarp/cmake-d.git
$ cd cmake-d/tests/
$ ./run_tests_linux.sh
~/tmp/cmake-d-test-build/unspecified ~/tmp/cmake-d-test-build
-- The C compiler identification is AppleClang 9.0.0.9000039
-- The D compiler identification is DigitalMars
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working D compiler: /usr/local/bin/dmd
-- Check for working D compiler: /usr/local/bin/dmd -- broken
-- To force a specific D compiler set the DC environment variable
--     ie - export DC="/usr/bin/dmd"
CMake Error at /Users/john/tmp/cmake-d/cmake-d/CMakeTestDCompiler.cmake:45 (message):
  The D compiler "/usr/local/bin/dmd" is not able to compile a simple test
  program.

  It fails with the following output:

   Change Dir: /Users/john/tmp/cmake-d-test-build/unspecified/CMakeFiles/CMakeTmp



  Run Build Command:"/usr/bin/make" "cmTC_e0a40/fast"

  /Applications/Xcode.app/Contents/Developer/usr/bin/make -f
  CMakeFiles/cmTC_e0a40.dir/build.make CMakeFiles/cmTC_e0a40.dir/build

  Building D object CMakeFiles/cmTC_e0a40.dir/testDCompiler

  /usr/local/bin/dmd CMakeFiles/cmTC_e0a40.dir/testDCompiler -c
  /Users/john/tmp/cmake-d-test-build/unspecified/CMakeFiles/3.10.3/CMakeTmp/testDCompiler.d


  Error: module `testDCompiler` is in file
  'CMakeFiles/cmTC_e0a40.dir/testDCompiler.d' which cannot be read

  import path[0] = /usr/local/opt/dmd/include/dlang/dmd

  make[1]: *** [CMakeFiles/cmTC_e0a40.dir/testDCompiler] Error 1

  make: *** [cmTC_e0a40/fast] Error 2





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


-- Configuring incomplete, errors occurred!
See also "/Users/john/tmp/cmake-d-test-build/unspecified/CMakeFiles/CMakeOutput.log".
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target `test'.  Stop.

CMAKE_SIZEOF_VOID_P not set

The following D project won't work for me (cmake version 2.8.12.2):

cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake/Modules/cmake-d" "${CMAKE_MODULE_PATH}")
project (test D)

if (NOT CMAKE_SIZEOF_VOID_P)
message(FATAL_ERROR "'CMAKE_SIZEOF_VOID_P' is undefined.")
endif()

changing the line "project(test D)" to "project(test D C)" fixes the error but it shouldn't be necessary. According to the docs, CMAKE_SIZEOF_VOID_P gets set by the compiler testing step:
http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_SIZEOF_VOID_P.html

Edit: I only tested this with gdc/gcc on gentoo linux.

Build fails with ldc2

Running CMake without options uses gdc. Running CMake with -DCMAKE_D_COMPILER=dmd works fine. However running with -DCMAKE_D_COMPILER=ldc2 leads to:

-- Configuring done
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_D_COMPILER= ldc2

-- The D compiler identification is LDC
-- Check for working D compiler: /usr/bin/ldc2
-- Check for working D compiler: /usr/bin/ldc2 -- broken
-- To force a specific D compiler set the DC environment variable
--     ie - export DC="/usr/bin/dmd"
CMake Error at cmake-d/CMakeTestDCompiler.cmake:45 (message):
  The D compiler "/usr/bin/ldc2" is not able to compile a simple test
  program.

  It fails with the following output:

   Change Dir: /home/users/russel/BuildArea/HelloWorld_D_CMake/CMakeFiles/CMakeTmp

  

  Run Build Command:"/usr/bin/ninja" "cmTC_89a73"

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

  [2/2] Linking D executable cmTC_89a73

  FAILED: cmTC_89a73

  : && /usr/bin/ldc2 CMakeFiles/cmTC_89a73.dir/testDCompiler -ofcmTC_89a73 &&
  :

  Error: module testDCompiler is in file
  'CMakeFiles/cmTC_89a73.dir/testDCompiler.d' which cannot be read

  import path[0] = /usr/include/d

  import path[1] = /usr/lib/ldc/x86_64-linux-gnu/include/d/ldc

  import path[2] = /usr/lib/ldc/x86_64-linux-gnu/include/d

  ninja: build stopped: subcommand failed.

  

  

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


-- Configuring incomplete, errors occurred!

Error building with ldc2

Using ldc from the dlang overlay on Gentoo:
$ ldc2 --version
LDC - the LLVM D compiler (0.15.1):
based on DMD v2.066.1 and LLVM 3.4.2
Default target: x86_64-pc-linux-gnu
Host CPU: core-avx2
http://dlang.org - http://wiki.dlang.org/LDC

  Registered Targets:
    cpp    - C++ backend
    x86    - 32-bit X86: Pentium-Pro and above
    x86-64 - 64-bit X86: EM64T and AMD64

The following patch does the trick for me:

diff --git a/cmake-d/Platform/Linux-ldc2.cmake b/cmake-d/Platform/Linux-ldc2.cmake
index 91f09b7..872670f 100644
--- a/cmake-d/Platform/Linux-ldc2.cmake
+++ b/cmake-d/Platform/Linux-ldc2.cmake
@@ -54,7 +54,7 @@ SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a")
 SET (CMAKE_D_FLAGS_INIT "")
 # DMD can only produce 32-bit binaries for now
 SET (CMAKE_D_LINK_FLAGS "")
-SET (CMAKE_D_FLAGS_DEBUG_INIT "-g -debug -L--export-dynamic ${DDOC_FLAGS}")
+SET (CMAKE_D_FLAGS_DEBUG_INIT "-g -d-debug -L--export-dynamic ${DDOC_FLAGS}")
 SET (CMAKE_D_FLAGS_MINSIZEREL_INIT "-Os ${DDOC_FLAGS}")
 SET (CMAKE_D_FLAGS_RELEASE_INIT "-O -release -inline ${DDOC_FLAGS}")
 SET (CMAKE_D_FLAGS_RELWITHDEBINFO_INIT "-O -g -L--export-dynamic ${DDOC_FLAGS}")

cmake_compile_definitions doesn't work

I have a mixed C and D project. In my cmake file I have:

target_compile_definitions(${PROJECT_NAME}
    PRIVATE MG_ENABLE_HTTP_URL_REWRITES
)

When I compile with make VERBOSE=1 I see the -D flag passed for the .c files but not for the .d files. I'm using the gdc compiler.

dynamic linking with ldc2

Hi,
Using yout test and adding SHARED into lib_1 CMakeLists.txt with ldc2, I got the following error:

Scanning dependencies of target lib_1
[ 25%] Building D object lib_1/CMakeFiles/lib_1.dir/lib_1.o
[ 50%] Linking D shared library liblib_1.so
[ 50%] Built target lib_1
Scanning dependencies of target app
[ 75%] Building D object app_1/CMakeFiles/app.dir/app.o
[100%] Linking D executable app
Error: unrecognized file extension so

lib_1 CMakeLists.txt
add_library(lib_1 SHARED lib_1.d)

app CMakeLists.txt

add_executable(app app.d)
include_directories(app ${PROJECT_SOURCE_DIR})
add_test(app app)
target_link_libraries(app lib_1)

Wrong search compiler order?

It seems that on a system with dmd, ldc2, and gdc the compiler finder chooses gdc. I would have though it would choose dmd or ldc2.

Old string concatenation style doesn't work anymore

There are some .d-files that use "..." "..." to concat two strings. This is deprecated and causes CMake to produce errors. It should be replaced by "..." ~ "...".

Files affected:

CMakeDCompilerABI.d
CMakeDCompilerId.d.in
CMakePlatformId.di.in

Error while detecting compiler on Travis Ubuntu Linux

See the error message here:
https://api.travis-ci.org/jobs/102711636/log.txt?deansi=true

CMakeLists.txt:

cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/cmake-d")
project(ldc C CXX D)

@dcarp Hi, are you still maintaining cmake-d?
I'd like to use cmake-d for LDC's Travis tests, but it seems that it does not work on Travis with Ubuntu (it works fine locally on Windows, OS X, and Ubuntu 14, without sudo).
Thanks for the help.

Merging with trentforkert's work

Hi,

I'm working with @trentforkert on getting full D support into CMake (e.g., VisualD support, proper dependency management/discovery, and other things). I was wondering whether you'd be interested in bringing things from here into that branch (particularly the tests and the dub support).

ctest dependencies (slightly) screwed up

Here is how to replicate the issue:

#cd to the testing directory
mkdir build_dir
cd build_dir
cmake -DCMAKE_MODULE_PATH:PATH=<absolute path for working directory for git repository>/cmake-d ..
make all >& all.out
# grep for "Could" to cut down on size of error messages.
ctest --show-only |& grep Could

However, if I run ctest without the --show-only option first, then all is well and subsequent attempts to run "ctest --show-only" work without issues.

CMake 3.4.0: <FLAGS> no longer includes <INCLUDES>

Since CMake 3.4.0, the <FLAGS> placeholder no longer includes information about include directories; it's been split out into the <INCLUDES> placeholder instead. So in CMakeDInformation.cmake, you could do this:

# compile a D file into an object file
if(NOT CMAKE_D_COMPILE_OBJECT)
    if(NOT CMAKE_VERSION VERSION_LESS 3.4.0)
        set(CMAKE_D_COMPILE_OBJECT
         "<CMAKE_D_COMPILER> <FLAGS> <INCLUDES> ${CMAKE_D_DASH_O}<OBJECT> -c <SOURCE>")
    else(NOT CMAKE_VERSION VERSION_LESS 3.4.0)
        set(CMAKE_D_COMPILE_OBJECT
         "<CMAKE_D_COMPILER> <FLAGS> ${CMAKE_D_DASH_O}<OBJECT> -c <SOURCE>")
    endif(NOT CMAKE_VERSION VERSION_LESS 3.4.0)
endif(NOT CMAKE_D_COMPILE_OBJECT)

This change is needed to compile anything that uses include_directories in CMake 3.4.0.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.