# HG changeset patch # User koda # Date 1355828657 -3600 # Node ID bc18481dca8bfdc8ac04993b62a160d5d8c10174 # Parent a98c349bc06b563184d4507ee44407f2d4e78298 can use engine as library on windows too diff -r a98c349bc06b -r bc18481dca8b QTfrontend/CMakeLists.txt --- a/QTfrontend/CMakeLists.txt Tue Dec 18 03:07:45 2012 +0100 +++ b/QTfrontend/CMakeLists.txt Tue Dec 18 12:04:17 2012 +0100 @@ -138,7 +138,12 @@ if(BUILD_ENGINE_LIBRARY) add_definitions(-DHWLIBRARY) - set(HW_LINK_LIBS hwengine ${HW_LINK_LIBS}) + if (WIN32) + set (hwlibname ${EXECUTABLE_OUTPUT_PATH}/hwLibrary.dll) + else (WIN32) + set (hwlibname hwengine) + endif (WIN32) + set(HW_LINK_LIBS ${hwlibname} ${HW_LINK_LIBS}) link_directories(${EXECUTABLE_OUTPUT_PATH}) endif() diff -r a98c349bc06b -r bc18481dca8b hedgewars/CMakeLists.txt --- a/hedgewars/CMakeLists.txt Tue Dec 18 03:07:45 2012 +0100 +++ b/hedgewars/CMakeLists.txt Tue Dec 18 12:04:17 2012 +0100 @@ -10,7 +10,7 @@ #SOURCE AND PROGRAMS SECTION set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwengine.pas) -set(engine_output_name "hwengine") +set(engine_output_name "hwengine${CMAKE_EXECUTABLE_SUFFIX}") if (APPLE) set(required_fpc_version 2.6) @@ -86,7 +86,7 @@ ) if(BUILD_ENGINE_LIBRARY) - message(STATUS "Engine will be built as library (experimental)") + message(WARNING "Engine will be built as library (experimental)") set(hwengine_project ${hedgewars_SOURCE_DIR}/hedgewars/hwLibrary.pas) set(pascal_flags "-dHWLIBRARY" ${pascal_flags}) @@ -96,13 +96,22 @@ endif(CMAKE_SIZEOF_VOID_P MATCHES "8") # due to compiler/linker issues on Max OS X 10.6 -k-no_order_inits is needed to avoid linking fail - if(APPLE AND current_macosx_version GREATER "10.5") + if(APPLE AND current_macosx_version VERSION_GREATER "10.5") set(pascal_flags "-k-no_order_inits" ${pascal_flags}) endif() - if(APPLE) - set(engine_output_name "libhwengine.dylib") - endif (APPLE) + 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) @@ -204,7 +213,7 @@ if(NOT APPLE) #here is the command for standard executables or for shared library - add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}" + add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}" COMMAND "${FPC_EXECUTABLE}" ARGS ${fpc_flags} MAIN_DEPENDENCY ${hwengine_project} @@ -231,7 +240,7 @@ endif() -add_custom_target(${engine_output_name} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}") +add_custom_target(${engine_output_name} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}") #when system Lua is not found we need to compile it before engine if(NOT LUA_FOUND) @@ -252,4 +261,4 @@ add_dependencies(${engine_output_name} ENGINECLEAN) endif() -install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir}) +install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}" DESTINATION ${target_dir})