Unlike cached approach, this is simpler but takes much longer to setup on each run.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# expands ~ to user home directory | |
# | |
# usage: | |
# expanduser("~/code" x) | |
function(expanduser in outvar) | |
if(CMAKE_VERSION VERSION_LESS 3.21) | |
get_filename_component(out ${in} ABSOLUTE) | |
else() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
import tempfile | |
import tarfile | |
import zstandard | |
# pip install zstandard | |
def extract_zst(archive: Path, out_path: Path): | |
"""extract .zst file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// build like: | |
// clang hw.c -framework Foundation -framework IOKit | |
// ./a.out then gives with an M1 Apple Silicon CPU: | |
// | |
// cpu0@0(E): apple,icestorm | |
// cpu1@0(E): apple,icestorm | |
// cpu2@0(E): apple,icestorm | |
// cpu3@0(E): apple,icestorm | |
// cpu4@1(P): apple,firestorm | |
// cpu5@1(P): apple,firestorm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# works for Unix, Windows, etc. | |
cmake_minimum_required(VERSION 3.22) | |
project(WindowsPath LANGUAGES C) | |
find_library(ZLIB REQUIRED) | |
add_executable(hello hello.c) | |
target_link_libraries(hello PRIVATE ZLIB::ZLIB) | |
add_test(NAME unit_hello COMMAND hello) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
run_command('python', 'meson_file_download.py', url, zipfn, '-hash', 'md5', md5hash, check: true) | |
run_command('python', 'meson_file_extract.py', zipfn, outpath, check: true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prepend = mingw_octave_path() | |
% for Octave on Windows, it's necessary to prepend MinGW path | |
% when running MinGW-compiled executables | |
% Also, Matlab with Parallel Toolbox MPIEXEC conflicts with system MPIEXEC, | |
% so excise from Path | |
% | |
% a command is then run like | |
% | |
% system([prepend, ' ', 'foo.exe']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.22) | |
project(envPrint LANGUAGES NONE) | |
enable_testing() | |
add_test(NAME PrintEnv COMMAND ${CMAKE_COMMAND} -E environment) | |
set_tests_properties(PrintEnv PROPERTIES | |
ENVIRONMENT_MODIFICATION "NotExistingVar=path_list_prepend:WillSegfault") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.19) | |
option(CMAKE_TLS_VERIFY "Check cert" ON) | |
function(user_agent url fn) | |
file(DOWNLOAD ${url} ${fn} | |
STATUS stat | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.19) | |
project(Connect LANGUAGES NONE) | |
enable_testing() | |
add_test(NAME InternetConnection COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_LIST_DIR}/connection.cmake) | |
set_property(TEST InternetConnection PROPERTY FIXTURES_SETUP InternetOK) | |
add_test(NAME NeedsInternet COMMAND ...) |