Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correcting Cmake files for Windows and Visual Studio, and adding d suffix for the generated library in debug mode #1395

Merged
merged 6 commits into from
Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
(Roland Denis, [#1383](https://github.com/DGtal-team/DGtal/pull/1383))
- Various warnings fixed on Xcode (David Coeurjolly,
[#1389](https://github.com/DGtal-team/DGtal/pull/1389))
- Fix compilation and adding debug version for the generated file with Visual Studio
(Raphael Lenain, [#1395](https://github.com/DGtal-team/DGtal/pull/1395))


- *Base*
Expand Down
13 changes: 12 additions & 1 deletion cmake/Common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ foreach(p LIB BIN INCLUDE DATA)
endif()
endforeach()

# -----------------------------------------------------------------------------
# Visual Studio : to distinguish between debug and release lib
# -----------------------------------------------------------------------------
IF (MSVC)
set(CMAKE_DEBUG_POSTFIX "d")
ENDIF (MSVC)

# -----------------------------------------------------------------------------
# Doxygen targets
# -----------------------------------------------------------------------------
Expand All @@ -52,7 +59,11 @@ ADD_CUSTOM_TARGET(uninstall
# -----------------------------------------------------------------------------
# Parsing cmake options
# -----------------------------------------------------------------------------
OPTION(BUILD_SHARED_LIBS "Build shared libraries." ON)
IF (MSVC)
OPTION(BUILD_SHARED_LIBS "Build shared libraries." OFF)
ELSE (MSVC)
OPTION(BUILD_SHARED_LIBS "Build shared libraries." ON)
ENDIF (MSVC)
OPTION(BUILD_TESTING "Build testing." OFF)
OPTION(DEBUG_VERBOSE "Verbose debug messages." OFF)
OPTION(VERBOSE "Verbose messages." OFF)
Expand Down
14 changes: 7 additions & 7 deletions cmake/DGtalConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ ENDIF(@COLOR_WITH_ALPHA_ARITH_DGTAL@)
# When user or compiler have not set any std flag.
try_compile( CPP11_COMPATIBLE_FLAG_SET_BY_USER
${CMAKE_BINARY_DIR}/CMakeTmp
@DGTAL_CMAKE_DIR@/cpp11_check.cpp
"@DGTAL_CMAKE_DIR@/cpp11_check.cpp"
CMAKE_FLAGS "-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}"
OUTPUT_VARIABLE OUTPUT
)
Expand Down Expand Up @@ -120,7 +120,7 @@ ENDIF(@HDF5_FOUND_DGTAL@)
if (@QGLVIEWER_FOUND_DGTAL@)
add_definitions("-DWITH_VISU3D_QGLVIEWER ")
set(WITH_VISU3D_QGLVIEWER 1)
set(DGTAL_INCLUDE_DIRS ${DGTAL_INCLUDE_DIRS} @QGLVIEWER_INCLUDE_DIR@)
set(DGTAL_INCLUDE_DIRS ${DGTAL_INCLUDE_DIRS} "@QGLVIEWER_INCLUDE_DIR@")
endif (@QGLVIEWER_FOUND_DGTAL@)

#-- We force the Qt rediscovering
Expand All @@ -130,7 +130,7 @@ if (@QT4_FOUND_DGTAL@)
add_definitions("-DWITH_QT4")
set(WITH_QT4 1)
include(${QT_USE_FILE})
set(DGTAL_INCLUDE_DIRS ${DGTAL_INCLUDE_DIRS} ${QT_INCLUDE_DIR})
set(DGTAL_INCLUDE_DIRS ${DGTAL_INCLUDE_DIRS} "${QT_INCLUDE_DIR}")
endif (@QT4_FOUND_DGTAL@)

if (@QT5_FOUND_DGTAL@)
Expand All @@ -139,9 +139,9 @@ if (@QT5_FOUND_DGTAL@)
set(WITH_QT5 1)
set(Qt5_DIR @Qt5_DIR@)
set(DGTAL_INCLUDE_DIRS ${DGTAL_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
${Qt5OpenGL_INCLUDE_DIRS}
${Qt5Xml_INCLUDE_DIRS})
"${Qt5Widgets_INCLUDE_DIRS}"
"${Qt5OpenGL_INCLUDE_DIRS}"
"${Qt5Xml_INCLUDE_DIRS}")
endif (@QT5_FOUND_DGTAL@)

IF(@OPENMP_FOUND_DGTAL@)
Expand All @@ -156,7 +156,7 @@ ENDIF(@OPENMP_FOUND_DGTAL@)
IF(@EIGEN_FOUND_DGTAL@)
ADD_DEFINITIONS("-DWITH_EIGEN ")
SET(WITH_EIGEN 1)
SET(DGTAL_INCLUDE_DIRS ${DGTAL_INCLUDE_DIRS} @EIGEN3_INCLUDE_DIR@ )
SET(DGTAL_INCLUDE_DIRS ${DGTAL_INCLUDE_DIRS} "@EIGEN3_INCLUDE_DIR@" )
ENDIF(@EIGEN_FOUND_DGTAL@)


Expand Down
8 changes: 6 additions & 2 deletions cmake/FindFFTW3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ find_library (FFTW3_LONG_THREADS_LIBRARIES NAMES fftw3l_threads )
# Gathering FFTW3 libraries
set (FFTW3_LIBRARIES ${FFTW3_FLOAT_LIBRARIES} ${FFTW3_DOUBLE_LIBRARIES} ${FFTW3_LONG_LIBRARIES})
set (FFTW3_THREADS_LIBRARIES ${FFTW3_FLOAT_THREADS_LIBRARIES} ${FFTW3_DOUBLE_THREADS_LIBRARIES} ${FFTW3_LONG_THREADS_LIBRARIES})
set (FFTW3_DEP_LIBRARIES m)
if (NOT MSVC)
set (FFTW3_DEP_LIBRARIES m)
endif (NOT MSVC)

# Telling which FFT precisions are found.
include(FindPackageHandleStandardArgs)
Expand All @@ -36,7 +38,9 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW3_LONG DEFAULT_MSG FFTW3_INCLUDE_DIR FFT
# Adding threaded version of FFTW3
if (FFTW3_THREADS_LIBRARIES)
set (FFTW3_LIBRARIES ${FFTW3_LIBRARIES} ${FFTW3_THREADS_LIBRARIES})
set (FFTW3_DEP_LIBRARIES ${FFTW3_DEP_LIBRARIES} pthread)
if (NOT MSVC)
set (FFTW3_DEP_LIBRARIES ${FFTW3_DEP_LIBRARIES} pthread)
endif (NOT MSVC)
dcoeurjo marked this conversation as resolved.
Show resolved Hide resolved
endif (FFTW3_THREADS_LIBRARIES)


Expand Down
4 changes: 2 additions & 2 deletions cmake/TargetDoxygenDox.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ IF (DOXYGEN_FOUND)
SET (TMP "${CMAKE_CURRENT_BINARY_DIR}\\Doc\\html\\index.hhp")
STRING(REGEX REPLACE "[/]" "\\\\" HHP_FILE ${TMP} )
# MESSAGE(SEND_ERROR "DBG HHP_FILE=${HHP_FILE}")
ADD_CUSTOM_TARGET(winhelp ${HTML_HELP_COMPILER} ${HHP_FILE})
ADD_DEPENDENCIES (winhelp doc)
ADD_CUSTOM_TARGET(winhelp-dox ${HTML_HELP_COMPILER} ${HHP_FILE})
ADD_DEPENDENCIES (winhelp-dox dox)

IF (NOT TARGET_DOC_SKIP_INSTALL)
# install windows help?
Expand Down
4 changes: 4 additions & 0 deletions examples/tutorial-examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ SET(DGTAL_TUTO_EXAMPLES_SRC


FOREACH(FILE ${DGTAL_TUTO_EXAMPLES_SRC})
if(MSVC)
set_source_files_properties( ${FILE} PROPERTIES COMPILE_FLAGS "/bigobj" )
dcoeurjo marked this conversation as resolved.
Show resolved Hide resolved
endif(MSVC)

add_executable(${FILE} ${FILE})
target_link_libraries (${FILE} DGtal )
ENDFOREACH(FILE)
Expand Down