Skip to content
This repository has been archived by the owner on Sep 14, 2019. It is now read-only.

Commit

Permalink
Merge pull request #97 from Milerius/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Milerius authored Aug 4, 2018
2 parents 04568a6 + 0bda27e commit 01fe906
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 18 deletions.
20 changes: 10 additions & 10 deletions cmake/module.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ macro(CREATE_MODULE_PLUGIN ModuleAlias LibSources BuildInterfaceDirectory Output
set_property(TARGET ${RealModuleName} PROPERTY POSITION_INDEPENDENT_CODE ON)
set_target_properties(${RealModuleName}
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/${OutputDirectory}"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/${OutputDirectory}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/${OutputDirectory}"
LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_SOURCE_DIR}/bin/${OutputDirectory}"
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_SOURCE_DIR}/bin/${OutputDirectory}"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_SOURCE_DIR}/bin/${OutputDirectory}"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_SOURCE_DIR}/bin/${OutputDirectory}")
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}/${OutputDirectory}"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}/${OutputDirectory}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}/${OutputDirectory}"
LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}/${OutputDirectory}"
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}/${OutputDirectory}"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}/${OutputDirectory}"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}/${OutputDirectory}")
MSG_CYAN_BOLD(STATUS "Module" "${ModuleAlias}" "successfully created.")
endmacro()

Expand Down Expand Up @@ -84,9 +84,9 @@ macro(AUTO_TARGETS_PLUGINS_INSTALL MODULE_NAME EXPORT_NAME)
install(TARGETS
${MODULE_NAME}
EXPORT ${PROJECT_NAME}-${MODULE_NAME}-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME}/plugins/${EXPORT_NAME}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/plugins/${EXPORT_NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/plugins/${EXPORT_NAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME}/plugins/${EXPORT_NAME}/${CMAKE_BUILD_TYPE}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/plugins/${EXPORT_NAME}/${CMAKE_BUILD_TYPE}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/plugins/${EXPORT_NAME}/${CMAKE_BUILD_TYPE}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

Expand Down
2 changes: 1 addition & 1 deletion cmake/shiva-sfml-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ endmacro()

##! directory output plugins
set(SAVE_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/systems)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}/systems)

import_plugins(shiva::shiva-system-sfml-resources)

Expand Down
22 changes: 17 additions & 5 deletions modules/world/shiva/world/world.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,27 @@ namespace shiva
public:
~world() noexcept = default;

world(fs::path plugin_path = fs::current_path() /= "systems") noexcept : plugins_registry_(
#if defined(DEBUG)
world(fs::path plugin_path = fs::current_path() /= "Debug/systems") noexcept : plugins_registry_(
std::move(plugin_path))
{
#if defined(_WIN32)
SetDllDirectoryA(plugin_path.string().c_str());
#endif
{
#if defined(_WIN32)
SetDllDirectoryA(plugin_path.string().c_str());
#endif
dispatcher_.sink<shiva::event::quit_game>().connect(this);
}

#elif defined(RELEASE)
world(fs::path plugin_path = fs::current_path() /= "Release/systems") noexcept : plugins_registry_(
std::move(plugin_path))
{
#if defined(_WIN32)
SetDllDirectoryA(plugin_path.string().c_str());
#endif
dispatcher_.sink<shiva::event::quit_game>().connect(this);
}
#endif

int run() noexcept
{
if (!system_manager_.nb_systems()) {
Expand Down
7 changes: 5 additions & 2 deletions tools/game_templates/sfml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ file(GLOB_RECURSE <PROJECT_NAME>_HEADERS <project_name>/*.hpp)
add_executable(<project_name> ${<PROJECT_NAME>_SOURCES} ${<PROJECT_NAME>_HEADERS})

##! Linking
target_link_libraries(<project_name>
shiva::shiva)
##! We manualy link LUA_LIBRARIES on Windows,
##! CMake seems to have a bug on interfacing this libraries from the module shiva::lua
target_link_libraries(<project_name> PUBLIC
shiva::shiva
$<$<CXX_COMPILER_ID:MSVC>:${LUA_LIBRARIES}>)

set_target_properties(<project_name>
PROPERTIES
Expand Down

0 comments on commit 01fe906

Please sign in to comment.