CMake for D2

Overview

Build Status

cmake-d

CMake for D2

Usage

  1. Download and extract https://github.com/dcarp/cmake-d/archive/master.zip to a local directory
  2. Create a D CMake Project: project(project-name D)
  3. Run cmake as usual specifing the cmake-d path. To cache it, don't forget to specify the :PATH variable type.
cmake -DCMAKE_MODULE_PATH:PATH=
   
    /cmake-d 
    

    
   
Comments
  • reworked unittests

    reworked unittests

    https://github.com/dcarp/cmake-d/pull/23

    there is still a small thing I don't get away. doesn't affect the functionality is just about the if you asked

    opened by RalphBariz 4
  • reworked unittests

    reworked unittests

    • replaced add_unittests with target_add_unittests so they are target related reusing their includes and libraries

    sorry for triggering so much mails. now its pushed and working

    opened by RalphBariz 4
  • Error on OSX

    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)
    
    opened by ZelimDamian 4
  • Add shared library support for dmd

    Add shared library support for dmd

    I looked in to supporting gdc and ldc as well, but couldn't get either to work with the module.

    Linking against shared libs doesn't work in the latest dmd release, pending a version which includes this fix. Dynamic loading works fine, however.

    opened by Yoplitein 4
  • ldc not auto detected

    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?

    opened by baruch 3
  • CMAKE_SIZEOF_VOID_P not set

    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.

    opened by KingDuckZ 3
  • cmake_compile_definitions doesn't work

    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.

    opened by KingDuckZ 2
  • Error while detecting compiler on Travis Ubuntu Linux

    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.

    opened by JohanEngelen 2
  • Old string concatenation style doesn't work anymore

    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

    opened by ghost 1
  • CMakeTestDCompiler failure on OS X

    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.
    
    opened by belm0 1
  • reworked unittest support

    reworked unittest support

    • replaced add_unittests with target_add_unittests so they are target related reusing their includes and libraries
    • unittests is compiled by cmake/make using add_executable and only executed by ctest
    • replaced the dummy main with -main linker option
    • unittest build depends on target build so its not build if it makes no sense
    opened by RalphBariz 1
  • ctest dependencies (slightly) screwed up

    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.

    opened by airwin1 0
  • dynamic linking with ldc2

    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)
    
    opened by boolangery 0
  • Merging with trentforkert's work

    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).

    opened by mathstuf 9
Owner
Dragos Carp
Dragos Carp
CMake scripts for painless usage of SuiteSparse+METIS from Visual Studio and the rest of Windows/Linux/OSX IDEs supported by CMake

CMake scripts for painless usage of Tim Davis' SuiteSparse (CHOLMOD,UMFPACK,AMD,LDL,SPQR,...) and METIS from Visual Studio and the rest of Windows/Lin

Jose Luis Blanco-Claraco 395 Dec 24, 2022
cmake-font-lock - Advanced, type aware, highlight support for CMake

cmake-font-lock - Advanced, type aware, highlight support for CMake

Anders Lindgren 39 Oct 2, 2022
cmake-avr - a cmake toolchain for AVR projects

cmake-avr - a cmake toolchain for AVR projects Testing the example provided The toolchain was created and tested within the following environment: Lin

Matthias Kleemann 163 Dec 5, 2022
Make CMake less painful when trying to write Modern Flexible CMake

Izzy's eXtension Modules IXM is a CMake library for writing Modern flexible CMake. This means: Reducing the amount of CMake written Selecting reasonab

IXM 107 Sep 1, 2022
CMake module to enable code coverage easily and generate coverage reports with CMake targets.

CMake-codecov CMake module to enable code coverage easily and generate coverage reports with CMake targets. Include into your project To use Findcodec

HPC 82 Nov 30, 2022
unmaintained - CMake module to activate certain C++ standard, feature checks and appropriate automated workarounds - basically an improved version of cmake-compile-features

Compatibility This library provides an advanced target_compile_features() and write_compiler_detection_header(). The problem with those is that they a

Jonathan Müller 74 Dec 26, 2022
[CMake] [BSD-2] CMake module to find ICU

FindICU.cmake A CMake module to find International Components for Unicode (ICU) Library Note that CMake, since its version 3.7.0, includes a FindICU m

julp 29 Nov 2, 2022
CMake project for BL602 RISC-V processor

bl602_cmake_base CMake project for BL602 RISC-V processor How to build NOTE : This project uses a pre-compiled version of the Buffalo SDK (bl_iot_sdk)

null 9 Jan 6, 2022
A CMake toolchain file for iOS, macOS, watchOS & tvOS C/C++/Obj-C++ development

A CMake toolchain file for iOS, macOS, watchOS & tvOS C/C++/Obj-C++ development

Alexander Widerberg 1.4k Jan 4, 2023
curl cmake module libcurl build with msvc x86

curl-msvc Infomation curl cmake module libcurl build with MSVC10.0 arch (x86 | i386) source from https://github.com/curl/curl tags: curl-7_79_1 Usage

Jason Payne 0 May 16, 2022
NeoWorld is a resampler using the CMake build system

NeoWorld is a resampler using the CMake build system. It's designed for utsu, OpenUTAU, and UTAU.

null 5 Dec 23, 2022
A CMake addon that avoids you writing boilerplate code for resource management.

SHader INJ(I)ector SHINJI (originally SHader INJector) is a CMake addon that avoids you writing boilerplate code for resource management and exposes s

Lorenzo Rutayisire 6 Dec 14, 2022
A CMake starter template using CPM

Cmake Starter About A lightweight Cmake project meant for a binary application (not a shared library), tests with catch2 are configured, CPM is the pa

Matt Williams 1 Jul 14, 2022
Non-intrusive CMake dependency management

cmodule Non-intrusive CMake dependency management. Normally CMake's find_package() looks for packages installed on host system (and compiled for host

scapix.com 14 Sep 29, 2022
Simple library for embedding static resources into C++ binaries using CMake

libromfs libromfs is an easy way to bundle resources directly into any C++ application and access them through a simple interface. The main advantage

WerWolv 28 Nov 30, 2022
Project to enable using CMake from a Maven build.

CMake-Maven-Project Introduction A Maven project for the CMake build system. It can be used by including it as a plugin within your Maven project's po

null 60 Nov 14, 2022
Autotools-style configure script wrapper around CMake

configure-cmake configure-cmake is an autotools-style configure script for CMake-based projects. People building software on Linux or BSD generally ex

Evan Nemerson 82 Dec 14, 2022
Check for coding style issues in CMake files

cmakelint parses CMake files and reports style issues. cmakelint requires Python. Installation sudo pip install cmakelint Usage Syntax: cmakelint [--c

Richard Quirk 99 Dec 10, 2022
Enhanced CMake Project Manager plugin for Qt Creator

CMakeProjectManager2 Alternative CMake support for Qt Creator. Main differents from original CMakeProject plugin: Project file list readed from file s

Alexander Drozdov 71 Nov 20, 2022