From 9d49bc5f69b8fd8f2b84178e9ab8bb3a1de22df8 Mon Sep 17 00:00:00 2001 From: Jonathan Hoffstadt Date: Mon, 16 Dec 2024 13:33:20 -0600 Subject: [PATCH] refac: remove script "d" appending for debug --- .github/workflows/build.yml | 6 +++--- extensions/pl_draw_backend_ext.c | 3 +-- extensions/pl_ecs_ext.c | 2 +- extensions/pl_script_camera.c | 15 ++------------- sandbox/app.c | 6 +----- scripts/gen_dev.py | 7 +------ scripts/package.py | 15 ++++----------- src/build_linux.sh | 6 +++--- src/build_macos.sh | 6 +++--- src/build_win32.bat | 8 ++++---- 10 files changed, 23 insertions(+), 51 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 70c757a7..eef1be9c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -65,7 +65,7 @@ jobs: if not exist ../out/example_9.dll exit 1 if not exist ../out/pilot_light.exe exit 1 if not exist ../out/pl_unity_ext.dll exit 1 - if not exist ../out/pl_script_camerad.dll exit 1 + if not exist ../out/pl_script_camera.dll exit 1 cd .. - name: Prep 2 @@ -188,7 +188,7 @@ jobs: test -f ./out/example_8.dylib || exit 1 test -f ./out/example_9.dylib || exit 1 test -f ./out/pl_unity_ext.dylib || exit 1 - test -f ./out/pl_script_camerad.dylib || exit 1 + test -f ./out/pl_script_camera.dylib || exit 1 - name: Prep 2 run: | @@ -325,7 +325,7 @@ jobs: test -f ./out/example_8.so || exit 1 test -f ./out/example_9.so || exit 1 test -f ./out/pl_unity_ext.so || exit 1 - test -f ./out/pl_script_camerad.so || exit 1 + test -f ./out/pl_script_camera.so || exit 1 - name: Prep 2 run: | diff --git a/extensions/pl_draw_backend_ext.c b/extensions/pl_draw_backend_ext.c index 300ebd2f..4fedcdd5 100644 --- a/extensions/pl_draw_backend_ext.c +++ b/extensions/pl_draw_backend_ext.c @@ -195,8 +195,7 @@ pl_cleanup_draw_backend(void) gptGfx->destroy_buffer(ptDevice, gptDrawBackendCtx->atBufferInfo[i].tVertexBuffer); gptGfx->destroy_buffer(ptDevice, gptDrawBackendCtx->at3DBufferInfo[i].tVertexBuffer); gptGfx->destroy_buffer(ptDevice, gptDrawBackendCtx->atLineBufferInfo[i].tVertexBuffer); - gptGfx->destroy_buffer(ptDevice, gptDrawBackendCtx->atIndexBuffer[i]); - gptGfx->destroy_buffer(ptDevice, gptDrawBackendCtx->atIndexBuffer[i]); + gptGfx->destroy_buffer(ptDevice, gptDrawBackendCtx->atIndexBuffer[i]); } gptGfx->cleanup_bind_group_pool(gptDrawBackendCtx->ptBindGroupPool); diff --git a/extensions/pl_ecs_ext.c b/extensions/pl_ecs_ext.c index d42e5320..1da7f779 100644 --- a/extensions/pl_ecs_ext.c +++ b/extensions/pl_ecs_ext.c @@ -332,7 +332,7 @@ pl_ecs_remove_entity(plComponentLibrary* ptLibrary, plEntity tEntity) { plEntity tLastEntity = pl_sb_back(ptLibrary->_ptManagers[i]->sbtEntities); pl_hm_remove(ptLibrary->_ptManagers[i]->ptHashmap, tLastEntity.uIndex); - pl_hm_get_free_index(ptLibrary->_ptManagers[i]->ptHashmap); // burn slot + uint64_t _unUsed = pl_hm_get_free_index(ptLibrary->_ptManagers[i]->ptHashmap); // burn slot pl_hm_insert(ptLibrary->_ptManagers[i]->ptHashmap, tLastEntity.uIndex, uEntityValue); } diff --git a/extensions/pl_script_camera.c b/extensions/pl_script_camera.c index f534a020..d15713ff 100644 --- a/extensions/pl_script_camera.c +++ b/extensions/pl_script_camera.c @@ -93,12 +93,7 @@ pl_load_script(plApiRegistryI* ptApiRegistry, bool bReload) .run = pl_script_run }; - #ifdef PL_CONFIG_DEBUG - ptApiRegistry->set_api("pl_script_camerad", plScriptI_version, &tApi, sizeof(plScriptI)); - #endif - #ifdef PL_CONFIG_RELEASE - ptApiRegistry->set_api("pl_script_camera", plScriptI_version, &tApi, sizeof(plScriptI)); - #endif + ptApiRegistry->set_api("pl_script_camera", plScriptI_version, &tApi, sizeof(plScriptI)); } PL_EXPORT void @@ -108,12 +103,6 @@ pl_unload_script(plApiRegistryI* ptApiRegistry, bool bReload) if(bReload) return; - - #ifdef PL_CONFIG_DEBUG - const plScriptI* ptApi = ptApiRegistry->get_api("pl_script_camerad", plScriptI_version); - #endif - #ifdef PL_CONFIG_RELEASE - const plScriptI* ptApi = ptApiRegistry->get_api("pl_script_camera", plScriptI_version); - #endif + const plScriptI* ptApi = ptApiRegistry->get_api("pl_script_camera", plScriptI_version); ptApiRegistry->remove_api(ptApi); } diff --git a/sandbox/app.c b/sandbox/app.c index be71d486..c6e104c4 100644 --- a/sandbox/app.c +++ b/sandbox/app.c @@ -183,11 +183,7 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plEditorData* ptEditorData) ptEditorData->tMainCamera = gptEcs->create_perspective_camera(ptMainComponentLibrary, "main camera", (plVec3){-9.6f, 2.096f, 0.86f}, PL_PI_3, ptIO->tMainViewportSize.x / ptIO->tMainViewportSize.y, 0.1f, 48.0f, &ptMainCamera); gptCamera->set_pitch_yaw(ptMainCamera, -0.245f, 1.816f); gptCamera->update(ptMainCamera); - #ifdef PL_CONFIG_DEBUG - gptEcs->attach_script(ptMainComponentLibrary, "pl_script_camerad", PL_SCRIPT_FLAG_PLAYING, ptEditorData->tMainCamera, NULL); - #else - gptEcs->attach_script(ptMainComponentLibrary, "pl_script_camera", PL_SCRIPT_FLAG_PLAYING, ptEditorData->tMainCamera, NULL); - #endif + gptEcs->attach_script(ptMainComponentLibrary, "pl_script_camera", PL_SCRIPT_FLAG_PLAYING, ptEditorData->tMainCamera, NULL); // create cull camera plCameraComponent* ptCullCamera = NULL; diff --git a/scripts/gen_dev.py b/scripts/gen_dev.py index 120fae7a..7c901a64 100644 --- a/scripts/gen_dev.py +++ b/scripts/gen_dev.py @@ -183,13 +183,12 @@ with pl.target("pl_script_camera", pl.TargetType.DYNAMIC_LIBRARY, True): pl.add_source_files("../extensions/pl_script_camera.c") + pl.set_output_binary("pl_script_camera") # default config with pl.configuration("debug"): - pl.set_output_binary("pl_script_camerad") - # win32 with pl.platform("Windows"): with pl.compiler("msvc"): @@ -208,8 +207,6 @@ # release with pl.configuration("release"): - pl.set_output_binary("pl_script_camera") - # win32 with pl.platform("Windows"): with pl.compiler("msvc"): @@ -228,8 +225,6 @@ # vulkan on macos with pl.configuration("vulkan"): - pl.set_output_binary("pl_script_camera") - # macos with pl.platform("Darwin"): with pl.compiler("clang"): diff --git a/scripts/package.py b/scripts/package.py index 2813835c..51199420 100644 --- a/scripts/package.py +++ b/scripts/package.py @@ -144,23 +144,16 @@ # copy scripts for script in scripts: if platform.system() == "Windows": - if debug_package: - shutil.move("../out/" + script + "d.dll", target_directory + "/bin/") - else: - shutil.move("../out/" + script + ".dll", target_directory + "/bin/") + shutil.move("../out/" + script + ".dll", target_directory + "/bin/") for file in glob.glob("../out/" + script + "d_*.pdb"): shutil.move(file, target_directory + "/bin/") elif platform.system() == "Darwin": + shutil.move("../out/" + script + ".dylib", target_directory + "/bin/") if debug_package: - shutil.move("../out/" + script + "d.dylib", target_directory + "/bin/") shutil.copytree("../out/" + script + "d.dylib.dSYM", target_directory + "/bin/" + script + "d.dylib.dSYM") - else: - shutil.move("../out/" + script + ".dylib", target_directory + "/bin/") + elif platform.system() == "Linux": - if debug_package: - shutil.move("../out/" + script + "d.so", target_directory + "/bin/") - else: - shutil.move("../out/" + script + ".so", target_directory + "/bin/") + shutil.move("../out/" + script + ".so", target_directory + "/bin/") # copy libs & executable if platform.system() == "Windows": diff --git a/src/build_linux.sh b/src/build_linux.sh index db80bec4..ce9016a9 100644 --- a/src/build_linux.sh +++ b/src/build_linux.sh @@ -73,8 +73,8 @@ else PL_HOT_RELOAD_STATUS=0 rm -f ../out/pl_unity_ext.so rm -f ../out/pl_unity_ext_*.so - rm -f ../out/pl_script_camerad.so - rm -f ../out/pl_script_camerad_*.so + rm -f ../out/pl_script_camera.so + rm -f ../out/pl_script_camera_*.so rm -f ../out/app.so rm -f ../out/app_*.so rm -f ../out/pilot_light @@ -127,7 +127,7 @@ echo echo ${YELLOW}Step: pl_script_camera${NC} echo ${YELLOW}~~~~~~~~~~~~~~~~~~~${NC} echo ${CYAN}Compiling and Linking...${NC} -gcc -shared $PL_SOURCES $PL_INCLUDE_DIRECTORIES $PL_DEFINES $PL_COMPILER_FLAGS $PL_INCLUDE_DIRECTORIES $PL_LINK_DIRECTORIES $PL_LINKER_FLAGS $PL_STATIC_LINK_LIBRARIES $PL_DYNAMIC_LINK_LIBRARIES -o "./../out/pl_script_camerad.so" +gcc -shared $PL_SOURCES $PL_INCLUDE_DIRECTORIES $PL_DEFINES $PL_COMPILER_FLAGS $PL_INCLUDE_DIRECTORIES $PL_LINK_DIRECTORIES $PL_LINKER_FLAGS $PL_STATIC_LINK_LIBRARIES $PL_DYNAMIC_LINK_LIBRARIES -o "./../out/pl_script_camera.so" # check build status if [ $? -ne 0 ] diff --git a/src/build_macos.sh b/src/build_macos.sh index 5e84ad49..0b5040e9 100644 --- a/src/build_macos.sh +++ b/src/build_macos.sh @@ -77,8 +77,8 @@ else PL_HOT_RELOAD_STATUS=0 rm -f ../out/pl_unity_ext.dylib rm -f ../out/pl_unity_ext_*.dylib - rm -f ../out/pl_script_camerad.dylib - rm -f ../out/pl_script_camerad_*.dylib + rm -f ../out/pl_script_camera.dylib + rm -f ../out/pl_script_camera_*.dylib rm -f ../out/app.dylib rm -f ../out/app_*.dylib rm -f ../out/pilot_light @@ -146,7 +146,7 @@ echo echo ${YELLOW}Step: pl_script_camera${NC} echo ${YELLOW}~~~~~~~~~~~~~~~~~~~${NC} echo ${CYAN}Compiling and Linking...${NC} -clang -shared $PL_SOURCES $PL_INCLUDE_DIRECTORIES $PL_DEFINES $PL_COMPILER_FLAGS $PL_INCLUDE_DIRECTORIES $PL_LINK_DIRECTORIES $PL_LINKER_FLAGS $PL_STATIC_LINK_LIBRARIES $PL_DYNAMIC_LINK_LIBRARIES $PL_LINK_FRAMEWORKS -o "./../out/pl_script_camerad.dylib" +clang -shared $PL_SOURCES $PL_INCLUDE_DIRECTORIES $PL_DEFINES $PL_COMPILER_FLAGS $PL_INCLUDE_DIRECTORIES $PL_LINK_DIRECTORIES $PL_LINKER_FLAGS $PL_STATIC_LINK_LIBRARIES $PL_DYNAMIC_LINK_LIBRARIES $PL_LINK_FRAMEWORKS -o "./../out/pl_script_camera.dylib" # check build status if [ $? -ne 0 ] diff --git a/src/build_win32.bat b/src/build_win32.bat index 270ef91d..e53339ae 100644 --- a/src/build_win32.bat +++ b/src/build_win32.bat @@ -76,9 +76,9 @@ @if exist "../out/pl_unity_ext.dll" del "..\out\pl_unity_ext.dll" @if exist "../out/pl_unity_ext_*.dll" del "..\out\pl_unity_ext_*.dll" @if exist "../out/pl_unity_ext_*.pdb" del "..\out\pl_unity_ext_*.pdb" - @if exist "../out/pl_script_camerad.dll" del "..\out\pl_script_camerad.dll" - @if exist "../out/pl_script_camerad_*.dll" del "..\out\pl_script_camerad_*.dll" - @if exist "../out/pl_script_camerad_*.pdb" del "..\out\pl_script_camerad_*.pdb" + @if exist "../out/pl_script_camera.dll" del "..\out\pl_script_camera.dll" + @if exist "../out/pl_script_camera_*.dll" del "..\out\pl_script_camera_*.dll" + @if exist "../out/pl_script_camera_*.pdb" del "..\out\pl_script_camera_*.pdb" @if exist "../out/app.dll" del "..\out\app.dll" @if exist "../out/app_*.dll" del "..\out\app_*.dll" @if exist "../out/app_*.pdb" del "..\out\app_*.pdb" @@ -132,7 +132,7 @@ cl %PL_INCLUDE_DIRECTORIES% %PL_DEFINES% %PL_COMPILER_FLAGS% %PL_SOURCES% -Fe".. @echo Step: pl_script_camera @echo ~~~~~~~~~~~~~~~~~~~~~~ @echo Compiling and Linking... -cl %PL_INCLUDE_DIRECTORIES% %PL_DEFINES% %PL_COMPILER_FLAGS% %PL_SOURCES% -Fe"../out/pl_script_camerad.dll" -Fo"../out/" -LD -link %PL_LINKER_FLAGS% -PDB:"../out/pl_script_camerad_%random%.pdb" %PL_LINK_DIRECTORIES% +cl %PL_INCLUDE_DIRECTORIES% %PL_DEFINES% %PL_COMPILER_FLAGS% %PL_SOURCES% -Fe"../out/pl_script_camera.dll" -Fo"../out/" -LD -link %PL_LINKER_FLAGS% -PDB:"../out/pl_script_camera_%random%.pdb" %PL_LINK_DIRECTORIES% :: check build status @set PL_BUILD_STATUS=%ERRORLEVEL%