Skip to content

Commit d955f05

Browse files
authored
Merge pull request #164 from DenverM80/build_windows
Build windows
2 parents 81498f4 + ca9c81c commit d955f05

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+926
-496
lines changed

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Makefile.in
2020
.deps/
2121
.dirstamp
2222
.libs/
23+
*.a
2324
*.o
2425
*.l[ao]
2526
*~
@@ -28,3 +29,18 @@ Makefile.in
2829
!/cpp_sample/Makefile
2930
/win32/output
3031
/win32/ds3.zip
32+
CMakeCache.txt
33+
CMakeFiles
34+
cmake_install.cmake
35+
*.vcxproj*
36+
*.sdf
37+
*.sln
38+
*.suo
39+
*.opensdf
40+
Debug/
41+
*.dir/
42+
*.exe
43+
*.ilk
44+
*.pdb
45+
ds3.dll
46+
/win32/output/bin

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
cmake_minimum_required(VERSION 2.8)
2+
project(libds3)
3+
4+
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/")
5+
6+
set (DS3SDK_VERSION_MAJOR 3)
7+
set (DS3SDK_VERSION_MINOR 2)
8+
set (DS3SDK_VERSION_PATCH 0)
9+
10+
add_subdirectory(src)

Makefile.am

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

configure.ac

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

modules/FindGLIB2.cmake

Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
# - Try to find GLib2
2+
# Once done this will define
3+
#
4+
# GLIB2_FOUND - system has GLib2
5+
# GLIB2_INCLUDE_DIRS - the GLib2 include directory
6+
# GLIB2_LIBRARIES - Link these to use GLib2
7+
#
8+
# HAVE_GLIB_GREGEX_H glib has gregex.h header and
9+
# supports g_regex_match_simple
10+
#
11+
# Copyright (c) 2006 Andreas Schneider <[email protected]>
12+
# Copyright (c) 2006 Philippe Bernery <[email protected]>
13+
# Copyright (c) 2007 Daniel Gollub <[email protected]>
14+
# Copyright (c) 2007 Alban Browaeys <[email protected]>
15+
# Copyright (c) 2008 Michael Bell <[email protected]>
16+
# Copyright (c) 2008 Bjoern Ricks <[email protected]>
17+
#
18+
# Redistribution and use is allowed according to the terms of the New
19+
# BSD license.
20+
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
21+
#
22+
23+
24+
IF (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS )
25+
# in cache already
26+
SET(GLIB2_FOUND TRUE)
27+
ELSE (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS )
28+
29+
INCLUDE(FindPkgConfig)
30+
31+
## Glib
32+
IF ( GLIB2_FIND_REQUIRED )
33+
SET( _pkgconfig_REQUIRED "REQUIRED" )
34+
ELSE ( GLIB2_FIND_REQUIRED )
35+
SET( _pkgconfig_REQUIRED "" )
36+
ENDIF ( GLIB2_FIND_REQUIRED )
37+
38+
IF ( GLIB2_MIN_VERSION )
39+
PKG_SEARCH_MODULE( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0>=${GLIB2_MIN_VERSION} )
40+
ELSE ( GLIB2_MIN_VERSION )
41+
PKG_SEARCH_MODULE( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0 )
42+
ENDIF ( GLIB2_MIN_VERSION )
43+
IF ( PKG_CONFIG_FOUND )
44+
IF ( GLIB2_FOUND )
45+
SET ( GLIB2_CORE_FOUND TRUE )
46+
ELSE ( GLIB2_FOUND )
47+
SET ( GLIB2_CORE_FOUND FALSE )
48+
ENDIF ( GLIB2_FOUND )
49+
ENDIF ( PKG_CONFIG_FOUND )
50+
51+
# Look for glib2 include dir and libraries w/o pkgconfig
52+
IF ( NOT GLIB2_FOUND AND NOT PKG_CONFIG_FOUND )
53+
FIND_PATH(
54+
_glibconfig_include_DIR
55+
NAMES
56+
glibconfig.h
57+
PATHS
58+
/opt/gnome/lib64
59+
/opt/gnome/lib
60+
/opt/lib/
61+
/opt/local/lib
62+
/sw/lib/
63+
/usr/lib64
64+
/usr/lib
65+
/usr/local/include
66+
${CMAKE_LIBRARY_PATH}
67+
PATH_SUFFIXES
68+
glib-2.0/include
69+
)
70+
71+
FIND_PATH(
72+
_glib2_include_DIR
73+
NAMES
74+
glib.h
75+
PATHS
76+
/opt/gnome/include
77+
/opt/local/include
78+
/sw/include
79+
/usr/include
80+
/usr/local/include
81+
PATH_SUFFIXES
82+
glib-2.0
83+
)
84+
85+
#MESSAGE(STATUS "Glib headers: ${_glib2_include_DIR}")
86+
87+
FIND_LIBRARY(
88+
_glib2_link_DIR
89+
NAMES
90+
glib-2.0
91+
glib
92+
PATHS
93+
/opt/gnome/lib
94+
/opt/local/lib
95+
/sw/lib
96+
/usr/lib
97+
/usr/local/lib
98+
)
99+
IF ( _glib2_include_DIR AND _glib2_link_DIR )
100+
SET ( _glib2_FOUND TRUE )
101+
ENDIF ( _glib2_include_DIR AND _glib2_link_DIR )
102+
103+
104+
IF ( _glib2_FOUND )
105+
SET ( GLIB2_INCLUDE_DIRS ${_glib2_include_DIR} ${_glibconfig_include_DIR} )
106+
SET ( GLIB2_LIBRARIES ${_glib2_link_DIR} )
107+
SET ( GLIB2_CORE_FOUND TRUE )
108+
ELSE ( _glib2_FOUND )
109+
SET ( GLIB2_CORE_FOUND FALSE )
110+
ENDIF ( _glib2_FOUND )
111+
112+
# Handle dependencies
113+
# libintl
114+
IF ( NOT LIBINTL_FOUND )
115+
FIND_PATH(LIBINTL_INCLUDE_DIR
116+
NAMES
117+
libintl.h
118+
PATHS
119+
/opt/gnome/include
120+
/opt/local/include
121+
/sw/include
122+
/usr/include
123+
/usr/local/include
124+
)
125+
126+
FIND_LIBRARY(LIBINTL_LIBRARY
127+
NAMES
128+
intl
129+
PATHS
130+
/opt/gnome/lib
131+
/opt/local/lib
132+
/sw/lib
133+
/usr/local/lib
134+
/usr/lib
135+
)
136+
137+
IF (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR)
138+
SET (LIBINTL_FOUND TRUE)
139+
ENDIF (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR)
140+
ENDIF ( NOT LIBINTL_FOUND )
141+
142+
# libiconv
143+
IF ( NOT LIBICONV_FOUND )
144+
FIND_PATH(LIBICONV_INCLUDE_DIR
145+
NAMES
146+
iconv.h
147+
PATHS
148+
/opt/gnome/include
149+
/opt/local/include
150+
/opt/local/include
151+
/sw/include
152+
/sw/include
153+
/usr/local/include
154+
/usr/include
155+
PATH_SUFFIXES
156+
glib-2.0
157+
)
158+
159+
FIND_LIBRARY(LIBICONV_LIBRARY
160+
NAMES
161+
iconv
162+
PATHS
163+
/opt/gnome/lib
164+
/opt/local/lib
165+
/sw/lib
166+
/usr/lib
167+
/usr/local/lib
168+
)
169+
170+
IF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR)
171+
SET (LIBICONV_FOUND TRUE)
172+
ENDIF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR)
173+
ENDIF ( NOT LIBICONV_FOUND )
174+
175+
IF (LIBINTL_FOUND)
176+
SET (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBINTL_LIBRARY})
177+
SET (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBINTL_INCLUDE_DIR})
178+
ENDIF (LIBINTL_FOUND)
179+
180+
IF (LIBICONV_FOUND)
181+
SET (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBICONV_LIBRARY})
182+
SET (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBICONV_INCLUDE_DIR})
183+
ENDIF (LIBICONV_FOUND)
184+
185+
ENDIF ( NOT GLIB2_FOUND AND NOT PKG_CONFIG_FOUND )
186+
##
187+
188+
IF (GLIB2_CORE_FOUND AND GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES)
189+
SET (GLIB2_FOUND TRUE)
190+
ENDIF (GLIB2_CORE_FOUND AND GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES)
191+
192+
IF (GLIB2_FOUND)
193+
IF (NOT GLIB2_FIND_QUIETLY)
194+
MESSAGE (STATUS "Found GLib2: ${GLIB2_LIBRARIES} ${GLIB2_INCLUDE_DIRS}")
195+
ENDIF (NOT GLIB2_FIND_QUIETLY)
196+
ELSE (GLIB2_FOUND)
197+
IF (GLIB2_FIND_REQUIRED)
198+
MESSAGE (SEND_ERROR "Could not find GLib2")
199+
ENDIF (GLIB2_FIND_REQUIRED)
200+
ENDIF (GLIB2_FOUND)
201+
202+
# show the GLIB2_INCLUDE_DIRS and GLIB2_LIBRARIES variables only in the advanced view
203+
MARK_AS_ADVANCED(GLIB2_INCLUDE_DIRS GLIB2_LIBRARIES)
204+
MARK_AS_ADVANCED(LIBICONV_INCLUDE_DIR LIBICONV_LIBRARY)
205+
MARK_AS_ADVANCED(LIBINTL_INCLUDE_DIR LIBINTL_LIBRARY)
206+
207+
ENDIF (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS)
208+
209+
IF ( GLIB2_FOUND )
210+
# Check if system has a newer version of glib
211+
# which supports g_regex_match_simple
212+
INCLUDE( CheckIncludeFiles )
213+
SET( CMAKE_REQUIRED_INCLUDES ${GLIB2_INCLUDE_DIRS} )
214+
CHECK_INCLUDE_FILES ( glib/gregex.h HAVE_GLIB_GREGEX_H )
215+
# Reset CMAKE_REQUIRED_INCLUDES
216+
SET( CMAKE_REQUIRED_INCLUDES "" )
217+
ENDIF( GLIB2_FOUND )

src/CMakeLists.txt

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
if (WIN32)
2+
set(WINDOWS_VS_OUTPUT_DIR ${PROJECT_SOURCE_DIR}/win32/output/bin)
3+
4+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${WINDOWS_VS_OUTPUT_DIR})
5+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${WINDOWS_VS_OUTPUT_DIR})
6+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${WINDOWS_VS_OUTPUT_DIR})
7+
8+
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
9+
string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG )
10+
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${WINDOWS_VS_OUTPUT_DIR} )
11+
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${WINDOWS_VS_OUTPUT_DIR} )
12+
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${WINDOWS_VS_OUTPUT_DIR} )
13+
endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES )
14+
endif(WIN32)
15+
16+
add_library(ds3 SHARED
17+
ds3.h ds3.c
18+
ds3_net.h ds3_net.c
19+
ds3_request.h
20+
ds3_string_multimap_impl.h ds3_string_multimap_impl.c
21+
ds3_string_multimap.h ds3_string_multimap.c
22+
ds3_string.h ds3_string.c
23+
ds3_utils.h ds3_utils.c
24+
ds3_connection.h ds3_connection.c)
25+
26+
if (WIN32)
27+
28+
add_definitions(-DLIBRARY_EXPORTS -DCURL_STATICLIB -Dinline=__inline)
29+
set_property(TARGET ds3 PROPERTY _CRT_SECURE_NO_WARNINGS)
30+
SET_SOURCE_FILES_PROPERTIES(ds3.c PROPERTIES LANGUAGE CXX)
31+
32+
include_directories(
33+
../win32/deps/install/include
34+
../win32/deps/install/include/glib-2.0
35+
../win32/deps/install/lib/glib-2.0/include
36+
../win32/compatibility_includes)
37+
target_link_libraries(ds3
38+
../win32/deps/install/lib/libcurl_a
39+
../win32/deps/install/lib/zlib_a
40+
../win32/deps/install/lib/libxml2_a
41+
../win32/deps/install/lib/glib-2.0
42+
Ws2_32)
43+
44+
file(TO_NATIVE_PATH ${WINDOWS_VS_OUTPUT_DIR}/ds3.dll DLL_LOCATION)
45+
file(TO_NATIVE_PATH ${PROJECT_SOURCE_DIR}/test/bin UNIT_TEST_DIR)
46+
ADD_CUSTOM_COMMAND(TARGET ds3 POST_BUILD
47+
COMMAND copy
48+
${DLL_LOCATION} ${UNIT_TEST_DIR})
49+
else(WIN32)
50+
find_package(LibXml2 2.9 REQUIRED)
51+
find_package(CURL 7.31 REQUIRED)
52+
find_package(GLIB2 2.34 REQUIRED)
53+
54+
if (LIBXML2_FOUND)
55+
include_directories(${LIBXML2_INCLUDE_DIR})
56+
target_link_libraries (ds3 ${LIBXML2_LIBRARIES})
57+
endif (LIBXML2_FOUND)
58+
59+
if (CURL_FOUND)
60+
include_directories(${CURL_INCLUDE_DIRS})
61+
target_link_libraries (ds3 ${CURL_LIBRARIES})
62+
endif (CURL_FOUND)
63+
64+
if (GLIB2_FOUND)
65+
include_directories(${GLIB2_INCLUDE_DIRS})
66+
target_link_libraries (ds3 ${GLIB2_LIBRARIES})
67+
endif(GLIB2_FOUND)
68+
69+
install(FILES "ds3.h" "ds3_utils.h" "ds3_net.h" "ds3_request.h" "ds3_string_multimap_impl.h" "ds3_string_multimap.h" "ds3_string.h" "ds3_connection.h"
70+
DESTINATION "/usr/local/include")
71+
install(TARGETS ds3 DESTINATION lib)
72+
endif(WIN32)

src/Makefile.am

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

0 commit comments

Comments
 (0)