Advent of Code 2025, done in C++
at main 1.3 kB view raw
1common_inc = include_directories('common') 2common_lib = static_library( 3 'aoc_common', 4 sources: files('common/istest.cxx', 'common/getinputpath.cxx'), 5 include_directories: common_inc, 6) 7 8day_list_cmd = run_command( 9 'python3', 10 '-c', 11 ''' 12import os, sys 13root = sys.argv[1] 14for name in sorted(os.listdir(root)): 15 if name == 'common': 16 continue 17 path = os.path.join(root, name) 18 if os.path.isdir(path) and os.path.isfile(os.path.join(path, 'solution.cxx')): 19 print(name) 20''', 21 meson.current_source_dir(), 22 check: true, 23) 24 25day_dirs_raw = day_list_cmd.stdout().strip() 26day_dirs = [] 27if day_dirs_raw != '' 28 day_dirs = day_dirs_raw.split('\n') 29endif 30 31foreach day : day_dirs 32 day_src = join_paths(day, 'solution.cxx') 33 day_data = join_paths(meson.project_source_root(), 'data', day) 34 35 day_exe = executable( 36 'day' + day, 37 sources: day_src, 38 include_directories: [common_inc], 39 link_with: common_lib, 40 cpp_args: ['-DDATA_FOLDER="@0@"'.format(day_data)], 41 ) 42 43 test( 44 'day' + day, 45 day_exe, 46 args: ['--mode=test'], 47 env: { 48 'DATA_FOLDER': day_data, 49 'AOC_MODE': 'test', 50 }, 51 ) 52 53 run_target( 54 'run-day' + day, 55 command: day_exe, 56 env: { 57 'DATA_FOLDER': day_data, 58 'AOC_MODE': 'real', 59 }, 60 ) 61endforeach