kopia lustrzana https://github.com/stlink-org/stlink
Fixed compilation on Windows
- [doc] Updated installation instructions - Fixed cmd bug in mingw64-build.bat - Fixed cmake building for WIN32pull/1315/head
rodzic
2c337615c9
commit
b72f5b5acf
|
@ -74,7 +74,7 @@ include(${CMAKE_MODULE_PATH}/get_version.cmake) # Determine project version
|
|||
|
||||
include(GNUInstallDirs) # Define GNU standard installation directories
|
||||
|
||||
# Define install directory /usr/local/share
|
||||
# Define install directory for st-link shared files
|
||||
cmake_host_system_information(RESULT OS_NAME QUERY OS_NAME)
|
||||
message(STATUS "Checking for OS_NAME: ${OS_NAME}")
|
||||
|
||||
|
@ -160,7 +160,11 @@ include_directories(src/st-util)
|
|||
include_directories(src/stlink-lib)
|
||||
|
||||
## Set installation directory for header files
|
||||
if (WIN32)
|
||||
set(STLINK_INCLUDE_PATH ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "Main include install directory")
|
||||
else ()
|
||||
set(STLINK_INCLUDE_PATH ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} CACHE PATH "Main include install directory")
|
||||
endif ()
|
||||
|
||||
## Subordinate CMakeLists for version config & header installation
|
||||
add_subdirectory(inc)
|
||||
|
@ -275,6 +279,15 @@ install(TARGETS ${STLINK_LIB_SHARED}
|
|||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
|
||||
# Copy libusb DLL-library to binary output folder
|
||||
if (WIN32)
|
||||
file(COPY ${LIBUSB_WIN_OUTPUT_FOLDER}/MinGW64/dll/libusb-1.0.dll
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
file(COPY ${LIBUSB_WIN_OUTPUT_FOLDER}/MinGW64/dll/libusb-1.0.dll
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR})
|
||||
endif ()
|
||||
|
||||
|
||||
###
|
||||
# Static library
|
||||
###
|
||||
|
@ -369,7 +382,11 @@ endif ()
|
|||
###
|
||||
|
||||
# MCU configuration files
|
||||
if (WIN32)
|
||||
set(CMAKE_CHIPS_DIR ${CMAKE_INSTALL_PREFIX}/config/chips)
|
||||
else ()
|
||||
set(CMAKE_CHIPS_DIR ${CMAKE_INSTALL_SHAREDIR}/${PROJECT_NAME}/chips)
|
||||
endif ()
|
||||
add_definitions( -DSTLINK_CHIPS_DIR="${CMAKE_CHIPS_DIR}" )
|
||||
file(GLOB CHIP_FILES ${CMAKE_SOURCE_DIR}/config/chips/*.chip)
|
||||
install(FILES ${CHIP_FILES} DESTINATION ${CMAKE_CHIPS_DIR})
|
||||
|
|
|
@ -8,7 +8,8 @@ On Windows users should ensure that the following software is installed:
|
|||
|
||||
- `git` (_optional, but recommended_)
|
||||
- `cmake`
|
||||
- `MinGW-w64` (7.0.0 or later) with GCC toolchain 8.1.0
|
||||
- `7-zip`
|
||||
- `MinGW-w64`
|
||||
|
||||
### Installation
|
||||
|
||||
|
@ -17,13 +18,13 @@ On Windows users should ensure that the following software is installed:
|
|||
Ensure that you add cmake to the $PATH system variable when following the instructions by the setup assistant.
|
||||
3. Install
|
||||
|
||||
- _EITHER_: **MinGW-w64** from <https://sourceforge.net/projects/mingw-w64> (mingw-w64-install.exe)<br />
|
||||
- _OR_: **MSVC toolchain** from Visual Studio Build Tools 2019
|
||||
- _EITHER_: Download **MinGW-w64** from <hhttp://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-win32/sjlj/x86_64-8.1.0-release-win32-sjlj-rt_v6-rev0.7z>. Extract content to `C:\mingw-w64\` and add `C:\mingw-w64\bin\` to PATH-Variable.<br />
|
||||
- _OR_: **MSVC toolchain** from Visual Studio Build Tools 2019
|
||||
|
||||
4. Create a new destination folder at a place of your choice
|
||||
5. Open the command-line (cmd.exe) and execute `cd C:\$Path-to-your-destination-folder$\`
|
||||
6. Fetch the project sourcefiles by running `git clone https://github.com/stlink-org/stlink.git`from the command-line (cmd.exe)<br />
|
||||
or download the stlink zip-sourcefolder from the Release page on GitHub
|
||||
or download and extract the stlink zip-sourcefolder from the Release page on GitHub.
|
||||
|
||||
#### MSVC toolchain - minimal installation
|
||||
|
||||
|
@ -48,11 +49,12 @@ Visual Studio IDE is not necessary, only Windows SDK & build tools are required
|
|||
|
||||
#### MinGW-w64
|
||||
|
||||
1. Use the command-line to move to the `scripts` directory within the source-folder: `cd stlink\scripts\`
|
||||
2. Execute `./mingw64-build.bat`
|
||||
1. Open command-line with administrator privileges
|
||||
2. Move to the `stlink` directory
|
||||
3. Execute `mingw64-build.bat`
|
||||
|
||||
NOTE:<br />
|
||||
Per default the build script (currently) uses `C:\Program Files\mingw-w64\x86_64-8.1.0-release-win32-sjlj-rt_v6-rev0\mingw64\bin`.<br />
|
||||
Per default the build script (currently) uses `C:\mingw-w64\x86_64-8.1.0-release-win32-sjlj-rt_v6-rev0\mingw64\bin`.<br />
|
||||
When installing different toolchains make sure to update the path in the `mingw64-build.bat`.<br />
|
||||
This can be achieved by opening the .bat file with a common text editor.
|
||||
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
mkdir build-mingw
|
||||
cd build-mingw
|
||||
set PATH=C:\Program Files (x86)\CMake\bin;C:\Program Files\CMake\bin;C:\Program Files\mingw-w64\x86_64-8.1.0-win32-sjlj-rt_v6-rev0\mingw64\bin;%PATH%
|
||||
set PATH=C:\Program Files (x86)\CMake\bin;C:\Program Files\CMake\bin;C:\mingw-w64\x86_64-8.1.0-win32-sjlj-rt_v6-rev0\mingw64\bin;%PATH%
|
||||
cmake -G "MinGW Makefiles" ..
|
||||
mingw32-make
|
||||
mingw32-make install DESTDIR=install
|
||||
mingw32-make install
|
||||
mingw32-make package
|
||||
cd ..
|
||||
|
|
Ładowanie…
Reference in New Issue