Skip to content

Commit 0f1dc24

Browse files
chenqibchenqib
chenqib
authored and
chenqib
committed
Add CMake
1 parent be1ce5d commit 0f1dc24

File tree

5 files changed

+116
-0
lines changed

5 files changed

+116
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ android/.classpath
3737
android/.settings/
3838
android/bin/
3939
android/gen/
40+
41+
# IDE Project Files
42+
build/

CMakeLists.txt

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
cmake_minimum_required (VERSION 3.8)
2+
project (crsync C)
3+
4+
set(CMAKE_VERBOSE_MAKEFILE ON)
5+
6+
set(crsync_VERSION_MAJOR 0)
7+
set(crsync_VERSION_MINOR 3)
8+
set(crsync_VERSION_PATCH 0)
9+
10+
set_property(GLOBAL PROPERTY USE_FOLDERS TRUE)
11+
12+
#Put all binaries in same location
13+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY bin)
14+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY bin)
15+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin)
16+
17+
add_subdirectory(libs)
18+
add_subdirectory(extra)
19+
add_subdirectory(src)
20+
21+
add_definitions("-DHASH_BLOOM=21")
22+
set(CMAKE_C_STANDARD 99)
23+
# add_definitions("CURL_STATICLIB")
24+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os -fopenmp")
25+
include_directories(${CURL_HEADER_PATH})
26+
#link_directories(${CMAKE_SOURCE_DIR}/lib)
27+
28+
add_executable(crsync ${SOURCES} ${HEADERS} ${CURL_HEADERS} ${EXTRA_SOURCES} ${EXTRA_HEADERS})
29+
target_link_libraries(
30+
crsync
31+
"${CURL_LIB}"
32+
"${OPENSSL_LIB}"
33+
)
34+
35+
source_group("curl" FILES ${CURL_HEADERS})
36+
source_group("extra" FILES ${EXTRA_SOURCES} ${EXTRA_HEADERS})

extra/CMakeLists.txt

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
set(EXTRA_SOURCES
2+
${CMAKE_CURRENT_SOURCE_DIR}/md5.c
3+
${CMAKE_CURRENT_SOURCE_DIR}/tpl.c
4+
${CMAKE_CURRENT_SOURCE_DIR}/win/mmap.c
5+
${CMAKE_CURRENT_SOURCE_DIR}/dictionary.c
6+
${CMAKE_CURRENT_SOURCE_DIR}/iniparser.c
7+
PARENT_SCOPE
8+
)
9+
10+
set(EXTRA_HEADERS
11+
${CMAKE_CURRENT_SOURCE_DIR}/md5.h
12+
${CMAKE_CURRENT_SOURCE_DIR}/tpl.h
13+
${CMAKE_CURRENT_SOURCE_DIR}/win/mman.h
14+
${CMAKE_CURRENT_SOURCE_DIR}/uthash.h
15+
${CMAKE_CURRENT_SOURCE_DIR}/utstring.h
16+
${CMAKE_CURRENT_SOURCE_DIR}/utlist.h
17+
${CMAKE_CURRENT_SOURCE_DIR}/dictionary.h
18+
${CMAKE_CURRENT_SOURCE_DIR}/iniparser.h
19+
PARENT_SCOPE
20+
)

libs/CMakeLists.txt

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
set(CURL_HEADER_PATH
2+
${CMAKE_CURRENT_SOURCE_DIR}/curl/include/win32/curl
3+
PARENT_SCOPE
4+
)
5+
6+
FILE(GLOB CURL_HEADER_FILES "${CURL_HEADER_PATH}/*.h")
7+
set(CURL_HEADERS
8+
${CURL_HEADER_FILES}
9+
PARENT_SCOPE
10+
)
11+
12+
message(STATUS ${CURL_HEADER_PATH})
13+
14+
set(CURL_LIB
15+
${CMAKE_CURRENT_SOURCE_DIR}/curl/prebuilt/win32/libcurl.lib
16+
PARENT_SCOPE
17+
)
18+
19+
set(OPENSSL_HEADERS
20+
${CMAKE_CURRENT_SOURCE_DIR}/openssl/include/win32/openssl
21+
PARENT_SCOPE
22+
)
23+
24+
set(OPENSSL_LIB
25+
${CMAKE_CURRENT_SOURCE_DIR}/openssl/prebuilt/win32/libssl.lib
26+
PARENT_SCOPE
27+
)

src/CMakeLists.txt

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
set(SOURCES
2+
${SOURCES}
3+
${CMAKE_CURRENT_SOURCE_DIR}/digest.c
4+
${CMAKE_CURRENT_SOURCE_DIR}/diff.c
5+
${CMAKE_CURRENT_SOURCE_DIR}/patch.c
6+
${CMAKE_CURRENT_SOURCE_DIR}/http.c
7+
${CMAKE_CURRENT_SOURCE_DIR}/magnet.c
8+
${CMAKE_CURRENT_SOURCE_DIR}/helper.c
9+
${CMAKE_CURRENT_SOURCE_DIR}/util.c
10+
${CMAKE_CURRENT_SOURCE_DIR}/log.c
11+
${CMAKE_CURRENT_SOURCE_DIR}/crsync.c
12+
${CMAKE_CURRENT_SOURCE_DIR}/crsync-console.c
13+
PARENT_SCOPE
14+
)
15+
16+
set(HEADERS
17+
${HEADERS}
18+
${CMAKE_CURRENT_SOURCE_DIR}/global.h
19+
${CMAKE_CURRENT_SOURCE_DIR}/digest.h
20+
${CMAKE_CURRENT_SOURCE_DIR}/diff.h
21+
${CMAKE_CURRENT_SOURCE_DIR}/patch.h
22+
${CMAKE_CURRENT_SOURCE_DIR}/http.h
23+
${CMAKE_CURRENT_SOURCE_DIR}/magnet.h
24+
${CMAKE_CURRENT_SOURCE_DIR}/helper.h
25+
${CMAKE_CURRENT_SOURCE_DIR}/util.h
26+
${CMAKE_CURRENT_SOURCE_DIR}/log.h
27+
${CMAKE_CURRENT_SOURCE_DIR}/crsync.h
28+
${CMAKE_CURRENT_SOURCE_DIR}/crsyncver.h
29+
PARENT_SCOPE
30+
)

0 commit comments

Comments
 (0)