# HG changeset patch # User koda # Date 1355937443 -3600 # Node ID 9e8781faabab8fe0a559665c4964b1663a0e237f # Parent bc18481dca8bfdc8ac04993b62a160d5d8c10174 can compile engine as library on linux but not run the executable (automatically), most likely breaking other platforms (wrt engine-as-library) diff -r bc18481dca8b -r 9e8781faabab QTfrontend/CMakeLists.txt --- a/QTfrontend/CMakeLists.txt Tue Dec 18 12:04:17 2012 +0100 +++ b/QTfrontend/CMakeLists.txt Wed Dec 19 18:17:23 2012 +0100 @@ -138,11 +138,11 @@ if(BUILD_ENGINE_LIBRARY) add_definitions(-DHWLIBRARY) - if (WIN32) - set (hwlibname ${EXECUTABLE_OUTPUT_PATH}/hwLibrary.dll) - else (WIN32) + if (APPLE) set (hwlibname hwengine) - endif (WIN32) + else (APPLE) + set (hwlibname "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}hwLibrary${CMAKE_SHARED_LIBRARY_SUFFIX}") + endif (APPLE) set(HW_LINK_LIBS ${hwlibname} ${HW_LINK_LIBS}) link_directories(${EXECUTABLE_OUTPUT_PATH}) endif() diff -r bc18481dca8b -r 9e8781faabab hedgewars/CMakeLists.txt --- a/hedgewars/CMakeLists.txt Tue Dec 18 12:04:17 2012 +0100 +++ b/hedgewars/CMakeLists.txt Wed Dec 19 18:17:23 2012 +0100 @@ -9,8 +9,13 @@ configure_file(${hedgewars_SOURCE_DIR}/hedgewars/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc) #SOURCE AND PROGRAMS SECTION -set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwengine.pas) -set(engine_output_name "hwengine${CMAKE_EXECUTABLE_SUFFIX}") +if(${BUILD_ENGINE_LIBRARY}) + set(engine_output_name "${CMAKE_SHARED_LIBRARY_PREFIX}hwLibrary${CMAKE_SHARED_LIBRARY_SUFFIX}") + set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwLibrary.pas) +else() + set(engine_output_name "hwengine${CMAKE_EXECUTABLE_SUFFIX}") + set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwengine.pas) +endif() if (APPLE) set(required_fpc_version 2.6) @@ -87,7 +92,6 @@ if(BUILD_ENGINE_LIBRARY) message(WARNING "Engine will be built as library (experimental)") - set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwLibrary.pas) set(pascal_flags "-dHWLIBRARY" ${pascal_flags}) # create position independent code, only required for x68_64 builds, similar to -fPIC @@ -99,19 +103,6 @@ if(APPLE AND current_macosx_version VERSION_GREATER "10.5") set(pascal_flags "-k-no_order_inits" ${pascal_flags}) endif() - - if (WIN32) - # windows is silly and takes the name specified in hwLibrary.pas - set(engine_output_name "hwLibrary.dll") - #set(pascal_flags "-D" "-Dv'${HEDGEWARS_VERSION}'" "-Dd'Hedgewars engine'" ${pascal_flags}) - elseif (WIN32) - if (APPLE) - set(engine_output_name "libhwengine.dylib") - else (APPLE) - set(engine_output_name "libhwengine.so") - endif (APPLE) - endif (WIN32) - endif(BUILD_ENGINE_LIBRARY)