libtabula

Check-in [e9bcb962a4]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Manually merged the recent pthread changes from the mysql-type-info branch into trunk, where they should have been all along.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e9bcb962a45919228c837655cc33b1c493dad904
User & Date: etr 2015-08-10 23:12:20
Context
2015-08-10
23:34
Moved the "tags" target to the top level. It's no use down in src. check-in: 0c16a98c03 user: etr tags: trunk
23:12
Manually merged the recent pthread changes from the mysql-type-info branch into trunk, where they should have been all along. check-in: e9bcb962a4 user: etr tags: trunk
22:38
Conditionally using Boost and C++11 cstdint header instead of C99's stdint.h for stock sql_* data types, where available. check-in: 72280af4f6 user: etr tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to CMakeLists.txt.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
..
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
..
63
64
65
66
67
68
69

70
71
72
73
74
75
76
...
101
102
103
104
105
106
107







108
109
110
111
112
113
114
# CMakeLists.txt - Tells CMake how to build the libtabula system on 
#      supported platforms.  See */CMakeLists.txt for build details of
#      each element of the system.
#
# Created 2014.08.21 by Warren Young
#
# Copyright © 2014 by Warren Young
#
# Others may also hold copyrights on code in this file.  See the
# CREDITS.md file in the top directory of the distribution for details.
#
# This file is part of libtabula.
#
# libtabula is free software; you can redistribute it and/or modify it
................................................................................
#   - nolib
#   - noopt
#   - notest
#   - pedantic
#
# - Replicate existing autoconf behavior:
#   - Detect existence of <slist> etc.
#   - Thread awareness selection
#   - SSL support detection in mysqlclient
#
# - Add other build options
#   - Add analog of --with-field-limit to src/CMakeLists.txt, modifying
#     the calls to querydef.pl and ssqls.pl
#   
# - Try to get rid of install.hta on Windows, in favor of CMake's
................................................................................
#   - Cygwin
#   - CentOS 3?
#   - OpenIndiana
#
# - For each success above with CMake < 2.6, lower minimum requirement
#
# - Convert non-core top-level targets

#   - dist/rpm/deb/ebuild... via CPack
#   - abicheck
#
# ---------------------

cmake_minimum_required(VERSION 2.6)

................................................................................
			message(SEND_ERROR "WARNING: no 'stdint' type header found!")
		endif()
	endif()
endif()

set(MYSQL_FIND_REQUIRED 1)
find_package(MySQL)








CHECK_SYMBOL_EXISTS(getopt unistd.h HAVE_POSIX_GETOPT)
if (NOT HAVE_POSIX_GETOPT)
	CHECK_SYMBOL_EXISTS(getopt libiberty.h HAVE_LIBIBERTY_GETOPT)
endif()

CHECK_FUNCTION_EXISTS(localtime_r HAVE_LOCALTIME_R)






|







 







<







 







>







 







>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
..
36
37
38
39
40
41
42

43
44
45
46
47
48
49
..
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
...
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# CMakeLists.txt - Tells CMake how to build the libtabula system on 
#      supported platforms.  See */CMakeLists.txt for build details of
#      each element of the system.
#
# Created 2014.08.21 by Warren Young
#
# Copyright © 2014-2015 by Warren Young
#
# Others may also hold copyrights on code in this file.  See the
# CREDITS.md file in the top directory of the distribution for details.
#
# This file is part of libtabula.
#
# libtabula is free software; you can redistribute it and/or modify it
................................................................................
#   - nolib
#   - noopt
#   - notest
#   - pedantic
#
# - Replicate existing autoconf behavior:
#   - Detect existence of <slist> etc.

#   - SSL support detection in mysqlclient
#
# - Add other build options
#   - Add analog of --with-field-limit to src/CMakeLists.txt, modifying
#     the calls to querydef.pl and ssqls.pl
#   
# - Try to get rid of install.hta on Windows, in favor of CMake's
................................................................................
#   - Cygwin
#   - CentOS 3?
#   - OpenIndiana
#
# - For each success above with CMake < 2.6, lower minimum requirement
#
# - Convert non-core top-level targets
#   - tags
#   - dist/rpm/deb/ebuild... via CPack
#   - abicheck
#
# ---------------------

cmake_minimum_required(VERSION 2.6)

................................................................................
			message(SEND_ERROR "WARNING: no 'stdint' type header found!")
		endif()
	endif()
endif()

set(MYSQL_FIND_REQUIRED 1)
find_package(MySQL)

find_package(Threads)
if (CMAKE_HAVE_THREADS_LIBRARY)
	set(MYSQL_C_API_LIBRARY mysqlclient_r)
else()
	set(MYSQL_C_API_LIBRARY mysqlclient)
endif()

CHECK_SYMBOL_EXISTS(getopt unistd.h HAVE_POSIX_GETOPT)
if (NOT HAVE_POSIX_GETOPT)
	CHECK_SYMBOL_EXISTS(getopt libiberty.h HAVE_LIBIBERTY_GETOPT)
endif()

CHECK_FUNCTION_EXISTS(localtime_r HAVE_LOCALTIME_R)

Changes to examples/CMakeLists.txt.

1
2
3
4
5
6
7

8
9
10
11
12
13
14
..
33
34
35
36
37
38
39
40
41
42
43
44
45
46

47


48
49
50

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96

97
98
99
100
101


102
103
104
105
106
107
108
109
110
111


# CMakeLists.txt - Tells CMake how to build the libtabula examples on
#      supported platforms.  See ../CMakeLists.txt for system-wide
#      matters.
#
# Created 2014.08.21 by Warren Young
#
# Copyright © 2014 by Warren Young

#
# Others may also hold copyrights on code in this file.  See the
# CREDITS.md file in the top directory of the distribution for details.
#
# This file is part of libtabula.
#
# libtabula is free software; you can redistribute it and/or modify it
................................................................................
	file(READ "stock.txt" ST_CONTENTS)
	file(WRITE ${STOCK_TXT} "${ST_CONTENTS}")
	message(STATUS "Copied stock.txt to build dir so ssqls6 will run")
endif()

add_library(ltexcomm STATIC printdata.cpp)

add_executable(cgi_jpeg cgi_jpeg.cpp)
target_link_libraries(cgi_jpeg tabula mysqlclient_r)

add_executable(cpool cpool.cpp)
target_link_libraries(cpool tabula mysqlclient_r)

add_executable(dbinfo dbinfo.cpp)

target_link_libraries(dbinfo tabula mysqlclient_r)



add_executable(deadlock deadlock.cpp)
target_link_libraries(deadlock tabula mysqlclient_r)


add_executable(fieldinf fieldinf.cpp)
target_link_libraries(fieldinf tabula mysqlclient_r)

add_executable(for_each for_each.cpp)
target_link_libraries(for_each tabula mysqlclient_r)

add_executable(load_jpeg load_jpeg.cpp)
target_link_libraries(load_jpeg tabula mysqlclient_r)

add_executable(multiquery multiquery.cpp)
target_link_libraries(multiquery tabula mysqlclient_r)

add_executable(resetdb resetdb.cpp)
target_link_libraries(resetdb tabula mysqlclient_r)

add_executable(simple1 simple1.cpp)
target_link_libraries(simple1 tabula mysqlclient_r)

add_executable(simple2 simple2.cpp)
target_link_libraries(simple2 tabula mysqlclient_r)

add_executable(simple3 simple3.cpp)
target_link_libraries(simple3 tabula mysqlclient_r)

add_executable(ssqls1 ssqls1.cpp)
target_link_libraries(ssqls1 tabula mysqlclient_r)

add_executable(ssqls2 ssqls2.cpp)
target_link_libraries(ssqls2 ltexcomm tabula mysqlclient_r)

add_executable(ssqls3 ssqls3.cpp)
target_link_libraries(ssqls3 ltexcomm tabula mysqlclient_r)

add_executable(ssqls4 ssqls4.cpp)
target_link_libraries(ssqls4 ltexcomm tabula mysqlclient_r)

add_executable(ssqls5 ssqls5.cpp)
target_link_libraries(ssqls5 tabula mysqlclient_r)

add_executable(ssqls6 ssqls6.cpp)
target_link_libraries(ssqls6 ltexcomm tabula mysqlclient_r)

add_executable(store_if store_if.cpp)
target_link_libraries(store_if ltexcomm tabula mysqlclient_r)


add_executable(tquery1 tquery1.cpp)
target_link_libraries(tquery1 ltexcomm tabula mysqlclient_r)

add_executable(tquery2 tquery2.cpp)
target_link_libraries(tquery2 ltexcomm tabula mysqlclient_r)



add_executable(tquery3 tquery3.cpp)
target_link_libraries(tquery3 tabula mysqlclient_r)

add_executable(tquery4 tquery4.cpp)
target_link_libraries(tquery4 ltexcomm tabula mysqlclient_r)

add_executable(transaction transaction.cpp)
target_link_libraries(transaction ltexcomm tabula mysqlclient_r)









|
>







 







|
<
<
|
|
<
<
>
|
>
>

<
<
>

<
<
<
<
<
<
|
<

<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
>
|
<

<
<
>
>
|
<
<
<
<
<
<
<
<
<
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
..
34
35
36
37
38
39
40
41


42
43


44
45
46
47
48


49
50






51

52






53





























54
55

56


57
58
59









60
61
# CMakeLists.txt - Tells CMake how to build the libtabula examples on
#      supported platforms.  See ../CMakeLists.txt for system-wide
#      matters.
#
# Created 2014.08.21 by Warren Young
#
# Copyright © 2014-2015 by Warren Young
# Copyright © 2015 by Educational Technology Resources, Inc.
#
# Others may also hold copyrights on code in this file.  See the
# CREDITS.md file in the top directory of the distribution for details.
#
# This file is part of libtabula.
#
# libtabula is free software; you can redistribute it and/or modify it
................................................................................
	file(READ "stock.txt" ST_CONTENTS)
	file(WRITE ${STOCK_TXT} "${ST_CONTENTS}")
	message(STATUS "Copied stock.txt to build dir so ssqls6 will run")
endif()

add_library(ltexcomm STATIC printdata.cpp)

macro(add_example_executable basename)


	add_executable(${basename} ${basename}.cpp)
	target_link_libraries(${basename} ltexcomm tabula ${MYSQL_C_API_LIBRARY})


	if (CMAKE_USE_PTHREADS_INIT)
		target_link_libraries(${basename} pthread)
	endif()
endmacro(add_example_executable)



foreach(basename resetdb







				 cgi_jpeg load_jpeg








				 simple1 simple2 simple3





























				 ssqls1 ssqls2 ssqls3 ssqls4 ssqls5 ssqls6
				 tquery1 tquery2 tquery3 tquery4




				 cpool dbinfo deadlock fieldinf for_each multiquery
				 store_if transaction
				 )









	add_example_executable(${basename})
endforeach(basename)

Changes to src/CMakeLists.txt.

1
2
3
4
5
6

7
8
9
10
11
12
13
..
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97


# src/CMakeLists.txt - Tells CMake how to build libtabula proper
#    See ../CMakeLists.txt for system-wide matters.
#
# Created 2014.08.21 by Warren Young
#
# Copyright © 2014 by Warren Young

#
# Others may also hold copyrights on code in this file.  See the
# CREDITS.md file in the top directory of the distribution for details.
#
# This file is part of libtabula.
#
# libtabula is free software; you can redistribute it and/or modify it
................................................................................
    transaction.cpp
    type_info.cpp
    uds_connection.cpp
    utility.cpp
    vallist.cpp
    wnp_connection.cpp
)
target_link_libraries(tabula mysqlclient_r)

# Add a top-level "tags" target which includes all files in both
# the build and source versions of src/*.
set_source_files_properties(tags PROPERTIES GENERATED true)
add_custom_command(OUTPUT tags
    COMMAND ctags -R --c++-kinds=+p --fields=+iaS --extra=+q 
		${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
    COMMAND ln -sf ${CMAKE_CURRENT_BINARY_DIR}/tags ${CMAKE_BINARY_DIR}
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

# ...but only make it a dependency of libtabula if the ctags program
# is available, else it will fail to build on Windows.
find_program(CTAGS_PATH ctags)
if(CTAGS_PATH)
	message(STATUS "Found ctags: ${CTAGS_PATH}")
	add_dependencies(tabula tags)
endif(CTAGS_PATH)







|
>







 







<






|







|
|

>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
..
74
75
76
77
78
79
80

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# src/CMakeLists.txt - Tells CMake how to build libtabula proper
#    See ../CMakeLists.txt for system-wide matters.
#
# Created 2014.08.21 by Warren Young
#
# Copyright © 2014-2015 by Warren Young
# Copyright © 2015 by Educational Technology Resources, Inc.
#
# Others may also hold copyrights on code in this file.  See the
# CREDITS.md file in the top directory of the distribution for details.
#
# This file is part of libtabula.
#
# libtabula is free software; you can redistribute it and/or modify it
................................................................................
    transaction.cpp
    type_info.cpp
    uds_connection.cpp
    utility.cpp
    vallist.cpp
    wnp_connection.cpp
)


# Add a top-level "tags" target which includes all files in both
# the build and source versions of src/*.
set_source_files_properties(tags PROPERTIES GENERATED true)
add_custom_command(OUTPUT tags
    COMMAND ctags -R --c++-kinds=+p --fields=+iaS --extra=+q 
       ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
    COMMAND ln -sf ${CMAKE_CURRENT_BINARY_DIR}/tags ${CMAKE_BINARY_DIR}
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

# ...but only make it a dependency of libtabula if the ctags program
# is available, else it will fail to build on Windows.
find_program(CTAGS_PATH ctags)
if(CTAGS_PATH)
    message(STATUS "Found ctags: ${CTAGS_PATH}")
    add_dependencies(tabula tags)
endif(CTAGS_PATH)

target_link_libraries(tabula ${MYSQL_C_API_LIBRARY})

Changes to src/ssx/CMakeLists.txt.

1
2
3
4
5
6
7
8
9
10
11
12
13
..
23
24
25
26
27
28
29
30

# CMakeLists.txt - Tells CMake how to build libssqls2parse and the
#      ssqlsxlat utility.
#
# Created 2014.08.24 by Warren Young
#
# Copyright © 2014 by Warren Young
#
# Others may also hold copyrights on code in this file.  See the
# CREDITS.md file in the top directory of the distribution for details.
#
# This file is part of libtabula.
#
# libtabula is free software; you can redistribute it and/or modify it
................................................................................
# You should have received a copy of the GNU Lesser General Public
# License along with libtabula; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
# USA

add_library(ssqls2parse STATIC parsev2.cpp)
add_executable(ssqlsxlat genv2.cpp main.cpp)
target_link_libraries(ssqlsxlat ssqls2parse tabula mysqlclient_r)






|







 







|
>
1
2
3
4
5
6
7
8
9
10
11
12
13
..
23
24
25
26
27
28
29
30
31
# CMakeLists.txt - Tells CMake how to build libssqls2parse and the
#      ssqlsxlat utility.
#
# Created 2014.08.24 by Warren Young
#
# Copyright © 2014-2015 by Warren Young
#
# Others may also hold copyrights on code in this file.  See the
# CREDITS.md file in the top directory of the distribution for details.
#
# This file is part of libtabula.
#
# libtabula is free software; you can redistribute it and/or modify it
................................................................................
# You should have received a copy of the GNU Lesser General Public
# License along with libtabula; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
# USA

add_library(ssqls2parse STATIC parsev2.cpp)
add_executable(ssqlsxlat genv2.cpp main.cpp)
target_link_libraries(ssqlsxlat ssqls2parse tabula 
		${MYSQL_C_API_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})

Changes to test/CMakeLists.txt.

21
22
23
24
25
26
27

28
29
30
31
32
33

34
35
36

37
38
39

40
41
42
43

44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with libtabula; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
# USA


add_executable(test_array_index array_index.cpp)
target_link_libraries(test_array_index tabula mysqlclient_r)

add_executable(test_cpool cpool.cpp)
target_link_libraries(test_cpool tabula mysqlclient_r)


add_executable(test_datetime datetime.cpp)
target_link_libraries(test_datetime tabula mysqlclient_r)


add_executable(test_insertpolicy insertpolicy.cpp)
target_link_libraries(test_insertpolicy tabula mysqlclient_r)


add_executable(test_inttypes inttypes.cpp)
target_link_libraries(test_inttypes tabula mysqlclient_r)

add_executable(test_manip manip.cpp)

target_link_libraries(test_manip tabula mysqlclient_r)

add_executable(test_null_comparison null_comparison.cpp)
target_link_libraries(test_null_comparison tabula mysqlclient_r)

if(TEST_NULL_UNIQUENESS)
	# This test purposely includes bad code that should fail to compile.
	# A thorough platform test will include an attempt to build this,
	# and the test must be considered a failure if it *does* build.  The
	# test is making sure that a build-time check works as expected.
	add_executable(test_null_uniqueness null_uniqueness.cpp)
	target_link_libraries(test_null_uniqueness tabula mysqlclient_r)
endif()

add_executable(test_qssqls qssqls.cpp)
target_link_libraries(test_qssqls tabula mysqlclient_r)

add_executable(test_qstream qstream.cpp)
target_link_libraries(test_qstream tabula mysqlclient_r)

add_executable(test_query_copy query_copy.cpp)
target_link_libraries(test_query_copy tabula mysqlclient_r)

add_executable(test_sqlstream sqlstream.cpp)
target_link_libraries(test_sqlstream tabula mysqlclient_r)

add_executable(test_ssqls2 ssqls2.cpp)
target_link_libraries(test_ssqls2 ssqls2parse tabula mysqlclient_r)

add_executable(test_string string.cpp)
target_link_libraries(test_string tabula mysqlclient_r)

add_executable(test_tcp tcp.cpp)
target_link_libraries(test_tcp tabula mysqlclient_r)

add_executable(test_uds uds.cpp)
target_link_libraries(test_uds tabula mysqlclient_r)

add_executable(test_wnp wnp.cpp)
target_link_libraries(test_wnp tabula mysqlclient_r)







>
|
|
<
|
|
<
>
|
<

>
|
|
<
>
|
<

<
>
|
<
<
<






|
<

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
21
22
23
24
25
26
27
28
29
30

31
32

33
34

35
36
37
38

39
40

41

42
43



44
45
46
47
48
49
50

51



























# License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with libtabula; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
# USA

macro(add_test_executable basename)
	add_executable(test_${basename} ${basename}.cpp)
	target_link_libraries(test_${basename} tabula ${MYSQL_C_API_LIBRARY})

	if (CMAKE_USE_PTHREADS_INIT)
		target_link_libraries(test_${basename} pthread)

	endif()
endmacro(add_test_executable)


foreach(basename array_index cpool datetime insertpolicy inttypes manip 
				 null_comparison qssqls qstream sqlstream ssqls2 string
				 tcp uds wnp)

	add_test_executable(${basename})
endforeach(basename)



# Add extra libraries to our needier targets
target_link_libraries(test_ssqls2 ssqls2parse)




if(TEST_NULL_UNIQUENESS)
	# This test purposely includes bad code that should fail to compile.
	# A thorough platform test will include an attempt to build this,
	# and the test must be considered a failure if it *does* build.  The
	# test is making sure that a build-time check works as expected.
	add_test_executable(null_uniqueness)

endif()