diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index abf70db..36a11f3 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -13,9 +13,6 @@ ## "http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html". ############################################################################# -set(ROOTDIR_ASSIMP ${CMAKE_SOURCE_DIR} CACHE PATH "Directory where the Assimp library resides") -set(ROOTDIR_OPENCASCADE ${CMAKE_SOURCE_DIR} CACHE PATH "Directory where the OpenCascade library resides") - file(GLOB COMMONS_FILES commons/*) set(COMMONS_FILES ${COMMONS_FILES}) @@ -26,93 +23,12 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) link_libraries(m) # -lm endif() -add_executable(benchmark_gmio benchmark_gmio/main.c ${COMMONS_FILES}) - -function(get_msvc_vernum outVerNum) - if(MSVC60) - set(${outVerNum} 6 PARENT_SCOPE) - elseif(MSVC70) - set(${outVerNum} 7 PARENT_SCOPE) - elseif(MSVC80) - set(${outVerNum} 8 PARENT_SCOPE) - elseif(MSVC90) - set(${outVerNum} 9 PARENT_SCOPE) - elseif(MSVC10) - set(${outVerNum} 10 PARENT_SCOPE) - elseif(MSVC11) - set(${outVerNum} 11 PARENT_SCOPE) - elseif(MSVC12) - set(${outVerNum} 12 PARENT_SCOPE) - endif() -endfunction() +add_subdirectory(benchmark_gmio) if(GMIO_BUILD_BENCHMARK_ASSIMP) - add_executable(benchmark_assimp benchmark_assimp/main.cpp ${COMMONS_FILES}) - # Note: we could use target_include_directories() but it's available in cmake > v2.8.10 - set_property( - TARGET benchmark_assimp - APPEND PROPERTY INCLUDE_DIRECTORIES ${ROOTDIR_ASSIMP}/include) - - # TODO: choose lib32/lib64 depending on the architecture - find_library( - LIB_ASSIMP assimp ${ROOTDIR_ASSIMP}/lib64 - DOC "Path to the assimp import library") - target_link_libraries(benchmark_assimp ${LIB_ASSIMP}) + add_subdirectory(benchmark_assimp) endif() if(GMIO_BUILD_BENCHMARK_OPENCASCADE) - add_executable( - benchmark_opencascade - benchmark_opencascade/main.cpp - ${CMAKE_SOURCE_DIR}/src/gmio_support/stl_occ.cpp - ${COMMONS_FILES}) - - # TODO: define only if target arch is 64b - # Note: we could use target_compile_definitions() but it's available in cmake > v2.8.10 - set_property( - TARGET benchmark_opencascade - APPEND PROPERTY COMPILE_DEFINITIONS _OCC64) - - if(WIN32) - set_property( - TARGET benchmark_opencascade - APPEND PROPERTY COMPILE_DEFINITIONS WNT) - elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - set_property( - TARGET benchmark_opencascade - APPEND PROPERTY COMPILE_DEFINITIONS - HAVE_CONFIG_H HAVE_FSTREAM HAVE_IOSTREAM HAVE_IOMANIP HAVE_LIMITS_H) - endif() - - # Note: we could use target_include_directories() but it's available in cmake > v2.8.10 - set_property( - TARGET benchmark_opencascade - APPEND PROPERTY INCLUDE_DIRECTORIES ${ROOTDIR_OPENCASCADE}/inc) - - # Libs - if(MSVC) - set(_MSVC_VERNUM_ 0) # Init - get_msvc_vernum(_MSVC_VERNUM_) - # TODO: choose win32/win64 depending on the architecture - set(LIBDIR_OPENCASCADE ${ROOTDIR_OPENCASCADE}/win64/vc${_MSVC_VERNUM_}/lib) - elseif((${CMAKE_SYSTEM_NAME} MATCHES "Linux") AND CMAKE_COMPILER_IS_GNUCXX) - # TODO: choose lin32/lin64 depending on the architecture - set(LIBDIR_OPENCASCADE ${ROOTDIR_OPENCASCADE}/lin64/gcc/lib) - endif() - #message(STATUS ${ROOTDIR_OPENCASCADE}) - - find_library( - LIB_OPENCASCADE_TKERNEL TKernel ${LIBDIR_OPENCASCADE} - DOC "Path to the TKernel import library") - find_library( - LIB_OPENCASCADE_TKMATH TKMath ${LIBDIR_OPENCASCADE} - DOC "Path to the TKMath import library") - find_library( - LIB_OPENCASCADE_TKSTL TKSTL ${LIBDIR_OPENCASCADE} - DOC "Path to the TKSTL import library") - target_link_libraries( - benchmark_opencascade - ${LIB_OPENCASCADE_TKERNEL} - ${LIB_OPENCASCADE_TKMATH} - ${LIB_OPENCASCADE_TKSTL}) + add_subdirectory(benchmark_opencascade) endif() diff --git a/benchmarks/benchmark_assimp/CMakeLists.txt b/benchmarks/benchmark_assimp/CMakeLists.txt new file mode 100644 index 0000000..d76b16b --- /dev/null +++ b/benchmarks/benchmark_assimp/CMakeLists.txt @@ -0,0 +1,27 @@ +############################################################################# +## gmio +## Copyright Fougue (2 Mar. 2015) +## contact@fougue.pro +## +## This software is a reusable library whose purpose is to provide complete +## I/O support for various CAD file formats (eg. STL) +## +## This software is governed by the CeCILL-B license under French law and +## abiding by the rules of distribution of free software. You can use, +## modify and/ or redistribute the software under the terms of the CeCILL-B +## license as circulated by CEA, CNRS and INRIA at the following URL +## "http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html". +############################################################################# + +set(ROOTDIR_ASSIMP ${CMAKE_SOURCE_DIR} CACHE PATH + "Directory where the Assimp library resides") + +include_directories(${ROOTDIR_ASSIMP}/include) +add_executable(benchmark_assimp main.cpp ${COMMONS_FILES}) + +# TODO: choose lib32/lib64 depending on the architecture +find_library( + LIB_ASSIMP assimp ${ROOTDIR_ASSIMP}/lib64 + DOC "Path to the assimp import library") + +target_link_libraries(benchmark_assimp ${LIB_ASSIMP}) diff --git a/benchmarks/benchmark_gmio/CMakeLists.txt b/benchmarks/benchmark_gmio/CMakeLists.txt new file mode 100644 index 0000000..8035f33 --- /dev/null +++ b/benchmarks/benchmark_gmio/CMakeLists.txt @@ -0,0 +1,16 @@ +############################################################################# +## gmio +## Copyright Fougue (2 Mar. 2015) +## contact@fougue.pro +## +## This software is a reusable library whose purpose is to provide complete +## I/O support for various CAD file formats (eg. STL) +## +## This software is governed by the CeCILL-B license under French law and +## abiding by the rules of distribution of free software. You can use, +## modify and/ or redistribute the software under the terms of the CeCILL-B +## license as circulated by CEA, CNRS and INRIA at the following URL +## "http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html". +############################################################################# + +add_executable(benchmark_gmio main.c ${COMMONS_FILES}) diff --git a/benchmarks/benchmark_opencascade/CMakeLists.txt b/benchmarks/benchmark_opencascade/CMakeLists.txt new file mode 100644 index 0000000..ec38bd0 --- /dev/null +++ b/benchmarks/benchmark_opencascade/CMakeLists.txt @@ -0,0 +1,85 @@ +############################################################################# +## gmio +## Copyright Fougue (2 Mar. 2015) +## contact@fougue.pro +## +## This software is a reusable library whose purpose is to provide complete +## I/O support for various CAD file formats (eg. STL) +## +## This software is governed by the CeCILL-B license under French law and +## abiding by the rules of distribution of free software. You can use, +## modify and/ or redistribute the software under the terms of the CeCILL-B +## license as circulated by CEA, CNRS and INRIA at the following URL +## "http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html". +############################################################################# + +set(ROOTDIR_OPENCASCADE ${CMAKE_SOURCE_DIR} CACHE PATH + "Directory where the OpenCascade library resides") + +# Returns the version number of Visual C++ +function(get_msvc_vernum outVerNum) + if(MSVC60) + set(${outVerNum} 6 PARENT_SCOPE) + elseif(MSVC70) + set(${outVerNum} 7 PARENT_SCOPE) + elseif(MSVC80) + set(${outVerNum} 8 PARENT_SCOPE) + elseif(MSVC90) + set(${outVerNum} 9 PARENT_SCOPE) + elseif(MSVC10) + set(${outVerNum} 10 PARENT_SCOPE) + elseif(MSVC11) + set(${outVerNum} 11 PARENT_SCOPE) + elseif(MSVC12) + set(${outVerNum} 12 PARENT_SCOPE) + endif() +endfunction() + +add_executable( + benchmark_opencascade + main.cpp + ${CMAKE_SOURCE_DIR}/src/gmio_support/stl_occ.cpp + ${COMMONS_FILES}) + +# TODO: define only if target arch is 64b +add_definitions(-D_OCC64) + +if(WIN32) + add_definitions(-DWNT) +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + add_definitions( + -DHAVE_CONFIG_H + -DHAVE_FSTREAM + -DHAVE_IOSTREAM + -DHAVE_IOMANIP + -DHAVE_LIMITS_H) +endif() + +include_directories(${ROOTDIR_OPENCASCADE}/inc) + +# Libs +if(MSVC) + set(_MSVC_VERNUM_ 0) # Init + get_msvc_vernum(_MSVC_VERNUM_) + # TODO: choose win32/win64 depending on the architecture + set(LIBDIR_OPENCASCADE ${ROOTDIR_OPENCASCADE}/win64/vc${_MSVC_VERNUM_}/lib) +elseif((${CMAKE_SYSTEM_NAME} MATCHES "Linux") AND CMAKE_COMPILER_IS_GNUCXX) + # TODO: choose lin32/lin64 depending on the architecture + set(LIBDIR_OPENCASCADE ${ROOTDIR_OPENCASCADE}/lin64/gcc/lib) +endif() +#message(STATUS ${ROOTDIR_OPENCASCADE}) + +find_library( + LIB_OPENCASCADE_TKERNEL TKernel ${LIBDIR_OPENCASCADE} + DOC "Path to the TKernel import library") +find_library( + LIB_OPENCASCADE_TKMATH TKMath ${LIBDIR_OPENCASCADE} + DOC "Path to the TKMath import library") +find_library( + LIB_OPENCASCADE_TKSTL TKSTL ${LIBDIR_OPENCASCADE} + DOC "Path to the TKSTL import library") +target_link_libraries( + benchmark_opencascade + ${LIB_OPENCASCADE_TKERNEL} + ${LIB_OPENCASCADE_TKMATH} + ${LIB_OPENCASCADE_TKSTL})