my $IS_WIN = ( $^O eq "MSWin32" );
my $SEP = $IS_WIN ? "\\" : '/';
my $MAKE = $IS_WIN ? 'gmake' : 'make';
+my $SUDO = $IS_WIN ? '' : 'sudo';
my $cmake_gen;
GetOptions( 'gen=s' => \$cmake_gen, )
}
mkdir('B');
chdir('B');
+if ( !$ENV{SKIP_RINUTILS_INSTALL} )
+{
+ do_system(
+ {
+ cmd => [ qw#git clone https://github.com/shlomif/rinutils#, ]
+ }
+ );
+ do_system(
+ {
+ cmd => [
+ qq#cd rinutils && mkdir B && cd B && cmake #
+ . ( defined($cmake_gen) ? qq# -G "$cmake_gen" # : "" )
+ . (
+ defined( $ENV{CMAKE_MAKE_PROGRAM} )
+ ? " -DCMAKE_MAKE_PROGRAM=$ENV{CMAKE_MAKE_PROGRAM} "
+ : ""
+ )
+ . ( $IS_WIN ? " -DCMAKE_INSTALL_PREFIX=C:/foo " : '' )
+ . qq# .. && $SUDO $MAKE install#
+ ]
+ }
+ );
+}
+do_system( { cmd => [ "cmake", "--version" ] } );
+my $CMAKE_MODULE_PATH = join ";",
+ (
+ map { ; $_, s%/%\\%gr } (
+ map { ; $_, "$_/Rinutils", "$_/Rinutils/cmake" }
+ map { ; $_, "$_/lib", "$_/lib64" } ( map { ; "c:$_", $_ } ("/foo") )
+ )
+ );
+
+# die "<$CMAKE_MODULE_PATH>";
+if ($IS_WIN)
+{
+ ( $ENV{CMAKE_MODULE_PATH} //= '' ) .= ";$CMAKE_MODULE_PATH;";
+
+ # ( $ENV{PKG_CONFIG_PATH} //= '' ) .= ";C:\\foo\\lib\\pkgconfig;";
+ ( $ENV{PKG_CONFIG_PATH} //= '' ) .=
+ ";/foo/lib/pkgconfig/;/c/foo/lib/pkgconfig/";
+ $ENV{RINUTILS_INCLUDE_DIR} = "C:/foo/include";
+}
do_system(
{
cmd => [
- $^X, "..${SEP}scripts${SEP}Tatzer",
- ( defined($cmake_gen) ? (qq#--gen="$cmake_gen"#) : () )
+ "mkdir B && cd B && cmake "
+ . ( defined($cmake_gen) ? qq#-G "$cmake_gen"# : "" )
+ . " ../fortune-mod && $MAKE && $MAKE check"
]
}
);
-do_system( { cmd => [$MAKE] } );
-do_system( { cmd => [ $MAKE, "check", ] } );
CMAKE_POLICY(SET CMP0054 NEW)
+INCLUDE(FindPkgConfig)
+
SET (PKGDATADIR_SUBDIR "fortune-mod")
SET (RELATIVE_PKGDATADIR "${RELATIVE_DATADIR}/${PKGDATADIR_SUBDIR}")
SET (PKGDATADIR "${DATADIR}/${PKGDATADIR_SUBDIR}")
SHLOMIF_FINALIZE_FLAGS()
-SET (rinutils "rinutils")
-IF (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${rinutils}")
- EXECUTE_PROCESS(COMMAND "git" "clone" "https://github.com/shlomif/rinutils.git" "${rinutils}"
- WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
- )
+find_package(Rinutils REQUIRED)
+if ()
+ PKG_CHECK_MODULES(RINUTILS REQUIRED "librinutils")
+ IF (NOT "${RINUTILS_FOUND}")
+ MESSAGE (FATAL "rinutils could not be found.")
+ ENDIF ()
ENDIF ()
-INCLUDE_DIRECTORIES(BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/${rinutils}/rinutils/include")
+
+INCLUDE_DIRECTORIES(AFTER ${RINUTILS_INCLUDE_DIR} ${RINUTILS_INCLUDE_DIRS})
IF ("$ENV{FCS_GCC}")
ADD_DEFINITIONS("-W -Wabi=11 -Waddress -Waggressive-loop-optimizations -Wall -Wattributes -Wbad-function-cast -Wbool-compare -Wbool-operation -Wbuiltin-declaration-mismatch -Wbuiltin-macro-redefined -Wcast-align -Wchar-subscripts -Wchkp -Wclobbered -Wcomment -Wcomments -Wcoverage-mismatch -Wcpp -Wdangling-else -Wdate-time -Wdeprecated -Wdeprecated-declarations -Wdesignated-init -Wdisabled-optimization -Wdiscarded-array-qualifiers -Wdiscarded-qualifiers -Wdiv-by-zero -Wdouble-promotion -Wduplicated-branches -Wduplicated-cond -Wduplicate-decl-specifier -Wempty-body -Wendif-labels -Wenum-compare -Wexpansion-to-defined -Wextra -Wformat-contains-nul -Wformat-extra-args -Wformat-nonliteral -Wformat-security -Wformat-signedness -Wformat-y2k -Wformat-zero-length -Wframe-address -Wfree-nonheap-object -Whsa -Wignored-attributes -Wignored-qualifiers -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wincompatible-pointer-types -Winit-self -Winline -Wint-conversion -Wint-in-bool-context -Wint-to-pointer-cast -Winvalid-memory-model -Winvalid-pch -Wjump-misses-init -Wlogical-not-parentheses -Wlogical-op -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation -Wmissing-braces -Wmissing-declarations -Wmissing-field-initializers -Wmissing-include-dirs -Wmissing-parameter-type -Wmissing-prototypes -Wmultichar -Wnarrowing -Wnested-externs -Wnonnull -Wnonnull-compare -Wnull-dereference -Wodr -Wold-style-declaration -Wold-style-definition -Wopenmp-simd -Woverflow -Woverlength-strings -Woverride-init -Wpacked -Wpacked-bitfield-compat -Wparentheses -Wpointer-arith -Wpointer-compare -Wpointer-sign -Wpointer-to-int-cast -Wpragmas -Wpsabi -Wrestrict -Wreturn-local-addr -Wreturn-type -Wscalar-storage-order -Wsequence-point -Wshadow -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value -Wsizeof-array-argument -Wsizeof-pointer-memaccess -Wstack-protector -Wstrict-aliasing -Wstrict-prototypes -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wsuggest-final-methods -Wsuggest-final-types -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-unreachable -Wsync-nand -Wtautological-compare -Wtrampolines -Wtrigraphs -Wtype-limits -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations -Wunused -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-function -Wunused-label -Wunused-local-typedefs -Wunused-macros -Wunused-parameter -Wunused-result -Wunused-value -Wunused-variable -Wvarargs -Wvariadic-macros -Wvector-operation-performance -Wvla -Wvolatile-register-var -Wwrite-strings -Walloc-size-larger-than=9223372036854775807 -Warray-bounds=2 -Wformat-overflow=2 -Wformat-truncation=2 -Wnormalized=nfc -Wshift-overflow=2 -Wunused-const-variable=2 -Wstrict-overflow=1 -Wno-switch-default -Wno-vla -Wno-inline -Wno-jump-misses-init -Wno-unsafe-loop-optimizations")