From 7d1e390fcb2535ce497bd93cdd579ca3460dcddd Mon Sep 17 00:00:00 2001 From: Tokuhiro Matsuno Date: Fri, 22 May 2015 08:40:26 +0900 Subject: [PATCH] use cmake --- .gitignore | 5 +++ CMakeLists.txt | 16 ++++++++++ Makefile.PL | 19 ----------- lib/Clib/nanotap.pm | 60 ----------------------------------- lib/Module/Install/nanotap.pm | 60 ----------------------------------- 5 files changed, 21 insertions(+), 139 deletions(-) create mode 100644 CMakeLists.txt delete mode 100644 Makefile.PL delete mode 100644 lib/Clib/nanotap.pm delete mode 100644 lib/Module/Install/nanotap.pm diff --git a/.gitignore b/.gitignore index 2bd0cc3..ea742ad 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,8 @@ t/04_is_binary t/003_mi/blib/ t/003_mi/META.yml t/003_mi/pm_to_blib +/CMakeCache.txt +/CMakeFiles/ +/CTestTestfile.cmake +/Testing/ +/cmake_install.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..6adda5d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required (VERSION 2.6) +project(nanotap) + +enable_testing() + +add_executable(01_c t/01_c.c) +set_target_properties(01_c PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/t/") + +add_executable(02_cpp t/02_cpp.cc) +set_target_properties(02_cpp PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/t/") + +add_executable(04_is_binary t/04_is_binary.cc) +set_target_properties(04_is_binary PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/t/") + +add_test(NAME prove COMMAND prove t) + diff --git a/Makefile.PL b/Makefile.PL deleted file mode 100644 index 5818781..0000000 --- a/Makefile.PL +++ /dev/null @@ -1,19 +0,0 @@ -sub readme_markdown_from { } - -use inc::Module::Install; -name 'Clib-nanotap'; -all_from 'lib/Clib/nanotap.pm'; -readme_markdown_from 'lib/Clib/nanotap.pm'; - -my $e = env_for_c(); -$e->enable_warnings; -$e->program('t/01_c', 't/01_c.c'); -$e->program('t/02_cpp', 't/02_cpp.cc'); -$e->program('t/04_is_binary', 't/04_is_binary.cc'); - -clib_header('nanotap.h'); - -tests 't/*.t t/*/*.t'; - -test_requires 'Test::More' => 0.94; -WriteMakefileForC; diff --git a/lib/Clib/nanotap.pm b/lib/Clib/nanotap.pm deleted file mode 100644 index 1c90ebd..0000000 --- a/lib/Clib/nanotap.pm +++ /dev/null @@ -1,60 +0,0 @@ -package Clib::nanotap; -our $VERSION = '0.04'; -use 5.006; -1; -__END__ - -=head1 NAME - -Clib::nanotap - yet another TAP library for C/C++ - -=head1 SYSNOPSIS - - #include - int main() { - ok(true, "ok"); - done_testing(); - } - -=head1 DESCRIPTION - -nanotap is yet another TAP library for C/C++. - -=head1 METHODS - -see L itself :P -(XXX I need better documentation tool) - -=head1 SEE ALSO - -L - -=head1 AUTHOR - -Tokuhiro Matsuno Etokuhirom ah! gmail.comE - -=head1 LICENSE - - The MIT License (MIT) - Copyright © 2015 Tokuhiro Matsuno, http://64p.org/ - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the “Software”), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - -=cut - diff --git a/lib/Module/Install/nanotap.pm b/lib/Module/Install/nanotap.pm deleted file mode 100644 index 57dbf21..0000000 --- a/lib/Module/Install/nanotap.pm +++ /dev/null @@ -1,60 +0,0 @@ -use warnings; -use strict; - -package Module::Install::nanotap; -use Module::Install::Base; -our @ISA = qw(Module::Install::Base); -use Config; -use File::Spec; - -sub use_nanotap { - my ($self) = @_; - - $self->clib_setup(); - - my ($header) = grep { -f $_ } map { - File::Spec->catfile( $_, 'auto', 'Clib', 'include', 'nanotap', - 'nanotap.h' ) - } grep /$Config{archname}/, @INC; - if ($header) { - $self->admin->copy($header, File::Spec->catfile(qw/inc auto Clib include nanotap nanotap.h/)); - my $incs = $self->makemaker_args->{INC} || ''; - $self->makemaker_args->{INC} = "-Iinc/auto/Clib/include/ $incs"; - } else { - die "cannot find nanotap.h"; - } -} - -1; -__END__ - -=head1 NAME - -Module::Install::nanotap - installer for nanotap - -=head1 SYNOPSIS - - use inc::Module::Install; - use_nanotap; - -=head1 DESCRIPTION - -This module adds the C directive to Module::Install. - -Now you can get full nanotap support for you module with no external -dependency on nanotap. - -=head1 AUTHOR - -Tokuhiro Matsuno - -=head1 COPYRIGHT - -Copyright (c) 2006, 2008. Ingy döt Net. - -This program is free software; you can redistribute it and/or modify it -under the same terms as Perl itself. - -See L - -=cut