echo Executing build/test script | echo Executing build/test script | ||||
python -u tools/build.py --cxx cl.exe --test --static || exit 1 | python -u tools/build.py --cxx cl.exe --test --static || exit 1 | ||||
displayName: Build and Run Unit Tests | displayName: Build and Run Unit Tests | ||||
- publish: _build/ddslim.exe | |||||
artifact: DDSLiM Executable - Windows VS2019 | |||||
- publish: _build/dds.exe | |||||
artifact: DDS Executable - Windows VS2019 | |||||
- script: | | - script: | | ||||
echo Loading VS environment | echo Loading VS environment | ||||
call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\Tools\\vsdevcmd" -arch=x64 || exit 1 | call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\Common7\\Tools\\vsdevcmd" -arch=x64 || exit 1 | ||||
python -u tools/test.py --exe _build/ddslim.exe -T tools/msvc.dds || exit 1 | |||||
python -u tools/test.py --exe _build/dds.exe -T tools/msvc.dds || exit 1 | |||||
displayName: Smoke Tests | displayName: Smoke Tests | ||||
- job: Linux_GCC8 | - job: Linux_GCC8 | ||||
displayName: Prepare System | displayName: Prepare System | ||||
- script: python3 -u tools/build.py --cxx g++-8 --test --static | - script: python3 -u tools/build.py --cxx g++-8 --test --static | ||||
displayName: Build and Run Unit Tests | displayName: Build and Run Unit Tests | ||||
- publish: _build/ddslim | |||||
artifact: DDSLiM Executable - Linux | |||||
- script: python3 -u tools/test.py --exe _build/ddslim -T:gcc-8 | |||||
- publish: _build/dds | |||||
artifact: DDS Executable - Linux | |||||
- script: python3 -u tools/test.py --exe _build/dds -T:gcc-8 | |||||
displayName: Smoke Tests | displayName: Smoke Tests | ||||
- job: macOS_GCC8 | - job: macOS_GCC8 | ||||
displayName: Prepare System | displayName: Prepare System | ||||
- script: python3 -u tools/build.py --cxx g++-8 --test | - script: python3 -u tools/build.py --cxx g++-8 --test | ||||
displayName: Build and Run Unit Tests | displayName: Build and Run Unit Tests | ||||
- publish: _build/ddslim | |||||
artifact: DDSLiM Executable - macOS | |||||
- script: python3 -u tools/test.py --exe _build/ddslim -T:gcc-8 | |||||
- publish: _build/dds | |||||
artifact: DDS Executable - macOS | |||||
- script: python3 -u tools/test.py --exe _build/dds -T:gcc-8 | |||||
displayName: Smoke Tests | displayName: Smoke Tests |
Name: ddslim | |||||
Name: dds | |||||
Uses: taywee/args | Uses: taywee/args | ||||
Uses: spdlog/spdlog | Uses: spdlog/spdlog |
Name: ddslim | |||||
Name: dds | |||||
Version: 0.1.0 | Version: 0.1.0 |
int main(int argc, char** argv) { | int main(int argc, char** argv) { | ||||
spdlog::set_pattern("[%H:%M:%S] [%^%l%$] %v"); | spdlog::set_pattern("[%H:%M:%S] [%^%l%$] %v"); | ||||
args::ArgumentParser parser("DDSLiM - The drop-dead-simple library manager"); | |||||
args::ArgumentParser parser("DDS - The drop-dead-simple library manager"); | |||||
cli_base cli{parser}; | cli_base cli{parser}; | ||||
cli_build build{cli}; | cli_build build{cli}; |
if (errno == ENOENT) { | if (errno == ENOENT) { | ||||
std::cerr << fmt:: | std::cerr << fmt:: | ||||
format("[ddslim child executor] The requested executable ({}) could not be found.", | |||||
format("[dds child executor] The requested executable ({}) could not be found.", | |||||
strings[0]); | strings[0]); | ||||
std::exit(-1); | std::exit(-1); | ||||
} | } | ||||
std::cerr << "[ddslim child executor] execvp returned! This is a fatal error: " | |||||
std::cerr << "[dds child executor] execvp returned! This is a fatal error: " | |||||
<< std::system_category().message(errno) << '\n'; | << std::system_category().message(errno) << '\n'; | ||||
std::terminate(); | std::terminate(); |
fs::path user_cache_dir(); | fs::path user_cache_dir(); | ||||
fs::path user_config_dir(); | fs::path user_config_dir(); | ||||
inline fs::path dds_data_dir() { return user_data_dir() / "ddslim"; } | |||||
inline fs::path dds_cache_dir() { return user_cache_dir() / "ddslim-cache"; } | |||||
inline fs::path dds_config_dir() { return user_config_dir() / "ddslim"; } | |||||
inline fs::path dds_data_dir() { return user_data_dir() / "dds"; } | |||||
inline fs::path dds_cache_dir() { return user_cache_dir() / "dds-cache"; } | |||||
inline fs::path dds_config_dir() { return user_config_dir() / "dds"; } | |||||
} // namespace dds | } // namespace dds |
build_dir = ROOT / '_build' | build_dir = ROOT / '_build' | ||||
src_dir = ROOT / 'src' | src_dir = ROOT / 'src' | ||||
relpath = cpp_file.relative_to(src_dir) | relpath = cpp_file.relative_to(src_dir) | ||||
obj_path = build_dir / relpath.with_name(relpath.name + opts.obj_suffix) | |||||
obj_path = build_dir / '_obj' / relpath.with_name(relpath.name + opts.obj_suffix) | |||||
obj_path.parent.mkdir(exist_ok=True, parents=True) | obj_path.parent.mkdir(exist_ok=True, parents=True) | ||||
cmd = _create_compile_command(opts, cpp_file, obj_path) | cmd = _create_compile_command(opts, cpp_file, obj_path) | ||||
msg = f'Compile C++ file: {cpp_file.relative_to(ROOT)}' | msg = f'Compile C++ file: {cpp_file.relative_to(ROOT)}' | ||||
def _create_archive_command(opts: BuildOptions, | def _create_archive_command(opts: BuildOptions, | ||||
objects: Iterable[Path]) -> Tuple[Path, List[str]]: | objects: Iterable[Path]) -> Tuple[Path, List[str]]: | ||||
if opts.is_msvc: | if opts.is_msvc: | ||||
lib_file = ROOT / '_build/libddslim.lib' | |||||
lib_file = ROOT / '_build/libdds.lib' | |||||
cmd = ['lib', '/nologo', f'/OUT:{lib_file}', *map(str, objects)] | cmd = ['lib', '/nologo', f'/OUT:{lib_file}', *map(str, objects)] | ||||
return lib_file, cmd | return lib_file, cmd | ||||
else: | else: | ||||
lib_file = ROOT / '_build/libddslim.a' | |||||
lib_file = ROOT / '_build/libdds.a' | |||||
cmd = ['ar', 'rsc', str(lib_file), *map(str, objects)] | cmd = ['ar', 'rsc', str(lib_file), *map(str, objects)] | ||||
return lib_file, cmd | return lib_file, cmd | ||||
build_opts, | build_opts, | ||||
objects[next(iter(main_sources))], | objects[next(iter(main_sources))], | ||||
lib, | lib, | ||||
out=ROOT / '_build/ddslim') | |||||
out=ROOT / '_build/dds') | |||||
if args.test: | if args.test: | ||||
list(pool.map(run_test, test_exes)) | list(pool.map(run_test, test_exes)) |
def bootstrap_self(opts: TestOptions): | def bootstrap_self(opts: TestOptions): | ||||
# Copy the exe to another location, as windows refuses to let a binary be | # Copy the exe to another location, as windows refuses to let a binary be | ||||
# replaced while it is executing | # replaced while it is executing | ||||
new_exe = ROOT / '_ddslime.bootstrap-test.exe' | |||||
new_exe = ROOT / '_dds.bootstrap-test.exe' | |||||
shutil.copy2(opts.exe, new_exe) | shutil.copy2(opts.exe, new_exe) | ||||
res = subprocess.run([ | res = subprocess.run([ | ||||
str(new_exe), | str(new_exe), | ||||
parser.add_argument( | parser.add_argument( | ||||
'--exe', | '--exe', | ||||
'-e', | '-e', | ||||
help='Path to the ddslim executable to test', | |||||
help='Path to the dds executable to test', | |||||
required=True) | required=True) | ||||
parser.add_argument( | parser.add_argument( | ||||
'--toolchain', | '--toolchain', | ||||
'-T', | '-T', | ||||
help='The ddslim toolchain to use while testing', | |||||
help='The dds toolchain to use while testing', | |||||
required=True, | required=True, | ||||
) | ) | ||||
parser.add_argument( | parser.add_argument( |