From 10889172ce750ef63175504e4b5411ec1fcfe826 Mon Sep 17 00:00:00 2001 From: Yue JIN Date: Wed, 1 Jul 2020 15:20:55 +0800 Subject: [PATCH] Fix to allow build in VS2019 --- .gitignore | 6 ++++++ CMakeLists.txt | 5 ++++- src/source.cpp | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f73309646..133a5f626 100644 --- a/.gitignore +++ b/.gitignore @@ -106,3 +106,9 @@ htmlcov #Dynamic Library *.dylib + +#Visual Studio CMake Project +/.vs/ +CMakeSettings.json +/out/ +/openmc/lib/*.lib diff --git a/CMakeLists.txt b/CMakeLists.txt index ee56c84ca..2a7b76560 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -325,8 +325,11 @@ else() add_library(libopenmc SHARED ${libopenmc_SOURCES}) endif() +# Avoid vs error lnk1149 :output filename matches input filename +if(NOT MSVC) set_target_properties(libopenmc PROPERTIES - OUTPUT_NAME openmc) + OUTPUT_NAME openmc) +endif() target_include_directories(libopenmc PUBLIC diff --git a/src/source.cpp b/src/source.cpp index 21b12ed0d..3f31541db 100644 --- a/src/source.cpp +++ b/src/source.cpp @@ -386,7 +386,12 @@ void load_custom_source_library() void close_custom_source_library() { +#ifdef HAS_DYNAMIC_LINKING dlclose(custom_source_library); +#else + fatal_error("Custom source libraries have not yet been implemented for " + "non-POSIX systems"); +#endif } Particle::Bank sample_custom_source_library(uint64_t* seed)