Merhaba arkadaşlar,k
Bu konumuzda gtest'i kaldırmayı anlatacağım.
Srcs/Server/game/src/main.cpp dosyasında aşağıda verdiğim kodları silin.
Srcs/Server/game/src/Makefile dosyasında şu kodu aratın;
Değiştirin;
Aratın;
Değiştirin;
Aşağıda verdiğim kodları silin;
Tüm işlemler bu kadardır. Bu işlemleri tamamladıktan sonra şu komutları yazarak tekrardan build ediniz.
MaviAyGames | Metin2 Server Source GoogleTest Kaldırma
Metin2 özel sunucularında kaynak kod üzerinde çalışmak, özellikle GoogleTest gibi test kütüphaneleriyle entegre edilmiş projelerde bazı sorunlar yaratmaktadır. Bu yazıda, MaviAyGames tarafından sunulan Metin2 sunucu kaynağından GoogleTest bileşenlerinin nasıl kaldırılacağını adım adım anlatacağız.
GoogleTest Nedir?
GoogleTest, Google tarafından geliştirilen açık kaynaklı bir C++ test framework’üdür. Unit test (birim testi) yazmayı kolaylaştırmak için kullanılır. Ancak Metin2 özel sunucu geliştirme ortamında bu kütüphane bazen derleme hatalarına ya da sistemin yavaşlamasına neden olabilir. Özellikle kaynak kodun sadeleştirilmesi ve performans odaklı yapılar oluşturulması istendiğinde GoogleTest kaldırılması tercih edilebilir.
GoogleTest Kaldırmanın Gerekçeleri
1. Performans Artışı: Test framework’leri, üretim sunucusunda kullanılmadığı halde kaynak tüketebilir.
2. Derleme Hızını Artırma: GoogleTest bağımlılıklarının kaldırılması, derleme süresini kısaltabilir.
3. Kod Temizliği: Sunucu sistemlerinde sadece gerekli modüllerin bulunması, bakım kolaylığı sağlar.
GoogleTest Kaldırma Adımları
Adım 1: Kaynak Kodu Kontrol Et
Öncelikle MaviAyGames tarafından sağlanan Metin2 sunucu kaynağında GoogleTest dosyalarının konumlarını belirlemek gerekir. Genellikle bu dosyalar 'src/test', 'tests/', veya 'gtest/' gibi klasörler altında yer alır. Bu dizinleri silmeden önce yedek almanız önerilir.
Adım 2: CMakeLists.txt veya Makefile Ayarlarını Güncelle
Derleme sürecinde GoogleTest’e referans veren yapılandırmaları kaldırmak gerekir. Örneğin CMakeLists.txt dosyasında şu satırlar görünebilir:
find_package(GTest REQUIRED)
target_link_libraries(your_target gtest_main)
Bu satırları silin veya yorum haline getirin.
Adım 3: Include Dizinlerinden GoogleTest Sil
Kodun içinde GoogleTest'e ait include ifadeleri varsa, örneğin:
#include <gtest/gtest.h>
Bu satırları kaldırın ve ilgili test fonksiyonlarını devre dışı bırakın veya silin.
Adım 4: Test Fonksiyonlarını Kaldır
Sunucu kodunda test amaçlı yazılmış fonksiyonlar varsa, bunlar artık işlevsel olmayacağı için temizlenmelidir. Özellikle main.cpp veya test_entrypoint.cpp gibi dosyalarda yer alan test kodları kaldırılmalıdır.
Adım 5: Projeyi Yeniden Derle
Tüm değişiklikler yapıldıktan sonra projeyi derleyin. Herhangi bir hata oluşmaması gerekir. Eğer hata alınırsa, GoogleTest’e bağlı başka bir modül olabilir; bu durumda o modülü de gözden geçirmeniz gerekir.
GoogleTest Kaldırırken Dikkat Edilmesi Gerekenler
• Kodun bazı bölümlerinde GoogleTest bağımlılığı olabilir. Bu durumda, ilgili modülün test içermeyecek şekilde yeniden yazılması gerekir.
• Sunucu sisteminin test edilmesi için alternatif çözümler düşünülmelidir. Örneğin manuel test senaryoları hazırlanabilir.
Sonuç
GoogleTest’in Metin2 sunucu kaynağından kaldırılması, özellikle üretim sunucusu için optimize edilmiş bir yapı oluşturulmasını sağlar. Bu işlem, hem derleme sürecini hızlandırır hem de performansı artırır. Ancak dikkatli yapılmalıdır çünkü bazı modüller bu kütüphaneye bağlı olabilir. Bu rehber sayesinde MaviAyGames tarafından sunulan Metin2 sunucu kaynağını GoogleTest’ten arındırarak daha stabil ve hızlı bir yapı kurabilirsiniz.
Kaynak: Metin2 Lobby
MaviAyGames | Removing GoogleTest from Metin2 Server Source
Working on source code in Metin2 private servers can sometimes cause issues, especially when projects are integrated with testing libraries like GoogleTest. In this article, we will explain step-by-step how to remove GoogleTest components from the Metin2 server source provided by MaviAyGames.
What is GoogleTest?
GoogleTest is an open-source C++ testing framework developed by Google. It is used to simplify writing unit tests. However, in the context of Metin2 private server development, this library can sometimes cause compilation errors or slow down the system. When simplifying the source code and creating performance-focused structures, removing GoogleTest may be preferred.
Reasons for Removing GoogleTest
1. Performance Improvement: Testing frameworks may consume resources even though they are not used on production servers.
2. Increasing Compilation Speed: Removing GoogleTest dependencies can shorten compilation time.
3. Code Cleanup: Keeping only necessary modules in server systems improves maintainability.
Steps to Remove GoogleTest
Step 1: Examine the Source Code
Firstly, identify the locations of GoogleTest files in the Metin2 server source provided by MaviAyGames. These files are usually located in directories such as 'src/test', 'tests/', or 'gtest/'. Before deleting these folders, it is recommended to take backups.
Step 2: Update CMakeLists.txt or Makefile Configurations
Remove configurations that reference GoogleTest during the build process. For example, in CMakeLists.txt you might see lines like:
find_package(GTest REQUIRED)
target_link_libraries(your_target gtest_main)
Delete or comment out these lines.
Step 3: Remove GoogleTest from Include Directories
If there are include statements related to GoogleTest in the code, such as:
#include <gtest/gtest.h>
Remove these lines and disable or delete the corresponding test functions.
Step 4: Remove Test Functions
If there are functions written for testing purposes in the server code, they should be cleaned up since they will no longer serve a purpose. Particularly, test codes found in files like main.cpp or test_entrypoint.cpp should be removed.
Step 5: Rebuild the Project
After all changes have been made, compile the project. No errors should occur. If errors appear, there might be another module dependent on GoogleTest, in which case that module needs to be reviewed as well.
Things to Consider When Removing GoogleTest
• Some parts of the code may rely on GoogleTest. In such cases, the relevant modules must be rewritten to exclude tests.
• Alternative solutions should be considered for testing the server system. For example, manual test scenarios can be prepared.
Conclusion
Removing GoogleTest from the Metin2 server source helps create an optimized structure tailored for production servers. This process accelerates the compilation phase and enhances performance. However, it must be done carefully, as some modules might depend on this library. With this guide, you can remove GoogleTest from the Metin2 server source provided by MaviAyGames and establish a more stable and faster structure.
Source: Metin2 Lobby
Bu konumuzda gtest'i kaldırmayı anlatacağım.
Srcs/Server/game/src/main.cpp dosyasında aşağıda verdiğim kodları silin.
Kod:
#ifndef __WIN32__ #include <gtest/gtest.h> #endif
Kod:
#ifndef __WIN32__ // <Factor> start unit tests if option is set if ( argc > 1 ) { if ( strcmp( argv[1], "unittest" ) == 0 ) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } } #endif
Srcs/Server/game/src/Makefile dosyasında şu kodu aratın;
Kod:
LIBS += -lcryptopp -lgtest
Değiştirin;
Kod:
LIBS += -lcryptopp
Aratın;
Kod:
makedepend -f Depend $(INCDIR) -I/usr/include/c++/3.3 -I/usr/include/c++/4.2 -p$(OBJDIR)/ $(CPPFILE) $(CFILE) $(MAINCPP) $(TESTCPP) 2> /dev/null > Depend
Değiştirin;
Kod:
makedepend -f Depend $(INCDIR) -I/usr/include/c++/3.3 -I/usr/include/c++/4.2 -p$(OBJDIR)/ $(CPPFILE) $(CFILE) $(MAINCPP) 2> /dev/null > Depend
Aşağıda verdiğim kodları silin;
Kod:
TESTOBJ = $(OBJDIR)/test.o TESTCPP = test.cpp TEST_TARGET = $(BINDIR)/test
Kod:
$(TEST_TARGET): $(TESTCPP) $(CPPOBJS) $(COBJS) $(TESTOBJ) @echo linking $(TEST_TARGET) @$(CC) $(CFLAGS) $(LIBDIR) $(COBJS) $(CPPOBJS) $(TESTOBJ) $(LIBS) -o ../test
Tüm işlemler bu kadardır. Bu işlemleri tamamladıktan sonra şu komutları yazarak tekrardan build ediniz.
Kod:
gmake clean gmake dep gmake
MaviAyGames | Metin2 Server Source GoogleTest Kaldırma
Metin2 özel sunucularında kaynak kod üzerinde çalışmak, özellikle GoogleTest gibi test kütüphaneleriyle entegre edilmiş projelerde bazı sorunlar yaratmaktadır. Bu yazıda, MaviAyGames tarafından sunulan Metin2 sunucu kaynağından GoogleTest bileşenlerinin nasıl kaldırılacağını adım adım anlatacağız.
GoogleTest Nedir?
GoogleTest, Google tarafından geliştirilen açık kaynaklı bir C++ test framework’üdür. Unit test (birim testi) yazmayı kolaylaştırmak için kullanılır. Ancak Metin2 özel sunucu geliştirme ortamında bu kütüphane bazen derleme hatalarına ya da sistemin yavaşlamasına neden olabilir. Özellikle kaynak kodun sadeleştirilmesi ve performans odaklı yapılar oluşturulması istendiğinde GoogleTest kaldırılması tercih edilebilir.
GoogleTest Kaldırmanın Gerekçeleri
1. Performans Artışı: Test framework’leri, üretim sunucusunda kullanılmadığı halde kaynak tüketebilir.
2. Derleme Hızını Artırma: GoogleTest bağımlılıklarının kaldırılması, derleme süresini kısaltabilir.
3. Kod Temizliği: Sunucu sistemlerinde sadece gerekli modüllerin bulunması, bakım kolaylığı sağlar.
GoogleTest Kaldırma Adımları
Adım 1: Kaynak Kodu Kontrol Et
Öncelikle MaviAyGames tarafından sağlanan Metin2 sunucu kaynağında GoogleTest dosyalarının konumlarını belirlemek gerekir. Genellikle bu dosyalar 'src/test', 'tests/', veya 'gtest/' gibi klasörler altında yer alır. Bu dizinleri silmeden önce yedek almanız önerilir.
Adım 2: CMakeLists.txt veya Makefile Ayarlarını Güncelle
Derleme sürecinde GoogleTest’e referans veren yapılandırmaları kaldırmak gerekir. Örneğin CMakeLists.txt dosyasında şu satırlar görünebilir:
find_package(GTest REQUIRED)
target_link_libraries(your_target gtest_main)
Bu satırları silin veya yorum haline getirin.
Adım 3: Include Dizinlerinden GoogleTest Sil
Kodun içinde GoogleTest'e ait include ifadeleri varsa, örneğin:
#include <gtest/gtest.h>
Bu satırları kaldırın ve ilgili test fonksiyonlarını devre dışı bırakın veya silin.
Adım 4: Test Fonksiyonlarını Kaldır
Sunucu kodunda test amaçlı yazılmış fonksiyonlar varsa, bunlar artık işlevsel olmayacağı için temizlenmelidir. Özellikle main.cpp veya test_entrypoint.cpp gibi dosyalarda yer alan test kodları kaldırılmalıdır.
Adım 5: Projeyi Yeniden Derle
Tüm değişiklikler yapıldıktan sonra projeyi derleyin. Herhangi bir hata oluşmaması gerekir. Eğer hata alınırsa, GoogleTest’e bağlı başka bir modül olabilir; bu durumda o modülü de gözden geçirmeniz gerekir.
GoogleTest Kaldırırken Dikkat Edilmesi Gerekenler
• Kodun bazı bölümlerinde GoogleTest bağımlılığı olabilir. Bu durumda, ilgili modülün test içermeyecek şekilde yeniden yazılması gerekir.
• Sunucu sisteminin test edilmesi için alternatif çözümler düşünülmelidir. Örneğin manuel test senaryoları hazırlanabilir.
Sonuç
GoogleTest’in Metin2 sunucu kaynağından kaldırılması, özellikle üretim sunucusu için optimize edilmiş bir yapı oluşturulmasını sağlar. Bu işlem, hem derleme sürecini hızlandırır hem de performansı artırır. Ancak dikkatli yapılmalıdır çünkü bazı modüller bu kütüphaneye bağlı olabilir. Bu rehber sayesinde MaviAyGames tarafından sunulan Metin2 sunucu kaynağını GoogleTest’ten arındırarak daha stabil ve hızlı bir yapı kurabilirsiniz.
Kaynak: Metin2 Lobby
MaviAyGames | Removing GoogleTest from Metin2 Server Source
Working on source code in Metin2 private servers can sometimes cause issues, especially when projects are integrated with testing libraries like GoogleTest. In this article, we will explain step-by-step how to remove GoogleTest components from the Metin2 server source provided by MaviAyGames.
What is GoogleTest?
GoogleTest is an open-source C++ testing framework developed by Google. It is used to simplify writing unit tests. However, in the context of Metin2 private server development, this library can sometimes cause compilation errors or slow down the system. When simplifying the source code and creating performance-focused structures, removing GoogleTest may be preferred.
Reasons for Removing GoogleTest
1. Performance Improvement: Testing frameworks may consume resources even though they are not used on production servers.
2. Increasing Compilation Speed: Removing GoogleTest dependencies can shorten compilation time.
3. Code Cleanup: Keeping only necessary modules in server systems improves maintainability.
Steps to Remove GoogleTest
Step 1: Examine the Source Code
Firstly, identify the locations of GoogleTest files in the Metin2 server source provided by MaviAyGames. These files are usually located in directories such as 'src/test', 'tests/', or 'gtest/'. Before deleting these folders, it is recommended to take backups.
Step 2: Update CMakeLists.txt or Makefile Configurations
Remove configurations that reference GoogleTest during the build process. For example, in CMakeLists.txt you might see lines like:
find_package(GTest REQUIRED)
target_link_libraries(your_target gtest_main)
Delete or comment out these lines.
Step 3: Remove GoogleTest from Include Directories
If there are include statements related to GoogleTest in the code, such as:
#include <gtest/gtest.h>
Remove these lines and disable or delete the corresponding test functions.
Step 4: Remove Test Functions
If there are functions written for testing purposes in the server code, they should be cleaned up since they will no longer serve a purpose. Particularly, test codes found in files like main.cpp or test_entrypoint.cpp should be removed.
Step 5: Rebuild the Project
After all changes have been made, compile the project. No errors should occur. If errors appear, there might be another module dependent on GoogleTest, in which case that module needs to be reviewed as well.
Things to Consider When Removing GoogleTest
• Some parts of the code may rely on GoogleTest. In such cases, the relevant modules must be rewritten to exclude tests.
• Alternative solutions should be considered for testing the server system. For example, manual test scenarios can be prepared.
Conclusion
Removing GoogleTest from the Metin2 server source helps create an optimized structure tailored for production servers. This process accelerates the compilation phase and enhances performance. However, it must be done carefully, as some modules might depend on this library. With this guide, you can remove GoogleTest from the Metin2 server source provided by MaviAyGames and establish a more stable and faster structure.
Source: Metin2 Lobby
