-
-
Save bmegli/c93e78483231297746a8086349b16414 to your computer and use it in GitHub Desktop.
Revisions
-
bmegli revised this gist
Apr 29, 2025 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,6 +10,7 @@ print() REPLACE_FILTER = { "-std=c++0x":"-std=c++17", "-std=c++11":"-std=c++17", "-std=c++14":"-std=c++17", "COMPILER_SUPPORTS_CXX11": "COMPILER_SUPPORTS_CXX17", -
bmegli revised this gist
Apr 24, 2025 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -35,12 +35,13 @@ def fix_cmakelist(cmakelist_path: str) -> None: print(f"{Fore.GREEN}Fixed !" if changed else f"{Fore.BLUE}Nothing to change") def walk_dir(dir: str, depth = 0) -> None: if depth >=5: return for d in os.listdir(dir): cmakelist_path = f"{dir}/{d}/CMakeLists.txt" if not os.path.isfile(cmakelist_path): if os.path.isdir(f"{dir}/{d}") : walk_dir(f"{dir}/{d}", depth+1) else : fix_cmakelist(cmakelist_path) -
bmegli revised this gist
Apr 22, 2025 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -11,6 +11,7 @@ REPLACE_FILTER = { "-std=c++11":"-std=c++17", "-std=c++14":"-std=c++17", "COMPILER_SUPPORTS_CXX11": "COMPILER_SUPPORTS_CXX17", "CMAKE_CXX_STANDARD 11": "CMAKE_CXX_STANDARD 17", "CMAKE_CXX_STANDARD 14": "CMAKE_CXX_STANDARD 17" -
Meltwin created this gist
May 4, 2023 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,48 @@ import os from colorama import Fore, Style WANTED_WIDTH = 100 DISPLAY_WIDTH = min(WANTED_WIDTH, os.get_terminal_size().columns - 2) print("┏" + "".center(DISPLAY_WIDTH, "━") + "┓") print(f"┃{Fore.RED}" + "CMakeLists to C++17 Utils".center(DISPLAY_WIDTH, " ") + f"{Style.RESET_ALL}┃") print(f"┃{Style.BRIGHT+ Fore.BLACK}" + "Meltwin - 2023".center(DISPLAY_WIDTH, " ") + f"{Style.RESET_ALL}┃") print("┗" + "".center(DISPLAY_WIDTH, "━") + "┛") print() REPLACE_FILTER = { "-std=c++11":"-std=c++17", "COMPILER_SUPPORTS_CXX11": "COMPILER_SUPPORTS_CXX17", "CMAKE_CXX_STANDARD 11": "CMAKE_CXX_STANDARD 17", "CMAKE_CXX_STANDARD 14": "CMAKE_CXX_STANDARD 17" } def fix_cmakelist(cmakelist_path: str) -> None: print(f"{Fore.YELLOW}▷ {Fore.RESET}Found {Fore.RED}{cmakelist_path}{Fore.RESET}", end=" ") with open(cmakelist_path, "r") as handle: data = handle.read() # Replacing changed = False for key, value in REPLACE_FILTER.items(): if data.find(key) != -1: data = data.replace(key, value) changed = True if changed: with open(cmakelist_path, "w") as handle: handle.write(data) print(f"{Fore.GREEN}Fixed !" if changed else f"{Fore.BLUE}Nothing to change") def walk_dir(dir: str, depth = 0) -> None: if depth >=2: return for d in os.listdir(dir): cmakelist_path = f"{dir}/{d}/CMakeLists.txt" if not os.path.isfile(cmakelist_path): walk_dir(f"{dir}/{d}", depth+1) else : fix_cmakelist(cmakelist_path) if __name__ == "__main__": # Get all the CMakeLists.txt walk_dir("./src")