diff --git a/CMakeLists.txt b/CMakeLists.txt index 943c6d373f97ca1c7ff1b69f9b41081703116003..072b617f5d403a41a211b66fe8fc56103dba877b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,8 @@ option(ENABLE_BLAS_LAPACK "Use BLAS and Lapack for linear algebra" ON) option(ENABLE_BLOSSOM "Enable Blossom algo (based on MATCH and concorde97)" ${DEFAULT}) option(ENABLE_BUILD_LIB "Build static Gmsh library" OFF) option(ENABLE_BUILD_SHARED "Build shared Gmsh library" OFF) +option(ENABLE_BUILD_ANDROID "Build Gmsh library for Android NDK" OFF) +option(ENABLE_BUILD_IOS "Build Gmsh library for iOS" OFF) option(ENABLE_CGNS "Enable CGNS mesh export" OFF) option(ENABLE_CHACO "Enable Chaco mesh partitioner" ${DEFAULT}) option(ENABLE_DINTEGRATION "Enable discrete integration and levelsets" ${DEFAULT}) @@ -285,6 +287,10 @@ if(ENABLE_BLAS_LAPACK) set_config_option(HAVE_BLAS "Blas(VecLib)") set_config_option(HAVE_LAPACK "Lapack(VecLib)") endif(MSVC) + if(BUILD_ANDROID) + set_config_option(HAVE_BLAS "Blas") + set_config_option(HAVE_LAPACK "Lapack") + endif(BUILD_ANDROID) if(NOT HAVE_BLAS OR NOT HAVE_LAPACK) # if we haven't found blas and lapack without using the standard # cmake tests, do it (this requires a working Fortran compiler) @@ -427,6 +433,35 @@ if(ENABLE_ONELAB) endif(ENABLE_ONELAB_METAMODEL) endif(ENABLE_ONELAB) +if(ENABLE_BUILD_IOS) + #TODO +endif(ENABLE_BUILD_IOS) + +if(ENABLE_BUILD_ANDROID) + # we need getdp lib + #find_library(GETDP_LIB Gmsh PATH_SUFFIXES lib) + #find_path(GETDP_INC "GetDP.h" PATH_SUFFIXES include getdp include/getdp) + #if(GETDP_LIB AND GETDP_INC) + # list(APPEND EXTERNAL_LIBRARIES ${GETDP_LIB}) + # list(APPEND EXTERNAL_INCLUDES ${GETDP_INC}) + # set_config_option(HAVE_GETDP "GetDP") + #else(GETDP_LIB AND GETDP_INC) + # message(SEND_ERROR "Cannot compile Gmsh for Android without GetDP") + #endif(GETDP_LIB AND GETDP_INC) + # then we can make gmsh lib + set(CMAKE_BUILD_TYPE Release) + add_definitions(-DBUILD_ANDROID) + set(LIBRARY_OUTPUT_PATH_ROOT ${CMAKE_CURRENT_BINARY_DIR}) + set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/libs/) + #add_subdirectory(Mobile/Android/) + #add_library(androidGmsh SHARED Mobile/Android/drawGModel.cpp Mobile/Android/androidGModel.cpp ${GMSH_SRC}) + add_library(androidGmsh SHARED ${GMSH_SRC}) + #set( LIBRARY_DEPS GLESv1_CM log) + set_target_properties(androidGmsh PROPERTIES OUTPUT_NAME Gmsh) + target_link_libraries(androidGmsh ${LINK_LIBRARIES}) +endif(ENABLE_BUILD_ANDROID) + + if(HAVE_FLTK OR HAVE_QT OR ENABLE_GRAPHICS) if(NOT HAVE_MESH OR NOT HAVE_POST OR NOT HAVE_PLUGINS OR NOT HAVE_ONELAB) message(SEND_ERROR "Cannot compile GUI without Mesh, Post, Plugin or OneLab") @@ -1205,6 +1240,10 @@ endif(ENABLE_BUILD_LIB) if(ENABLE_BUILD_SHARED) install(TARGETS shared DESTINATION lib OPTIONAL) endif(ENABLE_BUILD_SHARED) +if(ENABLE_BUILD_ANDROID) + install(TARGETS androidGmsh DESTINATION lib OPTIONAL) +endif(ENABLE_BUILD_ANDROID) + install(FILES ${GMSH_API} DESTINATION include/gmsh) install(FILES ${WELCOME_FILE} DESTINATION ${GMSH_DOC} RENAME README.txt) install(FILES ${LICENSE_FILE} DESTINATION ${GMSH_DOC}) diff --git a/Common/GmshMessage.cpp b/Common/GmshMessage.cpp index 7e4e02e05b4b0a787d404ac77ee0395b3c406e15..7628c9cbd06d369e1f7c50f4e6466128538cf758 100644 --- a/Common/GmshMessage.cpp +++ b/Common/GmshMessage.cpp @@ -352,6 +352,10 @@ void Msg::Info(const char *fmt, ...) fflush(stdout); } } +void Msg::RequestRender() +{ + if(_callback) (*_callback)("RequestRender", ""); +} void Msg::Direct(const char *fmt, ...) { @@ -487,7 +491,7 @@ void Msg::ProgressMeter(int n, int N, bool log, const char *fmt, ...) FlGui::instance()->setProgress(str, (n > N - 1) ? 0 : n, 0, N); } #endif - + if(_callback) (*_callback)("Progress", str); if(!streamIsFile(stdout) && log && CTX::instance()->terminal){ fprintf(stdout, "%s \r", (n > N - 1) ? "" : str2); diff --git a/Common/GmshMessage.h b/Common/GmshMessage.h index e5a3e676ccf539a1d68c16550ee67ef807ad868a..e44f310175753f808eefddde90aeed0ede727f84 100644 --- a/Common/GmshMessage.h +++ b/Common/GmshMessage.h @@ -68,6 +68,7 @@ class Msg { static void Error(const char *fmt, ...); static void Warning(const char *fmt, ...); static void Info(const char *fmt, ...); + static void RequestRender(); static void Direct(const char *fmt, ...); static void StatusBar(bool log, const char *fmt, ...); static void StatusGl(const char *fmt, ...); diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp index 049a075b33536b7bb3ca294b103bb651a3255ed1..2bf8f9844eaff6b3acf6881598608b6c74c15ae4 100644 --- a/Common/OpenFile.cpp +++ b/Common/OpenFile.cpp @@ -402,7 +402,7 @@ int MergeFile(const std::string &fileName, bool warnIfMissing) status = readFile3M(fileName); } #endif -#if defined(HAVE_ONELAB) && defined(HAVE_FLTK) +#if defined(HAVE_ONELAB) else if(ext == ".pro" && opt_solver_name(0, GMSH_GET, "") == "GetDP"){ std::vector<std::string> split = SplitFileName(fileName); GModel::current()->setName(split[1] + ".geo");