diff --git a/Apps/Examples/CMakeLists.txt b/Apps/Examples/CMakeLists.txt index 4cdff61e0d44c2b9fbee88874c06860f3e5ecd65..f7d911512e151d6b6925ceab47548006312ee1f9 100644 --- a/Apps/Examples/CMakeLists.txt +++ b/Apps/Examples/CMakeLists.txt @@ -40,7 +40,7 @@ qt_wrap_cpp( viewer_moc viewer.h ) add_executable( viewer viewer.cpp ${viewer_moc} ${viewer_ui} ) target_link_libraries( viewer ${CGoGN_LIBS} ${NUMERICAL_LIBS} ${CGoGN_EXT_LIBS} ) -IF (CGoGN_GCC_4_9) +IF (HAS_CPP11_REGEX) qt_wrap_ui( clipping_ui clipping.ui ) qt_wrap_cpp( clipping_moc clipping.h ) add_executable( clipping clipping.cpp ${clipping_ui} ${clipping_moc} ) diff --git a/CGoGN/include/.gitignore b/CGoGN/include/.gitignore index 7d9482dad039acdcb162167c4ceef0d451d2dfbc..05727471caa0e71b991fc566d9c9a1733cda7cd0 100644 --- a/CGoGN/include/.gitignore +++ b/CGoGN/include/.gitignore @@ -2,4 +2,9 @@ cgogn_gmx.h cgogn_mr.h cgogn_onelib.h - +cgogn_assimp.h +cgogn_defs.h +cgogn_ext_includes.h +cgogn_ext_libs.h +cgogn_qt.h +cgogn_zinri.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a4cb31131c48006f5e889f52389770ecea32dc4..3274780e056cfaf4be58c5abcfa25e7b44fc23b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,17 +35,11 @@ IF (WIN32) SET ( CGoGN_WITH_QTCREATOR OFF CACHE BOOL "use QtCreator to compile (Experimental" ) ENDIF() -IF (NOT(WIN32 OR APPLE)) - SET ( CGoGN_GCC_4_9 OFF CACHE BOOL "using gcc version > 4.9 (std::regex ok !)" ) -ENDIF() - -SET ( BUILD_SHARED_LIBS ON CACHE BOOL "if used all library are build as shared type (.so/.dylib/.dll)" ) - checkCpp11Support() +checkCpp11Feature("regex" HAS_CPP11_REGEX "False") setBuildType() - SET(EXECUTABLE_OUTPUT_PATH ${CGoGN_ROOT_DIR}/bin/) IF(WIN32) IF (CGoGN_WITH_QTCREATOR) @@ -176,8 +170,8 @@ IF (APPLE) LIST(APPEND CGoGN_DEFS -DCGOGN_APPLE) ENDIF () -IF (CGoGN_GCC_4_9) - LIST(APPEND CGoGN_DEFS -DCGOGN_GCC_4_9) +IF (HAS_CPP11_REGEX) + LIST(APPEND CGoGN_DEFS -DHAS_CPP11_REGEX) ENDIF () diff --git a/build/.gitigonre b/build/.gitigonre deleted file mode 100644 index c8b28e9c0504adb3a7bd652d582580f46317da09..0000000000000000000000000000000000000000 --- a/build/.gitigonre +++ /dev/null @@ -1,2 +0,0 @@ -# ignoring all build directory -* diff --git a/buildDebug/.gitigonre b/buildDebug/.gitigonre deleted file mode 100644 index c8b28e9c0504adb3a7bd652d582580f46317da09..0000000000000000000000000000000000000000 --- a/buildDebug/.gitigonre +++ /dev/null @@ -1,2 +0,0 @@ -# ignoring all build directory -* diff --git a/cmake_modules/functions.cmake b/cmake_modules/functions.cmake index d26441a4f8f73e5f656def288170870365646d6b..bfa27d4fbbdd26929edc7ff4ff24743b31ebc485 100644 --- a/cmake_modules/functions.cmake +++ b/cmake_modules/functions.cmake @@ -24,6 +24,29 @@ function(checkCpp11Support) endfunction(checkCpp11Support) +function(checkCpp11Feature FEATURE RESULT IS_FATAL) + set(definitions "") + if (NOT MSVC) + set(definitions "-std=c++11") + endif(NOT MSVC) + set(source "${CMAKE_MODULE_PATH}/tests/cxx11-test-${FEATURE}.cpp") + set(bindir "${CMAKE_CURRENT_BINARY_DIR}/cxx11/cxx11_${FEATURE}") + try_run(run_result compile_result + ${bindir} ${source} + COMPILE_DEFINITIONS ${definitions}) + if (${run_result} EQUAL "1") + set(${RESULT} "True" PARENT_SCOPE) + message("Checking cpp11 feature support ${FEATURE} : OK") + else() + set(${RESULT} "False" PARENT_SCOPE) + if (${IS_FATAL}) + message(FATAL_ERROR "Checking cpp11 feature support ${FEATURE} : Fail. Please update your compiler (GCC >= 4.9, Clang >= 3.5, VS 2013).") + else() + message("Checking cpp11 feature support ${FEATURE} : Fail.") + endif() + endif() +endfunction(checkCpp11Feature) + function(setBuildType) IF (NOT (${CMAKE_BUILD_TYPE} MATCHES "Debug|Release")) IF (${CMAKE_CURRENT_BINARY_DIR} MATCHES "(.*)Debug|(.*)debug|(.*)DEBUG") diff --git a/cmake_modules/tests/cxx11-test-regex.cpp b/cmake_modules/tests/cxx11-test-regex.cpp new file mode 100644 index 0000000000000000000000000000000000000000..87d1afd7064f9bdb630ad0b943e68ae4fe19b06c --- /dev/null +++ b/cmake_modules/tests/cxx11-test-regex.cpp @@ -0,0 +1,26 @@ +#include +#include + +int parse_line(std::string const& line) +{ + std::string tmp; + if(std::regex_search(line, std::regex("(\\s)+(-)?(\\d)+//(-)?(\\d)+(\\s)+"))) { + tmp = std::regex_replace(line, std::regex("(-)?(\\d)+//(-)?(\\d)+"), std::string("V")); + } else if(std::regex_search(line, std::regex("(\\s)+(-)?(\\d)+/(-)?(\\d)+(\\s)+"))) { + tmp = std::regex_replace(line, std::regex("(-)?(\\d)+/(-)?(\\d)+"), std::string("V")); + } else if(std::regex_search(line, std::regex("(\\s)+(-)?(\\d)+/(-)?(\\d)+/(-)?(\\d)+(\\s)+"))) { + tmp = std::regex_replace(line, std::regex("(-)?(\\d)+/(-)?(\\d)+/(-)?(\\d)+"), std::string("V")); + } else { + tmp = std::regex_replace(line, std::regex("(-)?(\\d)+"), std::string("V")); + } + return static_cast(std::count(tmp.begin(), tmp.end(), 'V')); +} + +int main() +{ + bool test = (parse_line("f 7/7/7 -3/3/-3 2/-2/2") == 3) && + (parse_line("f 7//7 3//-3 -2//2") == 3) && + (parse_line("f 7/7 3/-3 -2/2") == 3) && + (parse_line("f 7 3 -2") == 3); + return test; +}