mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
[cmake] Simplify compile flag handling on Windows
Add options/define flags to ngcore, so they are automatically passed on to dependencies
This commit is contained in:
parent
09afc419bc
commit
ce90bd9e83
@ -215,13 +215,9 @@ endmacro()
|
|||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
get_WIN32_WINNT(ver)
|
|
||||||
add_definitions(-D_WIN32_WINNT=${ver} -DWNT -DWNT_WINDOW -DNOMINMAX)
|
|
||||||
set(CMAKE_MFC_FLAG 0)
|
set(CMAKE_MFC_FLAG 0)
|
||||||
add_definitions(-DMSVC_EXPRESS -D_CRT_SECURE_NO_WARNINGS -DHAVE_STRUCT_TIMESPEC)
|
|
||||||
# build convenience (aka object) libraries in windows)
|
# build convenience (aka object) libraries in windows)
|
||||||
set(NG_LIB_TYPE OBJECT)
|
set(NG_LIB_TYPE OBJECT)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
|
||||||
else(WIN32)
|
else(WIN32)
|
||||||
# build shared libraries
|
# build shared libraries
|
||||||
set(NG_LIB_TYPE SHARED)
|
set(NG_LIB_TYPE SHARED)
|
||||||
|
@ -20,18 +20,6 @@ if(WIN32)
|
|||||||
set (OCC_DOWNLOAD_URL_WIN "${DEPS_DOWNLOAD_URL}/occ_win64.zip" CACHE STRING INTERNAL)
|
set (OCC_DOWNLOAD_URL_WIN "${DEPS_DOWNLOAD_URL}/occ_win64.zip" CACHE STRING INTERNAL)
|
||||||
set (TCLTK_DOWNLOAD_URL_WIN "${DEPS_DOWNLOAD_URL}/tcltk_win64.zip" CACHE STRING INTERNAL)
|
set (TCLTK_DOWNLOAD_URL_WIN "${DEPS_DOWNLOAD_URL}/tcltk_win64.zip" CACHE STRING INTERNAL)
|
||||||
set (ZLIB_DOWNLOAD_URL_WIN "${DEPS_DOWNLOAD_URL}/zlib_win64.zip" CACHE STRING INTERNAL)
|
set (ZLIB_DOWNLOAD_URL_WIN "${DEPS_DOWNLOAD_URL}/zlib_win64.zip" CACHE STRING INTERNAL)
|
||||||
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
|
||||||
string(REGEX REPLACE "/W[0-4]" "/W0" CMAKE_CXX_FLAGS_NEW ${CMAKE_CXX_FLAGS})
|
|
||||||
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_NEW} CACHE STRING "compile flags" FORCE)
|
|
||||||
string(REGEX REPLACE "/W[0-4]" "/W0" CMAKE_CXX_FLAGS_NEW ${CMAKE_CXX_FLAGS_RELEASE})
|
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_NEW} CACHE STRING "compile flags" FORCE)
|
|
||||||
|
|
||||||
string(REGEX REPLACE "/W[0-4]" "/W0" CMAKE_SHARED_LINKER_FLAGS_NEW ${CMAKE_SHARED_LINKER_FLAGS})
|
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_NEW} /IGNORE:4217,4049" CACHE STRING "compile flags" FORCE)
|
|
||||||
string(REGEX REPLACE "/W[0-4]" "/W0" CMAKE_EXE_LINKER_FLAGS_NEW ${CMAKE_EXE_LINKER_FLAGS})
|
|
||||||
set(CMAKE_EXE_LINKER_FLAGS"${CMAKE_EXE_LINKER_FLAGS_NEW}/IGNORE:4217,4049" CACHE STRING "compile flags" FORCE)
|
|
||||||
|
|
||||||
endif(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
|
@ -23,21 +23,21 @@ if(USE_PYTHON)
|
|||||||
target_compile_definitions(ngcore PUBLIC NETGEN_PYTHON NG_PYTHON)
|
target_compile_definitions(ngcore PUBLIC NETGEN_PYTHON NG_PYTHON)
|
||||||
endif(USE_PYTHON)
|
endif(USE_PYTHON)
|
||||||
|
|
||||||
target_compile_definitions(ngcore PRIVATE NGCORE_EXPORTS)
|
|
||||||
if(NOT WIN32)
|
|
||||||
target_compile_options(ngcore PRIVATE -fvisibility=hidden)
|
|
||||||
endif(NOT WIN32)
|
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_compile_options(ngcore PUBLIC /bigobj)
|
target_compile_options(ngcore PUBLIC /bigobj /MP /W1 /wd4068)
|
||||||
|
get_WIN32_WINNT(ver)
|
||||||
|
target_compile_definitions(ngcore PUBLIC _WIN32_WINNT=${ver} WNT WNT_WINDOW NOMINMAX MSVC_EXPRESS _CRT_SECURE_NO_WARNINGS HAVE_STRUCT_TIMESPEC)
|
||||||
|
target_link_options(ngcore PUBLIC /ignore:4273 /ignore:4217 /ignore:4049)
|
||||||
|
else(WIN32)
|
||||||
|
target_compile_options(ngcore PRIVATE -fvisibility=hidden)
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
target_compile_definitions(ngcore PUBLIC $<$<CONFIG:DEBUG>:NETGEN_ENABLE_CHECK_RANGE>)
|
target_compile_definitions(ngcore PRIVATE NGCORE_EXPORTS)
|
||||||
target_include_directories(ngcore INTERFACE $<INSTALL_INTERFACE:${NG_INSTALL_DIR_INCLUDE}> $<INSTALL_INTERFACE:${NG_INSTALL_DIR_INCLUDE}/include>)
|
target_include_directories(ngcore INTERFACE $<INSTALL_INTERFACE:${NG_INSTALL_DIR_INCLUDE}> $<INSTALL_INTERFACE:${NG_INSTALL_DIR_INCLUDE}/include>)
|
||||||
|
|
||||||
if(CHECK_RANGE)
|
if(CHECK_RANGE OR CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "DEBUG")
|
||||||
target_compile_definitions(ngcore PUBLIC NETGEN_ENABLE_CHECK_RANGE)
|
target_compile_definitions(ngcore PUBLIC NETGEN_ENABLE_CHECK_RANGE)
|
||||||
endif(CHECK_RANGE)
|
endif(CHECK_RANGE OR CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "DEBUG")
|
||||||
|
|
||||||
if(USE_SPDLOG)
|
if(USE_SPDLOG)
|
||||||
include_directories(${SPDLOG_INCLUDE_DIR})
|
include_directories(${SPDLOG_INCLUDE_DIR})
|
||||||
|
@ -11,8 +11,9 @@ endif(NOT WIN32)
|
|||||||
|
|
||||||
if(USE_GUI)
|
if(USE_GUI)
|
||||||
add_library(geom2dvis ${NG_LIB_TYPE} vsgeom2d.cpp)
|
add_library(geom2dvis ${NG_LIB_TYPE} vsgeom2d.cpp)
|
||||||
|
target_link_libraries(geom2dvis PUBLIC ngcore)
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
target_link_libraries(geom2dvis geom2d)
|
target_link_libraries(geom2dvis PUBLIC geom2d)
|
||||||
install( TARGETS geom2dvis ${NG_INSTALL_DIR})
|
install( TARGETS geom2dvis ${NG_INSTALL_DIR})
|
||||||
endif(NOT WIN32)
|
endif(NOT WIN32)
|
||||||
endif(USE_GUI)
|
endif(USE_GUI)
|
||||||
|
@ -6,6 +6,7 @@ add_library(occ ${NG_LIB_TYPE}
|
|||||||
)
|
)
|
||||||
if(USE_GUI)
|
if(USE_GUI)
|
||||||
add_library(occvis ${NG_LIB_TYPE} vsocc.cpp)
|
add_library(occvis ${NG_LIB_TYPE} vsocc.cpp)
|
||||||
|
target_link_libraries(occvis PUBLIC ngcore)
|
||||||
endif(USE_GUI)
|
endif(USE_GUI)
|
||||||
|
|
||||||
target_link_libraries(occ PUBLIC ngcore PRIVATE netgen_python)
|
target_link_libraries(occ PUBLIC ngcore PRIVATE netgen_python)
|
||||||
|
Loading…
Reference in New Issue
Block a user