Skip to content

Commit dee34a6

Browse files
committed
Add libsmb2 to deps
1 parent 3efaa0b commit dee34a6

192 files changed

Lines changed: 52331 additions & 0 deletions

File tree

Some content is hidden

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

deps/libsmb2/CMakeLists.txt

Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
if(NOT ESP_PLATFORM)
2+
3+
if(CMAKE_SYSTEM_NAME MATCHES NintendoSwitch OR CMAKE_SYSTEM_NAME MATCHES Nintendo3DS OR CMAKE_SYSTEM_NAME MATCHES Dreamcast OR CMAKE_SYSTEM_NAME MATCHES NintendoGameCube OR CMAKE_SYSTEM_NAME MATCHES NintendoDS OR CMAKE_SYSTEM_NAME MATCHES NintendoWii OR CMAKE_SYSTEM_NAME MATCHES CafeOS)
4+
cmake_minimum_required(VERSION 3.13)
5+
elseif(VITA)
6+
cmake_minimum_required(VERSION 3.2)
7+
elseif(PICO_BOARD)
8+
cmake_minimum_required(VERSION 3.12)
9+
message(STATUS "Configuring libsmb2 for ${PICO_BOARD}")
10+
else()
11+
cmake_minimum_required(VERSION 3.5)
12+
endif()
13+
14+
if(NOT IOP AND BUILD_IRX)
15+
project(smb2man
16+
LANGUAGES C
17+
VERSION 2.3.0
18+
)
19+
set(VERSION 2.3.0)
20+
set(PACKAGE "smb2man")
21+
set(PACKAGE_BUGREPORT "[email protected] or [email protected]")
22+
set(PACKAGE_NAME "smb2man")
23+
set(PACKAGE_VERSION "${VERSION}")
24+
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
25+
set(PACKAGE_TARNAME "${PACKAGE}")
26+
set(PACKAGE_URL "https://github.com/sahlberg/libsmb2")
27+
elseif(PICO_BOARD)
28+
project(libsmb2 C CXX ASM)
29+
else()
30+
project(libsmb2
31+
LANGUAGES C
32+
VERSION 6.1.0
33+
)
34+
set(VERSION 6.1.0)
35+
set(PACKAGE "libsmb2")
36+
set(PACKAGE_BUGREPORT "[email protected]")
37+
set(PACKAGE_NAME "libsmb2")
38+
set(PACKAGE_VERSION "${VERSION}")
39+
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
40+
set(PACKAGE_TARNAME "${PACKAGE}")
41+
set(PACKAGE_URL "https://github.com/sahlberg/libsmb2")
42+
endif()
43+
configure_file(libsmb2.pc.in libsmb2.pc @ONLY)
44+
endif()
45+
46+
if(NOT ESP_PLATFORM)
47+
set(SOVERSION 1 CACHE STRING "" FORCE)
48+
if(NOT IOP AND NOT BUILD_IRX)
49+
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH "Installation directory for libraries")
50+
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
51+
set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files")
52+
set(INSTALL_CMAKE_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/cmake/libsmb2" CACHE PATH "Installation directory for cmake (.cmake) files")
53+
endif()
54+
if(CMAKE_SYSTEM_NAME MATCHES NintendoSwitch OR CMAKE_SYSTEM_NAME MATCHES Nintendo3DS OR PS4 OR PS2 OR VITA OR CMAKE_SYSTEM_NAME MATCHES Dreamcast OR CMAKE_SYSTEM_NAME MATCHES NintendoGameCube OR CMAKE_SYSTEM_NAME MATCHES NintendoDS OR CMAKE_SYSTEM_NAME MATCHES NintendoWii OR CMAKE_SYSTEM_NAME MATCHES CafeOS)
55+
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
56+
else()
57+
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
58+
endif()
59+
option(ENABLE_EXAMPLES "Build example programs" OFF)
60+
option(ENABLE_LIBKRB5 "Enable libkrb5 support" ON)
61+
option(ENABLE_GSSAPI "Enable gssapi support" ON)
62+
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
63+
endif()
64+
65+
if(CMAKE_SYSTEM_NAME MATCHES Linux)
66+
if (ENABLE_LIBKRB5)
67+
find_package(LibKrb5)
68+
endif()
69+
elseif(IOS)
70+
if (ENABLE_GSSAPI)
71+
find_package(GSSAPI)
72+
endif()
73+
endif()
74+
75+
if(NOT ESP_PLATFORM)
76+
include(cmake/ConfigureChecks.cmake)
77+
endif()
78+
79+
if(PICO_BOARD)
80+
include_directories(libsmb2 STATIC
81+
${PICO_SDK_PATH}/lib/lwip/src/include
82+
${PICO_SDK_PATH}/src/rp2_common/pico_lwip/include
83+
lib
84+
include
85+
include/smb2
86+
include/picow
87+
)
88+
elseif(ESP_PLATFORM)
89+
set(COMPONENT_ADD_INCLUDEDIRS
90+
"lib"
91+
include
92+
include/smb2
93+
include/esp
94+
)
95+
else()
96+
include_directories(${CMAKE_CURRENT_BINARY_DIR}
97+
include
98+
include/smb2
99+
)
100+
endif()
101+
102+
if(CMAKE_SYSTEM_NAME MATCHES Linux)
103+
if (ENABLE_LIBKRB5)
104+
set(core_DEPENDS ${LIBKRB5_LIBRARY} CACHE STRING "" FORCE)
105+
endif()
106+
elseif(IOS)
107+
if (ENABLE_GSSAPI)
108+
set(core_DEPENDS ${GSSAPI_LIBRARIES} CACHE STRING "" FORCE)
109+
endif()
110+
endif()
111+
112+
if(MSVC AND BUILD_SHARED_LIBS)
113+
# If we are building dll with msvc, then generate a def file according to the syms file
114+
set(SYMS_FILE_PATH "${PROJECT_SOURCE_DIR}/lib/libsmb2.syms")
115+
set(DEF_FILE_PATH "${PROJECT_BINARY_DIR}/lib/libsmb2.def")
116+
file(READ ${SYMS_FILE_PATH} EXPORT_SYMBOLS)
117+
file(WRITE ${DEF_FILE_PATH} "LIBRARY smb2\nEXPORTS\n\n${EXPORT_SYMBOLS}")
118+
# Pass def file to the linker
119+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEF:${DEF_FILE_PATH}")
120+
endif()
121+
122+
if(CMAKE_SYSTEM_NAME MATCHES Windows)
123+
list(APPEND CORE_LIBRARIES ws2_32.lib)
124+
add_definitions(-DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_WARNINGS -DHAVE_LINGER -DNEED_GETLOGIN_R -DNEED_GETPID -DNEED_RANDOM -DNEED_SRANDOM)
125+
elseif(CMAKE_SYSTEM_NAME MATCHES NintendoSwitch)
126+
add_definitions(-DARM11 -DSWITCH -D__SWITCH__ -DNEED_READV -DNEED_WRITEV -DNEED_GETLOGIN_R)
127+
set(ARCH "-march=armv8-a -mtp=soft -fPIE")
128+
set(CMAKE_C_FLAGS "-g -Wall -O2 -ffast-math ${ARCH}")
129+
set(CMAKE_C_FLAGS "-Wno-unused-variable")
130+
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fno-rtti -std=gnu11")
131+
set(CMAKE_C_LDFLAGS "${CMAKE_C_FLAGS} -specs=switch.specs -g ${ARCH} -Wl,-Map,$(notdir $*.map)")
132+
add_compile_options("${CMAKE_C_FLAGS} ${CMAKE_LDFLAGS}")
133+
elseif(CMAKE_SYSTEM_NAME MATCHES Nintendo3DS)
134+
add_definitions(-DARM11 -D_3DS -D__3DS__ -DNEED_READV -DNEED_WRITEV -DNEED_GETLOGIN_R)
135+
set(ARCH "-march=armv6k -mfloat-abi=hard -mtune=mpcore -mtp=soft -fPIE")
136+
set(CMAKE_C_FLAGS "-Wno-unused-variable -g -Wall -O2 -mword-relocations -fomit-frame-pointer -ffast-math ${ARCH}")
137+
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fno-rtti -fno-exceptions -std=gnu11")
138+
set(CMAKE_C_LDFLAGS "${CMAKE_C_FLAGS} -specs=3dsx.specs -g ${ARCH} -Wl,-Map,$(notdir $*.map)")
139+
add_compile_options("${CMAKE_C_FLAGS} ${CMAKE_LDFLAGS}")
140+
elseif(CMAKE_SYSTEM_NAME MATCHES NintendoDS)
141+
add_definitions(-DARM9 -D__NDS__ -DNEED_READV -DHAVE_SOCKADDR_STORAGE -DNEED_WRITEV -DNEED_GETLOGIN_R -DNEED_GETADDRINFO -DNEED_FREEADDRINFO -DNEED_POLL)
142+
set(CMAKE_C_FLAGS "-Wno-format -Wpointer-arith")
143+
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -fno-rtti -fno-exceptions -std=gnu11")
144+
set(CMAKE_C_LDFLAGS "${CMAKE_C_FLAGS} -specs=ds_arm9.specs -g")
145+
add_compile_options("${CMAKE_C_FLAGS} ${CMAKE_LDFLAGS}")
146+
elseif(CMAKE_SYSTEM_NAME MATCHES NintendoGameCube)
147+
add_definitions(-DGEKKO -D__GC__ -DNEED_READV -DNEED_WRITEV -DNEED_GETLOGIN_R -DNEED_GETADDRINFO -DNEED_FREEADDRINFO -DNEED_POLL)
148+
set(CMAKE_C_FLAGS "-g")
149+
#-O3 -Wall
150+
add_compile_options("${CMAKE_C_FLAGS}")
151+
elseif(CMAKE_SYSTEM_NAME MATCHES NintendoWii)
152+
add_definitions(-DGEKKO -D__WII__ -DNEED_READV -DNEED_WRITEV -DNEED_GETLOGIN_R -DNEED_GETADDRINFO -DNEED_FREEADDRINFO -DNEED_POLL)
153+
set(CMAKE_C_FLAGS "-g")
154+
#-O3 -Wall
155+
add_compile_options("${CMAKE_C_FLAGS}")
156+
elseif(CMAKE_SYSTEM_NAME MATCHES CafeOS)
157+
add_definitions(-D__WIIU__ -DNEED_READV -DNEED_WRITEV -DNEED_GETLOGIN_R)
158+
set(CMAKE_C_FLAGS "-g")
159+
#-O3 -Wall
160+
add_compile_options("${CMAKE_C_FLAGS}")
161+
elseif(PS4)
162+
add_definitions(-DPS4_PLATFORM)
163+
set(CMAKE_C_FLAGS "-funwind-tables")
164+
#-fuse-init-array -emit-llvm broken...
165+
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
166+
add_compile_options("${CMAKE_C_FLAGS}")
167+
elseif(EE)
168+
add_definitions(-DNEED_BE64TOH -DNEED_POLL -DNEED_WRITEV -DNEED_READV -DNEED_GETLOGIN_R)
169+
if(EE AND PS2RPC)
170+
add_definitions(-DPS2RPC)
171+
endif()
172+
elseif(IOP)
173+
add_definitions(-G 0 -DHAVE_CONFIG_H -DNEED_BE64TOH -DNEED_STRDUP -DNEED_READV -DNEED_WRITEV -DNEED_POLL -DNEED_GETPID -DNEED_RANDOM -DNEED_SRANDOM -DNEED_GETLOGIN_R -DHAVE_SYS_FCNTL_H)
174+
if(IOP AND BUILD_IRX)
175+
add_definitions(-D__ps2sdk_iop__)
176+
if(DEBUG)
177+
add_definitions(-DDEBUG)
178+
endif()
179+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fno-builtin")
180+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s")
181+
endif()
182+
set(CMAKE_C_FLAGS "-Wall")
183+
include_directories(${CMAKE_CURRENT_BINARY_DIR} include/ps2)
184+
add_compile_options("${CMAKE_C_FLAGS}")
185+
elseif(VITA)
186+
add_definitions(-DNEED_READV -DNEED_WRITEV -DNEED_GETLOGIN_R)
187+
elseif(PICO_BOARD)
188+
add_definitions(-DNEED_BE64TOH -DNEED_POLL -DNEED_GETLOGIN_R)
189+
elseif(ESP_PLATFORM)
190+
if(NOT CMAKE_BUILD_EARLY_EXPANSION)
191+
add_definitions(-DHAVE_CONFIG_H)
192+
endif()
193+
add_definitions(-DNEED_READV -DNEED_WRITEV -DNEED_GETLOGIN_R -DNEED_RANDOM -DNEED_SRANDOM)
194+
elseif(CMAKE_SYSTEM_NAME MATCHES Dreamcast)
195+
add_definitions(-DNEED_WRITEV -DNEED_READV -DHAVE_CONFIG_H -DNEED_GETLOGIN_R)
196+
elseif(CMAKE_SYSTEM_NAME STREQUAL Solaris)
197+
find_library(SOCKET_LIBRARY socket)
198+
find_library(NSL_LIBRARY nsl)
199+
list(APPEND CORE_LIBRARIES ${SOCKET_LIBRARY} ${NSL_LIBRARY})
200+
endif()
201+
202+
203+
if(ENABLE_EXAMPLES)
204+
add_subdirectory(examples)
205+
endif()
206+
207+
add_subdirectory(lib)
208+
209+
if(NOT PICO_BOARD OR ESP_PLATFORM)
210+
include(CMakePackageConfigHelpers)
211+
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/libsmb2-config-version.cmake
212+
VERSION ${PROJECT_VERSION}
213+
COMPATIBILITY AnyNewerVersion)
214+
if(NOT IOP AND NOT BUILD_IRX)
215+
configure_file(cmake/libsmb2.pc.cmake
216+
${CMAKE_CURRENT_BINARY_DIR}/libsmb2.pc @ONLY)
217+
218+
install(DIRECTORY include/smb2
219+
DESTINATION ${INSTALL_INC_DIR})
220+
221+
install(FILES cmake/FindSMB2.cmake
222+
${CMAKE_CURRENT_BINARY_DIR}/libsmb2-config-version.cmake
223+
DESTINATION ${INSTALL_CMAKE_DIR})
224+
225+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libsmb2.pc
226+
DESTINATION ${INSTALL_PKGCONFIG_DIR})
227+
endif()
228+
endif()
229+

deps/libsmb2/COPYING

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Libsmb2 components fall under two separate licences
2+
3+
4+
The lib and include directories
5+
===============================
6+
The smb2 client library itself, i.e. the lib and include directories,
7+
is licenced under GNU Lesser General Public License as published by
8+
the Free Software Foundation; either version 2.1 of the License, or
9+
(at your option) any later version.
10+
11+
A copy of LGPL 2.1 is included in the file LICENCE-LGPL-2.1.txt but can also be downloaded from http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
12+
13+
This is the licence that applies to the libsmb2 library and its use.
14+
15+
16+
17+
The examples directory
18+
======================
19+
The example applications using this library, i.e. the examples directory,
20+
is licenced under 2-Clause BSD License.
21+
22+
These are executable applications that link with the libsmb2 library.
23+
24+
To avoid any confusion, every source file also contain a licence boilerplate.

0 commit comments

Comments
 (0)