Browse Source

latest oxygine(dev)

dmuratshin 9 years ago
parent
commit
b71ccd0799

+ 2 - 0
.gitignore

@@ -21,3 +21,5 @@ examples/HelloFlow/proj.win32/Debug_v*
 *.sdf
 examples/HelloFlow/proj.win32/Release_v*
 examples/HelloFlow/proj.cmake/build/
+/examples/HelloFlow/proj.cmake/build_emsc
+/examples/HelloFlow/proj.cmake/build_emsc_release

+ 8 - 2
examples/HelloFlow/proj.cmake/CMakeLists.txt

@@ -9,7 +9,7 @@ link_directories(${OXYGINE_LIBRARY_DIRS})
 add_subdirectory(../../../ oxygine-flow)
 include_directories(${OXYGINE_FLOW_INCLUDE_DIRS})
 
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OXYGINE_CXX_FLAGS}")
 add_executable(HelloFlow
 	../src/main.cpp
 	../src/example.h 
@@ -19,4 +19,10 @@ if (WIN32) #disable console mode for VC++
 	set_target_properties(HelloFlow PROPERTIES WIN32_EXECUTABLE TRUE)
 endif(WIN32)
 
-target_link_libraries(HelloFlow oxygine-flow ${OXYGINE_CORE_LIBS} )
+target_link_libraries(HelloFlow oxygine-flow ${OXYGINE_CORE_LIBS} )
+
+if (EMSCRIPTEN)
+	SET(CMAKE_EXECUTABLE_SUFFIX ".html")
+	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_EXIT_RUNTIME=1 -s WARN_ON_UNDEFINED_SYMBOLS=1 --memory-init-file 0 -s TOTAL_MEMORY=50331648")
+	em_link_pre_js(HelloFlow  ${OXYGINE_JS_LIBRARIES}  ${CMAKE_CURRENT_SOURCE_DIR}/data.js)
+endif(EMSCRIPTEN)

+ 7 - 0
examples/HelloFlow/proj.cmake/build_emsc.bat

@@ -0,0 +1,7 @@
+python ../../../../oxygine-framework/tools/others/embed_folder_js.py -s ../data
+
+mkdir build_emsc
+cd build_emsc
+cmake -DCMAKE_TOOLCHAIN_FILE="%EMSCRIPTEN%/cmake/Modules/Platform/emscripten.cmake" -G"Unix Makefiles" ..
+make
+cd ..

+ 7 - 0
examples/HelloFlow/proj.cmake/build_emsc_release.bat

@@ -0,0 +1,7 @@
+python ../../../../oxygine-framework/tools/others/embed_folder_js.py -s ../data
+
+mkdir build_emsc_release
+cd build_emsc_release
+cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="%EMSCRIPTEN%/cmake/Modules/Platform/emscripten.cmake" -G"Unix Makefiles" ..
+make
+cd ..

+ 0 - 33
examples/HelloFlow/proj.emscripten/CMakeLists.txt

@@ -1,33 +0,0 @@
-cmake_minimum_required (VERSION 2.6)
-project (HelloFlow)
-
-
-add_subdirectory(../../../../oxygine-framework oxygine-framework)
-add_definitions(${OXYGINE_DEFINITIONS})
-include_directories(${OXYGINE_INCLUDE_DIRS})
-link_directories(${OXYGINE_LIBRARY_DIRS})
-
-add_subdirectory(../../../ oxygine-flow)
-include_directories(${OXYGINE_FLOW_INCLUDE_DIRS})
-
-SET(CMAKE_EXECUTABLE_SUFFIX ".html")
-
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-warn-absolute-paths")
-
-add_executable(HelloFlow
-	../src/main.cpp
-	../src/example.h 
-	../src/example.cpp)
-
-if (CMAKE_BUILD_TYPE STREQUAL Debug)
-	SET(linkFlags "-g4 ")
-else() # Either MinSizeRel, RelWithDebInfo or Release, all which run with optimizations enabled.
-	SET(linkFlags "-O2 ")
-endif()
-
-set(linkFlags "${linkFlags} -s NO_EXIT_RUNTIME=1 -s FULL_ES2=1 -s WARN_ON_UNDEFINED_SYMBOLS=1 --memory-init-file 0 -Wno-warn-absolute-paths -s TOTAL_MEMORY=64435456")
-
-set_target_properties(HelloFlow PROPERTIES LINK_FLAGS "${linkFlags}")
-
-target_link_libraries(HelloFlow oxygine-flow ${OXYGINE_CORE_LIBS})
-em_link_pre_js(HelloFlow ${CMAKE_CURRENT_SOURCE_DIR}/data.js)

+ 0 - 7
examples/HelloFlow/proj.emscripten/build.bat

@@ -1,7 +0,0 @@
-python ../../../../oxygine-framework/tools/others/embed_folder_js.py -s ../data
-
-mkdir build
-cd build
-cmake -DCMAKE_TOOLCHAIN_FILE=%EMSCRIPTEN%/cmake/Modules/Platform/emscripten.cmake -G"Unix Makefiles" .. 
-make
-cd ..

+ 0 - 7
examples/HelloFlow/proj.emscripten/build_release.bat

@@ -1,7 +0,0 @@
-python ../../../../oxygine-framework/tools/others/embed_folder_js.py -s ../data
-
-mkdir build_release
-cd build_release
-cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=%EMSCRIPTEN%/cmake/Modules/Platform/emscripten.cmake -G"Unix Makefiles" .. 
-make
-cd ..

+ 8 - 15
examples/HelloFlow/src/main.cpp

@@ -138,9 +138,12 @@ int main(int argc, char* argv[])
 
 #include "SDL_main.h"
 #include "SDL.h"
+
 extern "C"
 {
     void one(void* param) { mainloop(); }
+    void oneEmsc() { mainloop(); }
+
     int main(int argc, char* argv[])
     {
 
@@ -151,21 +154,11 @@ extern "C"
         SDL_iPhoneSetAnimationCallback(core::getWindow(), 1, one, nullptr);
 #endif
 
+#if EMSCRIPTEN
+        emscripten_set_main_loop(oneEmsc, 0, 0);
+#endif
+
         return 0;
     }
 };
-#endif
-
-
-#ifdef EMSCRIPTEN
-#include <emscripten.h>
-
-void one() { mainloop(); }
-
-int main(int argc, char* argv[])
-{
-    run();
-    emscripten_set_main_loop(one, 0, 0);
-    return 0;
-}
-#endif
+#endif