-
Notifications
You must be signed in to change notification settings - Fork 9
Add meson build file #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
665bbf5
2f046f4
6dccb57
b0f9228
21cf181
d1685e1
1ba7f54
31ad96a
33f4568
28a27a1
3979b5f
7d926b4
c01f5b3
033c86c
7988dd8
bd359df
c516be4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,130 @@ | ||
| language: d | ||
| addons: | ||
| apt: | ||
| update: true | ||
| packages: | ||
| - libevent-dev | ||
| - libssl-dev | ||
| - pkg-config | ||
| - zlib1g-dev | ||
| matrix: | ||
| - libevent-dev | ||
| - libssl-dev | ||
| - pkg-config | ||
| - zlib1g-dev | ||
| - ninja-build | ||
| - python3 | ||
| - python3-pip | ||
| - python3-setuptools | ||
| # - meson # is too old | ||
| homebrew: | ||
| update: true | ||
| packages: | ||
| - ninja | ||
| - python | ||
| # - meson # is too old | ||
| jobs: | ||
| include: | ||
| - d: dmd | ||
| - name: "ldc-latest D compiler on Xenial Linux using dub" | ||
| os: linux | ||
| dist: xenial | ||
| d: ldc | ||
| env: | ||
| - COVERAGE=false | ||
| - BUILD_TOOL='dub' | ||
| - name: "ldc-latest D compiler on Xenial Linux using meson" | ||
| os: linux | ||
| dist: xenial | ||
| d: ldc | ||
| env: | ||
| - COVERAGE=false | ||
| - BUILD_TOOL='meson' | ||
| - name: "dmd-latest D compiler on Xenial Linux using dub" | ||
| os: linux | ||
| dist: xenial | ||
| d: dmd | ||
| env: | ||
| - COVERAGE=false | ||
| - BUILD_TOOL='dub' | ||
| - name: "dmd-2.088.1 D compiler on Xenial Linux using dub" | ||
| os: linux | ||
| dist: xenial | ||
| d: dmd-2.088.1 | ||
| env: | ||
| - COVERAGE=true | ||
| - { secure: O4OECnzSKN2Jf5su/wnxVQGx4iIVcE8DmZLT/WN4KDcHg+jQovwvxRizZEGDB9guX/3bZb321kIi4iXP8G/Z2D9rakdzFlG70Drf60w9kveg0QQEMdavAFKsjokNHuYBNhf7QaGZt8O4IvqMmckZ7NJQyiCY7bq9gV5eWz9QWUB2kMy9fHVS3nsR957ZvmDPqyVjcqCx1y9eUda6IeiD1XD/g7cBuOaN3Zg8ozhGTTr6dbFFdVZLqUbGf2tE/Mq1poqcys3qntClpe8iM2f9Ac2d7hCMjiE9HHT/Q5+ZpHh5dnMa1A8lbJT1lRCYokgxwrL7umjXOf7MA0v4SmtNlfU+GX6C7CjoGNghgDxACCsmKBKbYSICmZLxPFYJ/lmoqU8uzxXaXFFFBBL8xsmJznTKgM0TMTUoxJy06L71T37Bf5Yi3OxAisN9tBftffIHRv+UBoEn2+7I6WmKDkobGNIIj46mM0IKpzxUlF4je10yJlzPGm0PzSDm/ogH8JY3ednEvPFYBwlooWvBEAZpNbMl0tuezaAuYn8/qfpu5aTwvEe7tA0ugBVwBrH676DJQoAZFIji0k43pQfHc/2LIV+n5s5gkLYdFDuuUKbtijzqD4dDdn/pBB6gpzv2ZxBjOoIhCGwJoPMVpE/RLf+HJzdfHRRxdhvRbDon7vbnMz0= } | ||
| script: ./travis.sh | ||
| after_success: bash <(curl -s https://codecov.io/bash) | ||
| - os: osx | ||
| - BUILD_TOOL='dub' | ||
| - name: "dmd-latest D compiler on Xenial Linux using meson" | ||
| os: linux | ||
| dist: xenial | ||
| d: dmd | ||
| env: | ||
| - COVERAGE=true | ||
| script: ./travis.sh | ||
| after_success: bash <(curl -s https://codecov.io/bash) | ||
| - COVERAGE=false | ||
| - BUILD_TOOL='meson' | ||
| - name: "dmd-2.088.1 D compiler on Xenial Linux using meson" | ||
| os: linux | ||
| dist: xenial | ||
| d: dmd-2.088.1 | ||
| env: | ||
| - COVERAGE=false | ||
| - BUILD_TOOL='meson' | ||
| - name: "dmd-nightly D compiler on Xenial Linux using dub" | ||
| os: linux | ||
| dist: xenial | ||
| d: dmd-nightly | ||
| env: | ||
| - COVERAGE=false | ||
| - BUILD_TOOL='dub' | ||
| - name: "dmd-latest D compiler on macOS using dub" | ||
| os: osx | ||
| osx_image: xcode11.2 | ||
| d: dmd | ||
| env: | ||
| - COVERAGE=false | ||
| - BUILD_TOOL='dub' | ||
| - name: "dmd-2.088.1 D compiler on macOS using dub" | ||
| os: osx | ||
| osx_image: xcode11.2 | ||
| d: dmd-2.088.1 | ||
| env: | ||
| - COVERAGE=false | ||
| - BUILD_TOOL='dub' | ||
| allow_failures: | ||
| - d: dmd-nightly | ||
| - d: dmd | ||
| env: | ||
| - COVERAGE=false | ||
| - BUILD_TOOL='dub' | ||
| - d: dmd | ||
| env: | ||
| - COVERAGE=false | ||
| - BUILD_TOOL='meson' | ||
| - d: ldc | ||
| env: | ||
| - COVERAGE=false | ||
| - BUILD_TOOL='dub' | ||
|
|
||
| before_deploy: | ||
| - | | ||
| dub build -b ddox | ||
| # push docs to gh-pages branch | ||
| cd docs || exit 1 | ||
| git init | ||
| git config user.name 'Travis-CI' | ||
| git config user.email '<>' | ||
| git add . | ||
| git commit -m 'Deployed to Github Pages' | ||
| git push --force --quiet "https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}" master:gh-pages | ||
|
|
||
| deploy: | ||
| provider: pages | ||
| api_key: | ||
| secure: O4OECnzSKN2Jf5su/wnxVQGx4iIVcE8DmZLT/WN4KDcHg+jQovwvxRizZEGDB9guX/3bZb321kIi4iXP8G/Z2D9rakdzFlG70Drf60w9kveg0QQEMdavAFKsjokNHuYBNhf7QaGZt8O4IvqMmckZ7NJQyiCY7bq9gV5eWz9QWUB2kMy9fHVS3nsR957ZvmDPqyVjcqCx1y9eUda6IeiD1XD/g7cBuOaN3Zg8ozhGTTr6dbFFdVZLqUbGf2tE/Mq1poqcys3qntClpe8iM2f9Ac2d7hCMjiE9HHT/Q5+ZpHh5dnMa1A8lbJT1lRCYokgxwrL7umjXOf7MA0v4SmtNlfU+GX6C7CjoGNghgDxACCsmKBKbYSICmZLxPFYJ/lmoqU8uzxXaXFFFBBL8xsmJznTKgM0TMTUoxJy06L71T37Bf5Yi3OxAisN9tBftffIHRv+UBoEn2+7I6WmKDkobGNIIj46mM0IKpzxUlF4je10yJlzPGm0PzSDm/ogH8JY3ednEvPFYBwlooWvBEAZpNbMl0tuezaAuYn8/qfpu5aTwvEe7tA0ugBVwBrH676DJQoAZFIji0k43pQfHc/2LIV+n5s5gkLYdFDuuUKbtijzqD4dDdn/pBB6gpzv2ZxBjOoIhCGwJoPMVpE/RLf+HJzdfHRRxdhvRbDon7vbnMz0= | ||
| cleanup: true | ||
| keep_history: true | ||
| on: | ||
| branch: master | ||
| condition: $TRAVIS_OS_NAME = "linux" | ||
|
|
||
|
|
||
| script: | ||
| - ./travis.sh | ||
|
|
||
|
|
||
| branches: | ||
| only: | ||
| - master |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| project('io', 'd', default_options: ['optimization=3'], version: '0.2.3', license: 'BSL-1.0' ) | ||
| common_project_arguments = ['-release'] #, '--d-debug' | ||
| add_project_arguments(common_project_arguments, language: 'd') | ||
|
|
||
| # semver | ||
| version = meson.project_version().split('.') | ||
| major_version = version[0].to_int() | ||
| minor_version = version[1].to_int() | ||
| micro_version = version[2].to_int() | ||
|
|
||
| # base | ||
| dc = meson.get_compiler('d') | ||
|
|
||
| # Source files | ||
|
|
||
| sources = [ 'src/std/io/driver/package.d', | ||
| 'src/std/io/driver/sync.d', | ||
| 'src/std/io/exception.d', | ||
| 'src/std/io/file.d', | ||
| 'src/std/io/internal/iovec.d', | ||
| 'src/std/io/internal/string.d', | ||
| 'src/std/io/net/addr.d', | ||
| 'src/std/io/net/dns.d', | ||
| 'src/std/io/net/package.d', | ||
| 'src/std/io/net/socket.d', | ||
| 'src/std/io/net/tcp.d', | ||
| 'src/std/io/net/udp.d', | ||
| 'src/std/io/package.d' | ||
| ] | ||
bioinfornatics marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| inc_dir = include_directories('src/') | ||
|
|
||
| # Compiler and linker flags | ||
| common_dflags = [] | ||
| common_ldflags = [] | ||
|
|
||
| # library | ||
| if host_machine.system() == 'linux' | ||
| common_ldflags += [ '-Wl,-z,relro', '-Wl,-z,now' ] | ||
| endif | ||
|
|
||
| lib_type = get_option('default_library') | ||
| if lib_type == 'shared' | ||
| libio_soname = 'lib@[email protected].@1@'.format(meson.project_name(), major_version) | ||
| common_ldflags += ['-shared' ] | ||
| if dc.get_id() == 'llvm' | ||
| common_ldflags += [ '-soname', libio_soname ] | ||
| endif | ||
| endif | ||
|
|
||
|
|
||
| io_lib = library(meson.project_name(), | ||
| sources, | ||
| include_directories: inc_dir, | ||
| link_args : common_ldflags, | ||
| install: true, | ||
| version: meson.project_version(), | ||
| d_unittest: false | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we make a separate executable with unittests turned on?
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From the meson site, looks like we can do that with: io_test_exe = executable('io_test', sources, d_unittest: true)
test('iotest', io_test_exe)I think we would have to add a main function somewhere, and add that to the sources.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added the option
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Awesome! Let's see how it goes, and I'll merge if things look good. Thanks for all the effort here! Always good to spread libraries into alternate build mechanisms.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for your words of encouragement. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good stuff! |
||
| ) | ||
|
|
||
|
|
||
| io_dep = declare_dependency( | ||
| link_with: [io_lib], | ||
| include_directories: inc_dir, | ||
| dependencies: [], | ||
| ) | ||
|
|
||
| if get_option('run_test') | ||
| configure_file(input: 'LICENSE.txt', output:'LICENSE.txt', copy: true) | ||
| io_test_exe = executable(meson.project_name() + '-test', | ||
| sources, include_directories: inc_dir, | ||
| d_unittest: true, | ||
| link_args: ['-main'], | ||
| d_args: ['-cov'] | ||
| ) | ||
| test(meson.project_name() + '-test', io_test_exe) | ||
| endif | ||
|
|
||
| # Compat variables for pkgconfig | ||
| pkg = import('pkgconfig') | ||
| pkg.generate(io_lib, | ||
| description: 'Core I/O functionality.', | ||
| subdirs: 'd/' + meson.project_name(), | ||
| url: 'https://github.com/MartinNowak/io' | ||
| ) | ||
|
|
||
|
|
||
| install_subdir('src/', | ||
| strip_directory : true, | ||
| install_dir: 'include/d/' + meson.project_name(), | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| option('run_test', type : 'boolean', value : false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure you want this...
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
current io code can build up to dmdfe 2.088.1
Updating
iocode should be done in another pull requestThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we can update this when the bugs are fixed in the latest compiler.