Greetings people!
I am new to both Ogre and Emscripten and I'm having trouble understanding how the compilation process works. See, I am using the official snippet provided by the Ogre team to build:
mkdir build-wasm
emcmake cmake .. -DCMAKE_BUILD_TYPE=Release
emmake make
When I do this, emcmake asks me for the ZLIB library, which I include in the CMakeLists.txt in the following way:
if(${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
set(USE_FLAGS "-s USE_ZLIB=1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${USE_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${USE_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${USE_FLAGS}")
set(CMAKE_EXECUTABLE_SUFFIX .html)
endif()
Then the compiler fails like this:
Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
I know this is not an Ogre-specific issue, but it is of my understanding that ZLIB should be ready to be used by the compiler at this point. What I am doing wrong?
Thank you in advance!
Problem compiling with WebAssembly/Emscripten (ZLIB)
-
- Gnoblar
- Posts: 1
- Joined: Thu Oct 29, 2020 6:55 pm
-
- OGRE Team Member
- Posts: 1994
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1074
- Contact:
Re: Problem compiling with WebAssembly/Emscripten (ZLIB)
as described here https://ogrecave.github.io/ogre/api/lat ... otoc_md242
Ogre should be building its own dependencies, including upstream zlib
Ogre should be building its own dependencies, including upstream zlib
-
- Gnoblar
- Posts: 1
- Joined: Thu Oct 29, 2020 6:55 pm
Re: Problem compiling with WebAssembly/Emscripten (ZLIB)
Hi! Thanks for the help, I understand now.
But tell me, how do I manage to get Ogre's dependencies compiled with the snippet provided by Ogre's WebAssembly help? Could you give me a hint about how to get each dependency compiled and linked with Ogre in order to be able to compile an Ogre project later with Emscripten? I appreciate any help because I am kinda confused about how Emscripten works.
Any link or bit of data would do to guide me in the right direction. This information is kinda hard to find by itself.
Kindest Regards!
But tell me, how do I manage to get Ogre's dependencies compiled with the snippet provided by Ogre's WebAssembly help? Could you give me a hint about how to get each dependency compiled and linked with Ogre in order to be able to compile an Ogre project later with Emscripten? I appreciate any help because I am kinda confused about how Emscripten works.
Any link or bit of data would do to guide me in the right direction. This information is kinda hard to find by itself.
Kindest Regards!
Last edited by MahBoi on Sat Oct 31, 2020 5:31 am, edited 1 time in total.
-
- OGRE Team Member
- Posts: 1994
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1074
- Contact:
Re: Problem compiling with WebAssembly/Emscripten (ZLIB)
you have to do what is done in this cmake script manually:
https://github.com/OGRECave/ogre/blob/7 ... cmake#L110
basically, Emscripten is no different to e.g. Android, where you have to compile all your dependencies yourself.
https://github.com/OGRECave/ogre/blob/7 ... cmake#L110
basically, Emscripten is no different to e.g. Android, where you have to compile all your dependencies yourself.