aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Cross <sean@xobs.io>2019-08-15 12:59:00 +0800
committerSean Cross <sean@xobs.io>2019-08-15 12:59:00 +0800
commit0b5c0bd94e19bbd268d9af956c51e804d4661ddf (patch)
treeda9d225e4ab068efde544329f92499a2e8530e4e
parent6e932f5a2db83bece51f744ed59c42a0f7377b6f (diff)
downloadnextpnr-0b5c0bd94e19bbd268d9af956c51e804d4661ddf.tar.gz
nextpnr-0b5c0bd94e19bbd268d9af956c51e804d4661ddf.tar.bz2
nextpnr-0b5c0bd94e19bbd268d9af956c51e804d4661ddf.zip
cmake: fix static build on windows
On Windows, we can make a static build by setting the triple to x64-windows-static, but due to some issues with cmake we also need to modify the linker flags and Python definitions. Signed-off-by: Sean Cross <sean@xobs.io>
-rw-r--r--CMakeLists.txt9
1 files changed, 8 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c58104de..c808572d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,7 +15,14 @@ option(SERIALIZE_CHIPDB "Never build chipdb in parallel to reduce peak memory us
set(link_param "")
if (STATIC_BUILD)
set(Boost_USE_STATIC_LIBS ON)
- if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
+ set(CMAKE_CXX_FLAGS_RELEASE "/MT")
+ set(CMAKE_CXX_FLAGS_DEBUG "/MTd")
+ if (BUILD_PYTHON)
+ add_definitions(-DBOOST_PYTHON_STATIC_LIB)
+ endif()
+ else()
set(link_param "-static")
endif()
endif()