libyaml
libyaml copied to clipboard
How to build libyaml on Windows?
Prerequisites:
- Download Visual Studio Installer
- From Visual Studio Build Tools, install Visual C++ build tools. Select the following components
- Visual C++ Build Tools core features
- VC++ 2017 version 15.9 v14.16 latest v141 tools
- Visual C++ 2017 Redistributable Update
- Windows 10 SDK (10.0.17763.0)
- Visual C++ tools for CMake
- Testing tools core features - Build Tools
- Install Cmake
Build:
- Clone the repository (the bundled tgz missing some files)
- Find the actual build steps to build a static library in the CI files: appveyor.yml
cmake . cmake --build . --config Release --clean-first ctest -C Release - This will generate
Release/OFF.lib
Fix the output library name
The following diff shows how to fix output library name generated by cmake
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,9 +6,9 @@ set (YAML_VERSION_MAJOR 0)
set (YAML_VERSION_MINOR 2)
set (YAML_VERSION_PATCH 2)
set (YAML_VERSION_STRING "${YAML_VERSION_MAJOR}.${YAML_VERSION_MINOR}.${YAML_VERSION_PATCH}")
+set (YAML_STATIC_LIB_NAME "yaml")
option(BUILD_SHARED_LIBS "Build libyaml as a shared library" OFF)
-option(YAML_STATIC_LIB_NAME "base name of static library output" yaml)
#
# Output directories for a build tree
Build DLL
cmake -DBUILD_SHARED_LIBS=ON .
cmake --build . --config Release --clean-first
ctest -C Release
Prerequisites:
* Download Visual Studio Installer * From Visual Studio Build Tools, install Visual C++ build tools. Select the following components * Visual C++ Build Tools core features * VC++ 2017 version 15.9 v14.16 latest v141 tools * Visual C++ 2017 Redistributable Update * Windows 10 SDK (10.0.17763.0) * Visual C++ tools for CMake * Testing tools core features - Build Tools * Install CmakeBuild:
* Clone the repository (the bundled tgz missing some files) * Find the actual build steps to build a static library in the CI files: [appveyor.yml](https://github.com/yaml/libyaml/blob/master/appveyor.yml) ``` cmake . cmake --build . --config Release --clean-first ctest -C Release ``` * This will generate `Release/OFF.lib`Fix the output library name
The following diff shows how to fix output library name generated by cmake
--- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,9 +6,9 @@ set (YAML_VERSION_MAJOR 0) set (YAML_VERSION_MINOR 2) set (YAML_VERSION_PATCH 2) set (YAML_VERSION_STRING "${YAML_VERSION_MAJOR}.${YAML_VERSION_MINOR}.${YAML_VERSION_PATCH}") +set (YAML_STATIC_LIB_NAME "yaml") option(BUILD_SHARED_LIBS "Build libyaml as a shared library" OFF) -option(YAML_STATIC_LIB_NAME "base name of static library output" yaml) # # Output directories for a build treeBuild DLL
cmake -DBUILD_SHARED_LIBS=ON . cmake --build . --config Release --clean-first ctest -C Release
By default it's 32 bits or 64 bits? How do you set an specific tag to compile to 32 or 64 bits?
cmake . -DCMAKE_GENERATOR_PLATFORM=x64?