1
0

Merge pull request #479 from mc-server/cmake-win

Cmake-win
This commit is contained in:
Mattes D 2014-01-02 09:16:11 -08:00
commit d3dc12815b
2 changed files with 30 additions and 18 deletions

View File

@ -2,16 +2,21 @@
cmake_minimum_required (VERSION 2.6) cmake_minimum_required (VERSION 2.6)
project (MCServer) project (MCServer)
# NOTE: This CMake file is processed only for Unix builds; Windows(MSVC) builds handle all the subfolders in /src in a single file, /src/CMakeLists.txt
include_directories ("${PROJECT_SOURCE_DIR}/../") include_directories ("${PROJECT_SOURCE_DIR}/../")
ADD_CUSTOM_COMMAND( ADD_CUSTOM_COMMAND(
#add any new generated bindings here # add any new generated bindings here
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Bindings.cpp ${CMAKE_CURRENT_BINARY_DIR}/Bindings.h OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/Bindings.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Bindings.h
#command execuded to regerate bindings
COMMAND tolua -L virtual_method_hooks.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg # command execuded to regerate bindings
#add any new generation dependencies here COMMAND tolua -L virtual_method_hooks.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/virtual_method_hooks.lua ${CMAKE_CURRENT_SOURCE_DIR}/AllToLua.pkg tolua WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
# add any new generation dependencies here
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/virtual_method_hooks.lua ${CMAKE_CURRENT_SOURCE_DIR}/AllToLua.pkg tolua
)
#add cpp files here #add cpp files here
add_library(Bindings PluginManager LuaState WebPlugin Bindings ManualBindings LuaWindow Plugin PluginLua WebPlugin) add_library(Bindings PluginManager LuaState WebPlugin Bindings ManualBindings LuaWindow Plugin PluginLua WebPlugin)

View File

@ -14,7 +14,7 @@ set(FOLDERS ${FOLDERS} WorldStorage Mobs Entities Simulator UI BlockEntities)
if (NOT WIN32) if (NOT MSVC)
foreach(folder ${FOLDERS}) foreach(folder ${FOLDERS})
add_subdirectory(${folder}) add_subdirectory(${folder})
endforeach(folder) endforeach(folder)
@ -62,18 +62,25 @@ else ()
endif() endif()
if (UNIX) set(EXECUTABLE MCServer)
set(EXECUTABLE ../MCServer/MCServer)
else ()
set(EXECUTABLE MCServer)
endif ()
add_executable(${EXECUTABLE} ${SOURCE}) add_executable(${EXECUTABLE} ${SOURCE})
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/MCServer)
if (MSVC)
# MSVC generator adds a "Debug" or "Release" postfixes to the EXECUTABLE_OUTPUT_PATH, we need to cancel them:
SET_TARGET_PROPERTIES(${EXECUTABLE} PROPERTIES PREFIX "../")
SET_TARGET_PROPERTIES(${EXECUTABLE} PROPERTIES IMPORT_PREFIX "../")
endif()
# Make the debug executable have a "_debug" suffix
SET_TARGET_PROPERTIES(${EXECUTABLE} PROPERTIES DEBUG_POSTFIX "_debug")
# Precompiled headers (2nd part) # Precompiled headers (2nd part)
if (WIN32) if (MSVC)
SET_TARGET_PROPERTIES( SET_TARGET_PROPERTIES(
${EXECUTABLE} PROPERTIES COMPILE_FLAGS "/Yu\"Globals.h\"" ${EXECUTABLE} PROPERTIES COMPILE_FLAGS "/Yu\"Globals.h\""
OBJECT_DEPENDS "$(IntDir)/$(TargetName.pch)" OBJECT_DEPENDS "$(IntDir)/$(TargetName.pch)"
@ -81,7 +88,7 @@ if (WIN32)
endif () endif ()
if (NOT WIN32) if (NOT MSVC)
target_link_libraries(${EXECUTABLE} OSSupport HTTPServer Bindings Items Blocks) target_link_libraries(${EXECUTABLE} OSSupport HTTPServer Bindings Items Blocks)
target_link_libraries(${EXECUTABLE} Protocol Generating WorldStorage) target_link_libraries(${EXECUTABLE} Protocol Generating WorldStorage)
target_link_libraries(${EXECUTABLE} Mobs Entities Simulator UI BlockEntities) target_link_libraries(${EXECUTABLE} Mobs Entities Simulator UI BlockEntities)