Open neoxic opened 8 years ago
Please also note that the following directives in CMakeLists.txt
complicate matters when one wants to build in a directory separate from the source which happens a lot when using CMake.
# creates library in the parent directory
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../)
Hey @neoxic,
Sorry for a late reply. We're only really supporting Lua 5.2 and 5.1 (as stated in README). Lua 5.3 was added as a request, but I'm afraid I'm not fully committed to supporting it yet. It looks like your stdout shows:
Found Lua: /usr/lib64/liblua5.1.so
. If you have Lua 5.1, as far as I'm concerned that can't be 64 bit. I'll be on the lookout for the Lua community to move towards 64 bit, but as far as I'm concerned 32 bit is here to stay. I'm forcing a 32-bit build in the CMake build system in attempts to move forward with #47, since Corona Labs uses 5.1. CMake is a secondary build system here. LuaRocks is the one we've decided to be the main and true build system.
Changing the directory output for CMake is to emulate that of LuaRocks. I'm afraid it isn't ideal in your case, but when someone really wants to compile mongorover with some other stuff I'll be happy to address that. If you're trying to do just that, let's talk.
Chris, I personally fail to see how you connect two unrelated issues together and "solve" them by enforcing a 32-bit build.
First, it seems that Corona (I'm not familiar with that thing) might be 32-bit itself and therefore it fails to load the module compiled in a 64-bit system by default. There's no problem to externally compile your module into a 32-bit library. Using CMake one can achieve that by running:
cmake -D CMAKE_C_FLAGS=-m32 /path/to/source
With luarocks, one can do the same by running a 32-bit chroot or building in a 32-bit system.
I don't see why this should be your problem how one tries to fit your library into their environment. I also fail to see why you should prevent everybody else to build your module into a 64-bit library. Lua 5.1 as well as all higher versions can be 64-bit without any restrictions.
Second, that's fine if you use CMake to emulate luarocks. My point was that it can be done without artificial complexities. For instance, in order to install the library, you can use:
install(TARGETS mongo_module DESTINATION lib/lua/5.1)
and then run on Linux:
cmake -D CMAKE_INSTALL_PREFIX=/usr /path/to/source
make install
to install it into Lua 5.1 (just as an example).
Please see my project (https://github.com/neoxic/lua-amf3) which is a Lua 5.1 library as an example.
Please consider the following output:
What's the purpose behind forcing a 32-bit build in
CMakeLists.txt
with-m32
flags?