Skip to content

Commit

Permalink
yaml: Attempt to build the DLL and LIB libraries on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
jakirkham committed Apr 20, 2016
1 parent 115cdb3 commit 4c2335e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
25 changes: 25 additions & 0 deletions recipes/yaml/CMakeLists.txt.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git CMakeLists.txt CMakeLists.txt
index e84c28c..eab70b2 100644
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -3,6 +3,13 @@
cmake_minimum_required (VERSION 2.8)
project (yaml C)

+# Allow the developer to select if Dynamic or Static libraries are built
+OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
+SET (LIB_TYPE STATIC)
+IF (BUILD_SHARED_LIBS)
+ SET (LIB_TYPE SHARED)
+ENDIF (BUILD_SHARED_LIBS)
+
set (YAML_VERSION_MAJOR 0)
set (YAML_VERSION_MINOR 1)
set (YAML_VERSION_PATCH 6)
@@ -12,5 +19,4 @@ file (GLOB SRC src/*.c)

include_directories (include win32)
add_definitions (-DHAVE_CONFIG_H -DYAML_DECLARE_STATIC)
-add_library (yaml STATIC ${SRC})
-
+add_library (yaml ${LIB_TYPE} ${SRC})
22 changes: 16 additions & 6 deletions recipes/yaml/bld.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ if errorlevel 1 exit 1
cd build
if errorlevel 1 exit 1

cmake -G ^
"NMake Makefiles" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
..

for %%IS_SHARED in (
"on"
"off"
) do (
cmake -G ^
"NMake Makefiles" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
-DBUILD_SHARED_LIBS=%%IS_SHARED ^
..
if errorlevel 1 exit 1

nmake
Expand All @@ -19,9 +25,13 @@ if errorlevel 1 exit 1
::
:: ctest
:: if errorlevel 1 exit 1
)

copy ..\include\yaml.h %LIBRARY_INC%
if errorlevel 1 exit 1

copy yaml.dll %LIBRARY_BIN%
if errorlevel 1 exit 1

copy yaml.lib %LIBRARY_LIB%
if errorlevel 1 exit 1
3 changes: 3 additions & 0 deletions recipes/yaml/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ source:
fn: yaml-{{ version }}.tar.gz
url: http://pyyaml.org/download/libyaml/yaml-{{ version }}.tar.gz
md5: 5fe00cda18ca5daeb43762b80c38e06e
patches:
# Change CMakeLists so that we can build static and shared libraries.
- CMakeLists.txt.patch

build:
number: 0
Expand Down

0 comments on commit 4c2335e

Please sign in to comment.