diff --git a/CMakeLists.txt b/CMakeLists.txt index e093fd8..822f136 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.25) -set(BLT_GRAPHICS_VERSION 0.9.0) +set(BLT_GRAPHICS_VERSION 0.9.1) set(BLT_GRAPHICS_TEST_VERSION 0.0.1) project(BLT_WITH_GRAPHICS VERSION ${BLT_GRAPHICS_VERSION}) @@ -10,6 +10,7 @@ option(ENABLE_UBSAN "Enable the ub sanitizer" OFF) option(ENABLE_TSAN "Enable the thread data race sanitizer" OFF) option(BUILD_GRAPHICS_TESTS "Build the BLT Graphics test set" OFF) +option(BUILD_EXAMPLE_BASIC "Build the basic example" OFF) set(CMAKE_CXX_STANDARD 17) @@ -52,18 +53,18 @@ target_include_directories(BLT_WITH_GRAPHICS PUBLIC include/) target_include_directories(BLT_WITH_GRAPHICS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/libraries/imgui/) if (${ENABLE_ADDRSAN} MATCHES ON) - target_compile_options(BLT_WITH_GRAPHICS PRIVATE -fsanitize=address) - target_link_options(BLT_WITH_GRAPHICS PRIVATE -fsanitize=address) + target_compile_options(${PROJECT_NAME} PRIVATE -fsanitize=address) + target_link_options(${PROJECT_NAME} PRIVATE -fsanitize=address) endif () if (${ENABLE_UBSAN} MATCHES ON) - target_compile_options(BLT_WITH_GRAPHICS PRIVATE -fsanitize=undefined) - target_link_options(BLT_WITH_GRAPHICS PRIVATE -fsanitize=undefined) + target_compile_options(${PROJECT_NAME} PRIVATE -fsanitize=undefined) + target_link_options(${PROJECT_NAME} PRIVATE -fsanitize=undefined) endif () if (${ENABLE_TSAN} MATCHES ON) - target_compile_options(BLT_WITH_GRAPHICS PRIVATE -fsanitize=thread) - target_link_options(BLT_WITH_GRAPHICS PRIVATE -fsanitize=thread) + target_compile_options(${PROJECT_NAME} PRIVATE -fsanitize=thread) + target_link_options(${PROJECT_NAME} PRIVATE -fsanitize=thread) endif () if (${BUILD_GRAPHICS_TESTS}) @@ -80,26 +81,54 @@ if (${BUILD_GRAPHICS_TESTS}) target_link_libraries(BLT_GRAPHICS_TESTS BLT_WITH_GRAPHICS) - target_compile_options(BLT_GRAPHICS_TESTS PRIVATE -Wall -Wpedantic -Wno-comment -Wno-strict-aliasing) - target_link_options(BLT_GRAPHICS_TESTS PRIVATE -Wall -Wpedantic -Wno-comment -Wno-strict-aliasing -Wno-unused-function) + target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wpedantic -Wno-comment -Wno-strict-aliasing) + target_link_options(${PROJECT_NAME} PRIVATE -Wall -Wpedantic -Wno-comment -Wno-strict-aliasing -Wno-unused-function) if (${ENABLE_ADDRSAN} MATCHES ON) - target_compile_options(BLT_GRAPHICS_TESTS PRIVATE -fsanitize=address) - target_link_options(BLT_GRAPHICS_TESTS PRIVATE -fsanitize=address) + target_compile_options(${PROJECT_NAME} PRIVATE -fsanitize=address) + target_link_options(${PROJECT_NAME} PRIVATE -fsanitize=address) endif () if (${ENABLE_UBSAN} MATCHES ON) - target_compile_options(BLT_GRAPHICS_TESTS PRIVATE -fsanitize=undefined) - target_link_options(BLT_GRAPHICS_TESTS PRIVATE -fsanitize=undefined) + target_compile_options(${PROJECT_NAME} PRIVATE -fsanitize=undefined) + target_link_options(${PROJECT_NAME} PRIVATE -fsanitize=undefined) endif () if (${ENABLE_TSAN} MATCHES ON) - target_compile_options(BLT_GRAPHICS_TESTS PRIVATE -fsanitize=thread) - target_link_options(BLT_GRAPHICS_TESTS PRIVATE -fsanitize=thread) + target_compile_options(${PROJECT_NAME} PRIVATE -fsanitize=thread) + target_link_options(${PROJECT_NAME} PRIVATE -fsanitize=thread) endif () message("Built graphics tests") endif () +if (${BUILD_EXAMPLE_BASIC}) + message("Building examples/basic") + project(BLT_GRAPHICS_EXAMPLE_BASIC VERSION 1.0.0) + + add_executable(BLT_GRAPHICS_EXAMPLE_BASIC ${CMAKE_CURRENT_SOURCE_DIR}/examples/basic/basic.cpp) + + target_link_libraries(${PROJECT_NAME} BLT_WITH_GRAPHICS) + + target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wpedantic -Wno-comment -Wno-strict-aliasing) + target_link_options(${PROJECT_NAME} PRIVATE -Wall -Wpedantic -Wno-comment -Wno-strict-aliasing -Wno-unused-function) + + if (${ENABLE_ADDRSAN} MATCHES ON) + target_compile_options(${PROJECT_NAME} PRIVATE -fsanitize=address) + target_link_options(${PROJECT_NAME} PRIVATE -fsanitize=address) + endif () + + if (${ENABLE_UBSAN} MATCHES ON) + target_compile_options(${PROJECT_NAME} PRIVATE -fsanitize=undefined) + target_link_options(${PROJECT_NAME} PRIVATE -fsanitize=undefined) + endif () + + if (${ENABLE_TSAN} MATCHES ON) + target_compile_options(${PROJECT_NAME} PRIVATE -fsanitize=thread) + target_link_options(${PROJECT_NAME} PRIVATE -fsanitize=thread) + endif () + message("Built examples/basic") +endif () + project(BLT_WITH_GRAPHICS) if (EMSCRIPTEN) diff --git a/commit.py b/commit.py new file mode 100755 index 0000000..73f2b33 --- /dev/null +++ b/commit.py @@ -0,0 +1,86 @@ +#!/usr/bin/python3 + +import subprocess + +#--------------------------------------- +# CONFIG +#--------------------------------------- + +VERSION_BEGIN_STR = "set(BLT_GRAPHICS_VERSION " +VERSION_END_STR = ")" +PATCH_LIMIT = 100000 + +#--------------------------------------- +# DO NOT TOUCH +#--------------------------------------- + +def load_cmake(): + cmake_file = open("CMakeLists.txt", 'r') + cmake_text = cmake_file.read() + cmake_file.close() + return cmake_text + +def write_cmake(cmake_text): + cmake_file = open("CMakeLists.txt", 'w') + cmake_file.write(cmake_text) + cmake_file.close() + +def get_version(cmake_text): + begin = cmake_text.find(VERSION_BEGIN_STR) + len(VERSION_BEGIN_STR) + end = cmake_text.find(VERSION_END_STR, begin) + return (cmake_text[begin:end], begin, end) + +def split_version(cmake_text): + version, begin, end = get_version(cmake_text) + version_parts = version.split('.') + return (version_parts, begin, end) + +def recombine(cmake_text, version_parts, begin, end): + constructed_version = version_parts[0] + '.' + version_parts[1] + '.' + version_parts[2] + constructed_text_begin = cmake_text[0:begin] + constrcuted_text_end = cmake_text[end::] + return constructed_text_begin + constructed_version + constrcuted_text_end + + +def inc_major(cmake_text): + version_parts, begin, end = split_version(cmake_text) + version_parts[0] = str(int(version_parts[0]) + 1) + version_parts[1] = '0' + version_parts[2] = '0' + return recombine(cmake_text, version_parts, begin, end) + +def inc_minor(cmake_text): + version_parts, begin, end = split_version(cmake_text) + version_parts[1] = str(int(version_parts[1]) + 1) + version_parts[2] = '0' + return recombine(cmake_text, version_parts, begin, end) + +def inc_patch(cmake_text): + version_parts, begin, end = split_version(cmake_text) + if int(version_parts[2]) + 1 >= PATCH_LIMIT: + return inc_minor(cmake_text) + version_parts[2] = str(int(version_parts[2]) + 1) + return recombine(cmake_text, version_parts, begin, end) + +cmake_text = load_cmake() +cmake_version = get_version(cmake_text)[0] +print(f"Current Version: {cmake_version}") + +try: + type = input("What kind of commit is this ((M)ajor, (m)inor, (p)atch)? ") + + if type.startswith('M'): + print("Selected major") + write_cmake(inc_major(cmake_text)) + elif type.startswith('m'): + print("Selected minor") + write_cmake(inc_minor(cmake_text)) + elif type.startswith('p') or type.startswith('P') or len(type) == 0: + print("Selected patch") + write_cmake(inc_patch(cmake_text)) + + subprocess.call(["git", "add", "*"]) + subprocess.call(["git", "commit"]) + subprocess.call(["sh", "-c", "git remote | xargs -L1 git push --all"]) +except KeyboardInterrupt: + print("\nCancelling!") diff --git a/commit.sh b/commit.sh deleted file mode 100755 index 0471948..0000000 --- a/commit.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -git add * -git commit -git push -u origin main diff --git a/libraries/BLT b/libraries/BLT index 9950fd3..0ec0548 160000 --- a/libraries/BLT +++ b/libraries/BLT @@ -1 +1 @@ -Subproject commit 9950fd3c94d2fd52e6f953bfd188962e16e55a08 +Subproject commit 0ec0548661bbacbe7849b37c4019693dbfb47279 diff --git a/libraries/imgui b/libraries/imgui index 96839b4..a1b0682 160000 --- a/libraries/imgui +++ b/libraries/imgui @@ -1 +1 @@ -Subproject commit 96839b445e32e46d87a44fd43a9cdd60c806f7e1 +Subproject commit a1b06823fe2d964a62fda99385499b218cf5cea5 diff --git a/libraries/openal-soft b/libraries/openal-soft index 700b4dc..6675317 160000 --- a/libraries/openal-soft +++ b/libraries/openal-soft @@ -1 +1 @@ -Subproject commit 700b4dcf03b34da0ff37a079555359ca6deb840d +Subproject commit 6675317107257c2cc16c947b359d557821d85bf2