Skip to content

Commit 22ad34c

Browse files
committed
Improved build system organization
1 parent b1fb232 commit 22ad34c

File tree

7 files changed

+12
-10
lines changed

7 files changed

+12
-10
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
cmake_minimum_required(VERSION 3.2) # For Hunter
22

3-
# Set compile with -fPIC (on all targets)
4-
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
5-
63
# Set defaults
4+
# PIC toolchain as we are building an shared library
5+
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/cmake/toolchain/pic.cmake" CACHE STRING "")
6+
# Build dependencies as 'Release' only by default
77
set(HUNTER_CONFIGURATION_TYPES "Release" CACHE STRING "Hunter dependencies list of build configurations")
88

99
include("cmake/HunterGate.cmake")

ci/msvc_toolchain.cmake

Lines changed: 0 additions & 2 deletions
This file was deleted.

cmake/ToolchainConfig.cmake

Lines changed: 0 additions & 3 deletions
This file was deleted.

cmake/toolchain/msvc.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Set PIC
2+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
3+
4+
# Statically compile vcruntime library
5+
add_compile_options(/MT)

cmake/toolchain/pic.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Simple toolchain which enables PIC for all dependencies
2+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def build_extension(self, ext):
110110

111111
if platform.system() == "Windows":
112112
cmake_args += ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}'.format(cfg.upper(), extdir)]
113-
cmake_args += ['-DCMAKE_TOOLCHAIN_FILE={}'.format(os.path.dirname(os.path.abspath(__file__)) + '/ci/msvc_toolchain.cmake')]
113+
cmake_args += ['-DCMAKE_TOOLCHAIN_FILE={}'.format(os.path.dirname(os.path.abspath(__file__)) + '/cmake/toolchain/msvc.cmake')]
114114

115115
# Detect whether 32 / 64 bit Python is used and compile accordingly
116116
if sys.maxsize > 2**32:

0 commit comments

Comments
 (0)