Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
I'd like to move to CMake on Windows, too. I'm exploring the options of the easiest transition options. I think I might cook up a quick script that would call cmake with the appropriate generator and create the bindings files.
In the meantime, can someone with Windows try the CMake approach manually, to verify that it works for them, too? STR? Tigerw? The basic instructions are: Clone a fresh new repo to a new folder, download and install cmake, make sure it's available system-wide by setting it in the PATH variable, then run "cmake ." in the repo root. CMake should build a solution file at the repo root, open that with VS and try compiling.
Posts: 4,635
Threads: 115
Joined: Dec 2011
Thanks: 695
Given 495 thank(s) in 424 post(s)
01-12-2014, 08:36 PM
(This post was last modified: 01-12-2014, 08:49 PM by NiLSPACE.)
I'm cloning now.
CMake is building.
VS 2008 is compiling.
Bindings didn't generate. I'l have to do that myself first.
Error: Code: 1>------ Build started: Project: MCServer, Configuration: Debug Win32 ------
1>Compiling...
1>LuaState.cpp
1>Compiling manifest to resources...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Linking...
1> Creating library G:\MCServer\CMake\MCServer\MCServer\Debug\..\MCServer_debug.lib and object G:\MCServer\CMake\MCServer\MCServer\Debug\..\MCServer_debug.exp
1>LuaState.obj : error LNK2019: unresolved external symbol "int __cdecl tolua_AllToLua_open(struct lua_State *)" (?tolua_AllToLua_open@@YAHPAUlua_State@@@Z) referenced in function "public: void __thiscall cLuaState::Create(void)" (?Create@cLuaState@@QAEXXZ)
1>G:\MCServer\CMake\MCServer\MCServer\Debug\..\MCServer_debug.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://g:\MCServer\CMake\MCServer\src\MCServer.dir\Debug\BuildLog.htm"
1>MCServer - 2 error(s), 0 warning(s)
2>------ Skipped Build: Project: ALL_BUILD, Configuration: Debug Win32 ------
2>Project not selected to build for this solution configuration
========== Build: 0 succeeded, 1 failed, 12 up-to-date, 1 skipped ==========
Buildlog:
BuildLog.htm (Size: 26.64 KB / Downloads: 365)
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
Hm, the windows version of the CMake script requires that Bindings are generated before running CMake. I'll try to fix that.
Posts: 953
Threads: 16
Joined: May 2013
Thanks: 67
Given 106 thank(s) in 90 post(s)
I reported this too with your windows cmake PR
Posts: 4,635
Threads: 115
Joined: Dec 2011
Thanks: 695
Given 495 thank(s) in 424 post(s)
Also it seems it doesn't compile Lua (or it doesn't compile it as an dll).
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
Yes, but that was older code. I was hoping to have fixed this.
Apparently it is impossible to do right now, so we'll have to stick to the manual way - first generate bindings, then run CMake.
STR, can you delete your $/CMakeCache.txt file, run $/src/Bindings/AllToLua.bat and then try CMake again?
Posts: 4,635
Threads: 115
Joined: Dec 2011
Thanks: 695
Given 495 thank(s) in 424 post(s)
01-12-2014, 09:34 PM
(This post was last modified: 01-12-2014, 09:57 PM by NiLSPACE.)
Yes it compiles fine when I do that.
But I can't start the server because lua.dll is missing.
the lua.dll is compiled in $lib/lua/<MODE>
Should be fixed when you add Quote:set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/MCServer")
in the lua CMakeList.txt in the if (WIN32).
Posts: 783
Threads: 12
Joined: Jan 2014
Thanks: 2
Given 73 thank(s) in 61 post(s)
(01-12-2014, 09:32 PM)xoft Wrote: Yes, but that was older code. I was hoping to have fixed this.
Apparently it is impossible to do right now, so we'll have to stick to the manual way - first generate bindings, then run CMake.
STR, can you delete your $/CMakeCache.txt file, run $/src/Bindings/AllToLua.bat and then try CMake again?
One option have just discovered is to have cmake run tolua++ during configure time using execute_process(). You would then need to rerun cmake every time you changed the bindings but its a little simpler for those not working on bindings.
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
01-12-2014, 11:26 PM
(This post was last modified: 01-12-2014, 11:45 PM by xoft.)
(01-12-2014, 10:27 PM)worktycho Wrote: One option have just discovered is to have cmake run tolua++ during configure time using execute_process().
I'm trying that right now, but am having trouble - the command is not executed.
I currently have this code in the "MSVC" branch of $/src/CMakeLists.txt:
Code: if (NOT EXISTS "${PROJECT_SOURCE_DIR}/src/Bindings/Bindings.cpp")
message("Bindings.cpp not found, generating now")
execute_process(
COMMAND ${PROJECT_SOURCE_DIR}/src/Bindings/tolua++.exe -L virtual_method_hooks.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg
COMMAND echo test
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src/Bindings
OUTPUT_VARIABLE ToLuaOut
ERROR_VARIABLE ToLuaErr
RESULT_VARIABLE TOLuaRes
)
message("Result:" ${ToLuaRes})
message("Output:" ${ToLuaOut})
message("Error: " ${ToLuaErr})
endif()
I get the following output, which I interpret as "no command has been run":
Code: Bindings.cpp not found, generating now
Result:
Output:
Error:
Waitaminute! When I remove the tolua++ command and leave only the echo command, it works as expected.
Ah! It works! Seems like cmake cannot concat variables for the command, so I had to put the entire tolue++.exe path into a separate variable. This seems to have done the trick:
Code: # Check the Bindings existence:
if (NOT EXISTS "${PROJECT_SOURCE_DIR}/Bindings/Bindings.cpp")
message("Bindings.cpp not found, generating now")
set(tolua_executable ${PROJECT_SOURCE_DIR}/Bindings/tolua++.exe)
execute_process(
COMMAND ${tolua_executable} -L virtual_method_hooks.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/Bindings
OUTPUT_VARIABLE ToLuaOut
ERROR_VARIABLE ToLuaErr
RESULT_VARIABLE ToLuaRes
)
endif()
Posts: 6,485
Threads: 176
Joined: Jan 2012
Thanks: 131
Given 1075 thank(s) in 852 post(s)
Okay, how about now, can you retry?
And Tigerw, can you try with your faaavorite VS2013?
|