Skip to content

Commit 1f2d723

Browse files
committed
Initial commit
0 parents  commit 1f2d723

File tree

184 files changed

+81923
-0
lines changed

Some content is hidden

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

184 files changed

+81923
-0
lines changed

.gitignore

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Object files
2+
*.o
3+
*.def
4+
*.exp
5+
6+
# Libraries
7+
*.lib
8+
*.a
9+
10+
# Shared objects (inc. Windows DLLs)
11+
*.dll
12+
*.so
13+
*.so.*
14+
*.dylib
15+
16+
# Executables
17+
*.exe
18+
*.out
19+
*.app
20+
*.pyc
21+
22+
# Check outputs
23+
*.log
24+
*.trs
25+
*.lo
26+
27+
# autoconf
28+
29+
/autom4te.cache/
30+
/.dirstamp
31+
/ChangeLog
32+
/Makefile
33+
/assets/Makefile
34+
/assets/icons/Makefile
35+
/config.h
36+
/config.log
37+
/config.status
38+
/knot3d
39+
/debian/knot3d.debhelper.log
40+
/debian/knot3d/
41+
/src/Makefile
42+
/stamp-h1
43+
.deps/
44+
45+
# CMake
46+
#
47+
build/
48+
49+
# Specific files
50+
51+

.gitmodules

Whitespace-only changes.

AUTHORS

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Frank Stajano <[email protected]>
2+
David Llewellyn-Jones <[email protected]>

CMakeLists.txt

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
project(pico C)
2+
set(CMAKE_BUILD_TYPE Debug)
3+
4+
cmake_minimum_required(VERSION 3.0)
5+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/")
6+
option(USE_LIBPICOBT "Build with libbpicot support" TRUE)
7+
8+
if(USE_LIBPICOBT)
9+
add_definitions(-DHAVE_LIBPICOBT)
10+
find_package(Libpicobt REQUIRED)
11+
include_directories(${PICOBT_INCLUDE_DIRS})
12+
endif()
13+
14+
# only look in default directories
15+
find_path(
16+
CURL_INCLUDE_DIR
17+
NAMES curl/curl.h
18+
DOC "curl include dir"
19+
)
20+
21+
find_library(
22+
CURL_LIBRARY
23+
# names from cmake's FindCURL
24+
NAMES curl curllib libcurl_imp curllib_static libcurl
25+
DOC "curl library"
26+
)
27+
28+
set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
29+
set(CURL_LIBRARIES ${CURL_LIBRARY})
30+
31+
# debug library on windows
32+
# same naming convention as in qt (appending debug library with d)
33+
# boost is using the same "hack" as us with "optimized" and "debug"
34+
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
35+
find_library(
36+
CURL_LIBRARY_DEBUG
37+
NAMES curld libcurld
38+
DOC "curl debug library"
39+
)
40+
41+
set(CURL_LIBRARIES optimized ${CURL_LIBRARIES} debug ${CURL_LIBRARY_DEBUG})
42+
endif()
43+
message(STATUS "Curl include dir: " ${CURL_INCLUDE_DIRS})
44+
include_directories(${CURL_INCLUDE_DIRS})
45+
46+
find_package(OpenSSL REQUIRED)
47+
if( OPENSSL_FOUND )
48+
message(STATUS "Openssl include dir: " ${OPENSSL_INCLUDE_DIR})
49+
include_directories(${OPENSSL_INCLUDE_DIR})
50+
message(STATUS "Using OpenSSL ${OPENSSL_VERSION}")
51+
endif()
52+
53+
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
54+
file(GLOB SOURCES_LIBENCODE "libqrencode/*.c")
55+
list(REMOVE_ITEM SOURCES_LIBENCODE ${CMAKE_CURRENT_SOURCE_DIR}/libqrencode/qrenc.c)
56+
include_directories(libqrencode)
57+
add_definitions(-D__STATIC=static -DMAJOR_VERSION=3 -DMINOR_VERSION=4 -DMICRO_VERSION=4 -DVERSION="v3.4.4")
58+
add_library(qrencode STATIC ${SOURCES_LIBENCODE})
59+
endif()
60+
61+
include_directories(include)
62+
include_directories(tests)
63+
64+
file(GLOB SOURCES "src/*.c")
65+
66+
add_library(pico SHARED ${SOURCES})
67+
target_link_libraries (pico ${OPENSSL_LIBRARIES} ${CURL_LIBRARIES} ${PICOBT_LIBRARIES} qrencode)
68+
69+
install(TARGETS pico DESTINATION /usr/lib)

CMakeModules/FindLibpicobt.cmake

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# - Try to find the Pico libpicobt libraries
2+
# Once done this will define
3+
#
4+
# PICOBT_FOUND
5+
# PICOBT_INCLUDE_DIR
6+
# PICOBT_LIBRARIES
7+
#
8+
9+
INCLUDE( FindPkgConfig )
10+
11+
# Try to use PkgConfig. On Linux this should work happily
12+
# if the package is installed
13+
PKG_SEARCH_MODULE( PICOBT libpicobt )
14+
15+
IF( NOT PICOBT_FOUND )
16+
IF ( PICOBT_INSTALL_DIR )
17+
MESSAGE ( STATUS "Using override PICOBT_INSTALL_DIR to find libpicobt" )
18+
SET ( PICOBT_INCLUDE_DIR "${PICOBT_INSTALL_DIR}/include" )
19+
FIND_LIBRARY( PICOBT_LIBRARY NAMES picobt PATHS "${PICOBT_INSTALL_DIR}" )
20+
ENDIF ( PICOBT_INSTALL_DIR )
21+
22+
IF ( PICOBT_INCLUDE_DIR AND PICOBT_LIBRARY )
23+
SET( PICOBT_FOUND 1 )
24+
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
25+
SET ( PICOBT_LIBRARIES "${PICOBT_LIBRARY}" ws2_32 Bthprops )
26+
else()
27+
SET ( PICOBT_LIBRARIES "${PICOBT_LIBRARY}")
28+
endif()
29+
SET ( PICOBT_INCLUDE_DIRS "${PICOBT_INCLUDE_DIR}")
30+
ELSE()
31+
MESSAGE ( "Not possible to find libpicobt. Please set PICOBT_INCLUDE_DIR and PICOBT_LIBRARY variables" )
32+
ENDIF()
33+
34+
IF ( PICOBT_INCLUDE_DIRS AND PICOBT_LIBRARIES )
35+
SET( PICOBT_FOUND 1 )
36+
IF ( NOT Libpicobt_FIND_QUIETLY )
37+
MESSAGE ( STATUS "Found PICOBT: ${PICOBT_LIBRARIES}" )
38+
ENDIF ( NOT Libpicobt_FIND_QUIETLY )
39+
ELSE()
40+
IF( Libpicobt_FIND_REQUIRED )
41+
MESSAGE( FATAL_ERROR "Could NOT find PICOBT" )
42+
ELSE()
43+
IF( NOT Libpicobt_FIND_QUIETLY )
44+
MESSAGE( STATUS "Could NOT find PICOBT" )
45+
ENDIF()
46+
ENDIF()
47+
ENDIF()
48+
ELSE()
49+
MESSAGE ( STATUS "Libpicobt Include Dir: ${PICOBT_INCLUDE_DIRS}" )
50+
ENDIF()
51+
52+
# Hide advanced variables from CMake GUIs
53+
MARK_AS_ADVANCED( PICOBT_INCLUDE_DIRS PICOBT_LIBRARIES )
54+

0 commit comments

Comments
 (0)