Fix emscripten compilation;
@@ -2,9 +2,7 @@ cmake_minimum_required(VERSION 3.0.0)
project(lovr)
# Setup
-if(UNIX)
- find_package(PkgConfig REQUIRED)
-elseif(EMSCRIPTEN)
+if(EMSCRIPTEN)
set(CMAKE_EXECUTABLE_SUFFIX ".html")
add_definitions(-O3)
add_definitions(-s USE_ZLIB=1)
@@ -14,6 +12,8 @@ elseif(EMSCRIPTEN)
add_definitions(-s NO_EXIT_RUNTIME=1)
add_definitions(-s TOTAL_MEMORY=134217728)
include_directories("${EMSCRIPTEN_ROOT_PATH}/tests/zlib")
+elseif(UNIX)
+ find_package(PkgConfig REQUIRED)
endif()
# Assimp
@@ -43,7 +43,7 @@ endif()
# FreeType
if (EMSCRIPTEN)
- add_definitions(-s USE_FREETYPE=1)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s USE_FREETYPE=1")
elseif (WIN32)
set(FREETYPE_NO_DIST TRUE CACHE BOOL "")
set(BUILD_SHARED_LIBS OFF)
@@ -62,7 +62,7 @@ set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "")
set(GLFW_BUILD_TESTS OFF CACHE BOOL "")
set(GLFW_BUILD_DOCS OFF CACHE BOOL "")
if(EMSCRIPTEN)
- add_definitions(-s USE_GLFW=3)
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_GLFW=3")
elseif(WIN32)
add_subdirectory(deps/glfw glfw)
include_directories(deps/glfw/include)
@@ -161,7 +161,12 @@ set(PHYSFS_ARCHIVE_MVL OFF CACHE BOOL "")
set(PHYSFS_ARCHIVE_QPAK OFF CACHE BOOL "")
set(PHYSFS_BUILD_TEST OFF CACHE BOOL "")
set(PHYSFS_BUILD_WX_TEST FALSE CACHE BOOL "")
-if(EMSCRIPTEN OR WIN32)
+if(EMSCRIPTEN)
+ option(PHYSFS_ARCHIVE_ZIP OFF)
+ add_subdirectory(deps/physfs physfs)
+ include_directories(deps/physfs)
+ set(LOVR_PHYSFS physfs)
+elseif(WIN32)
add_subdirectory(deps/physfs physfs)
include_directories(deps/physfs)
set(LOVR_PHYSFS physfs)
