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

Fixing cmake configuration for multi-config generators #450

Open
wants to merge 3 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
18 changes: 8 additions & 10 deletions cmake/compiler/ispc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,13 @@ macro (ispc_compile)
mark_as_advanced(ISPC_FLAGS_RELEASE)
set(ISPC_FLAGS_RELWITHDEBINFO "-O2 -g" CACHE STRING "ISPC Release with Debug symbols flags")
mark_as_advanced(ISPC_FLAGS_RELWITHDEBINFO)
if (WIN32 OR "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
set(ISPC_OPT_FLAGS ${ISPC_FLAGS_RELEASE})
elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(ISPC_OPT_FLAGS ${ISPC_FLAGS_DEBUG})
else()
set(ISPC_OPT_FLAGS ${ISPC_FLAGS_RELWITHDEBINFO})
endif()

# turn space sparated list into ';' separated list
string(REPLACE " " ";" ISPC_OPT_FLAGS "${ISPC_OPT_FLAGS}")
set(ISPC_OPT_FLAGS
$<IF:$<CONFIG:Debug>,${ISPC_FLAGS_DEBUG},
$<IF:$<CONFIG:Release>,${ISPC_FLAGS_RELEASE},
${ISPC_FLAGS_RELWITHDEBINFO}>>
)
string(REPLACE ";" "" ISPC_OPT_FLAGS "${ISPC_OPT_FLAGS}")
string(REPLACE " " "$<SEMICOLON>" ISPC_OPT_FLAGS "${ISPC_OPT_FLAGS}")

if (NOT WIN32)
set(ISPC_ADDITIONAL_ARGS ${ISPC_ADDITIONAL_ARGS} --pic)
Expand Down Expand Up @@ -205,6 +202,7 @@ macro (ispc_compile)
${input}
DEPENDS ${input} ${deps}
COMMENT "Building ISPC object ${outdir}/${fname}.dev${ISPC_TARGET_EXT}"
COMMAND_EXPAND_LISTS
)

list(APPEND ISPC_OBJECTS ${results})
Expand Down
4 changes: 0 additions & 4 deletions cmake/ospray_cmake_config/osprayConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ set(OSPRAY_SOVERSION @OSPRAY_SOVERSION@)

set(OSPRAY_INSTALL_DEPENDENCIES @OSPRAY_INSTALL_DEPENDENCIES@)

set(OSPRAY_BUILD_DEBUG @OSPRAY_BUILD_DEBUG@)
set(OSPRAY_BUILD_RELWITHDEBINFO @OSPRAY_BUILD_RELWITHDEBINFO@)
set(OSPRAY_BUILD_RELEASE @OSPRAY_BUILD_RELEASE@)

set(OSPRAY_COMPILER_ICC @OSPRAY_COMPILER_ICC@)
set(OSPRAY_COMPILER_GCC @OSPRAY_COMPILER_GCC@)
set(OSPRAY_COMPILER_CLANG @OSPRAY_COMPILER_CLANG@)
Expand Down
32 changes: 0 additions & 32 deletions cmake/ospray_macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,38 +30,6 @@ macro(add_all_subdirectories)
endforeach(dir ${dirs})
endmacro()

## Setup CMAKE_BUILD_TYPE to have a default + cycle between options in UI
macro(ospray_configure_build_type)
set(CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the build type." FORCE)
endif()
if (WIN32)
if (NOT OSPRAY_DEFAULT_CMAKE_CONFIGURATION_TYPES_SET)
set(CMAKE_CONFIGURATION_TYPES "${CONFIGURATION_TYPES}"
CACHE STRING "List of generated configurations." FORCE)
set(OSPRAY_DEFAULT_CMAKE_CONFIGURATION_TYPES_SET ON
CACHE INTERNAL "Default CMake configuration types set.")
endif()
else()
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CONFIGURATION_TYPES})
endif()

if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
set(OSPRAY_BUILD_RELEASE TRUE )
set(OSPRAY_BUILD_DEBUG FALSE)
set(OSPRAY_BUILD_RELWITHDEBINFO FALSE)
elseif (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(OSPRAY_BUILD_RELEASE FALSE)
set(OSPRAY_BUILD_DEBUG TRUE )
set(OSPRAY_BUILD_RELWITHDEBINFO FALSE)
else()
set(OSPRAY_BUILD_RELEASE FALSE)
set(OSPRAY_BUILD_DEBUG FALSE)
set(OSPRAY_BUILD_RELWITHDEBINFO TRUE )
endif()
endmacro()

# workaround link issues to Embree ISPC exports
# ISPC only adds the ISA suffix during name mangling (and dynamic dispatch
# code) when compiling for multiple targets. Thus, when only one OSPRay ISA is
Expand Down
1 change: 0 additions & 1 deletion cmake/ospray_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})

ospray_configure_build_type()
ospray_configure_compiler()

###########################################################
Expand Down
5 changes: 1 addition & 4 deletions scripts/superbuild/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ if(NOT CMAKE_INSTALL_PREFIX)
CACHE STRING "Final install location." FORCE)
endif()

if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
if (NOT DEPENDENCIES_BUILD_TYPE)
set(DEPENDENCIES_BUILD_TYPE Release)
endif()
Expand Down Expand Up @@ -121,7 +118,7 @@ endif()
include(dep_glm)

## Build main projects ##
set(DEFAULT_BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE} ${PARALLEL_JOBS_OPTS})
set(DEFAULT_BUILD_COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIG> ${PARALLEL_JOBS_OPTS})

if (NOT BUILD_DEPENDENCIES_ONLY)
include(build_ospray.cmake)
Expand Down