fix .so placement and loading paths
This commit is contained in:
		| @@ -122,7 +122,8 @@ function(give_options target) | ||||
|                         -ffp-contract=fast | ||||
|                         -fno-signed-zeros | ||||
|                         -fno-trapping-math | ||||
|                         -freciprocal-math) | ||||
|                         -freciprocal-math | ||||
|                         -Wl,$<$<BOOL:${TOWNENGINE_HOT_RELOAD}>:-rpath ./>) | ||||
|  | ||||
|                 set(BUILD_FLAGS_RELEASE | ||||
|                         -O3 | ||||
| @@ -204,7 +205,12 @@ function(use_townengine target sources output_directory) | ||||
|                 give_options(${target}_shared) | ||||
|                 include_deps(${target}_shared) | ||||
|                 target_link_libraries(${target}_shared PUBLIC SDL2::SDL2) | ||||
|                 add_executable(${target} ${CMAKE_SOURCE_DIR}/townengine/null.c) | ||||
|                 add_executable(${target} ${TOWNENGINE_DIR}/townengine/null.c) | ||||
|                                 set_target_properties(${target}_shared PROPERTIES | ||||
|                                                        OUTPUT_NAME game | ||||
|                                                        LIBRARY_OUTPUT_DIRECTORY ${output_directory}) | ||||
|                 set_target_properties(${TOWNENGINE_TARGET} PROPERTIES | ||||
|                                                        LIBRARY_OUTPUT_DIRECTORY ${output_directory}) | ||||
|         else () | ||||
|                 add_executable(${target} ${sources}) | ||||
|         endif () | ||||
|   | ||||
| @@ -13,10 +13,7 @@ endif() | ||||
|  | ||||
| set(SOURCE_FILES | ||||
|         game.c | ||||
|         state.h | ||||
| ) | ||||
|  | ||||
| use_townengine(${PROJECT_NAME} "${SOURCE_FILES}") | ||||
|  | ||||
| set_target_properties(${PROJECT_NAME} PROPERTIES | ||||
|         RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||||
| ) | ||||
| use_townengine(${PROJECT_NAME} "${SOURCE_FILES}" ${CMAKE_CURRENT_SOURCE_DIR}) | ||||
|   | ||||
| @@ -4,7 +4,7 @@ | ||||
| #include <malloc.h> | ||||
|  | ||||
|  | ||||
| void game_tick(t_ctx *ctx) { | ||||
| void game_tick(void) { | ||||
|     /* do state initialization when engine asks for it */ | ||||
|     /* it could happen multiple times per application run, as game code is reloadable */ | ||||
|     if (ctx.initialization_needed) { | ||||
|   | ||||
| @@ -25,7 +25,7 @@ | ||||
| #include <dlfcn.h> | ||||
|  | ||||
| #ifdef __linux__ | ||||
|     #define GAME_OBJECT_PATH "../apps/testgame/libgame.so" | ||||
|     #define GAME_OBJECT_PATH "./libgame.so" | ||||
| #else | ||||
|     #define GAME_OBJECT_PATH "game.dll" | ||||
| #endif | ||||
|   | ||||
		Reference in New Issue
	
	Block a user