Skip to content

Commit

Permalink
build: update CMakeList executable from Cmake Project
Browse files Browse the repository at this point in the history
  • Loading branch information
Yann-Masson committed Mar 26, 2024
1 parent b17e39d commit 2c54d50
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
project(arcade)
add_executable(${PROJECT_NAME}
main.cpp
)
Expand Down
2 changes: 1 addition & 1 deletion core/src/exception/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
target_sources(arcade PRIVATE
target_sources(${CMAKE_PROJECT_NAME} PRIVATE
ArcadeError.cpp
)
2 changes: 1 addition & 1 deletion core/src/loader/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
target_sources(arcade PRIVATE
target_sources(${CMAKE_PROJECT_NAME} PRIVATE
DLLoader.cpp
)
10 changes: 5 additions & 5 deletions core/src/loader/DLLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "DLLoader.hpp"
#include "exception/ArcadeError.hpp"

void DLLoader::_loadError(void *handle) {
void DLLoader::_throwLoadError(void *handle) {
std::string error = dlerror();

if (this->_dir)
Expand All @@ -26,7 +26,7 @@ shared::types::LibraryType DLLoader::_getLibraryGetter(const std::string &filepa

getter = reinterpret_cast<shared::types::LibraryTypeGetter>(dlsym(handle, SHARED_STRINGIFY(SHARED_LIBRARY_TYPE_GETTER_NAME)));
if (!getter)
this->_loadError(handle);
this->_throwLoadError(handle);
return getter();
}

Expand All @@ -35,7 +35,7 @@ void DLLoader::_loadGameLibrary(const std::string &filepath, void *handle) {

game = reinterpret_cast<shared::types::GameProvider>(dlsym(handle, SHARED_STRINGIFY(SHARED_GAME_PROVIDER_LOADER_NAME)));
if (!game)
this->_loadError(handle);
this->_throwLoadError(handle);
this->_gamesLibraries.push_back(game());
}

Expand All @@ -44,7 +44,7 @@ void DLLoader::_loadGraphicsLibrary(const std::string &filepath, void *handle) {

graphics = reinterpret_cast<shared::types::GraphicsProvider>(dlsym(handle, SHARED_STRINGIFY(SHARED_GRAPHICS_PROVIDER_LOADER_NAME)));
if (!graphics)
this->_loadError(handle);
this->_throwLoadError(handle);
this->_graphicsLibraries.push_back(graphics());
}

Expand All @@ -53,7 +53,7 @@ void DLLoader::registerLibrary(const std::string &filepath) {
shared::types::LibraryType type;

if (!handle)
this->_loadError(handle);
this->_throwLoadError(handle);
dlerror();
type = this->_getLibraryGetter(filepath, handle);
if (type == shared::types::LibraryType::GAME)
Expand Down
2 changes: 1 addition & 1 deletion core/src/loader/DLLoader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ class DLLoader {
* @brief Throw an error when loading a library
* @param handle handle pointer to the library
*/
void _loadError(void *handle);
void _throwLoadError(void *handle);
};

0 comments on commit 2c54d50

Please sign in to comment.