diff --git a/CMakeLists.txt b/CMakeLists.txt index 69f986e..c3a9ece 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,12 +3,14 @@ project(golded-plus C CXX) include(CheckFunctionExists) include(CheckIncludeFile) +include(CheckIncludeFiles) +include(CheckSymbolExists) -check_function_exists(snprintf HAVE_SNPRINTF) +CHECK_SYMBOL_EXISTS(snprintf stdio.h HAVE_SNPRINTF) if (${HAVE_SNPRINTF}) add_definitions(-DHAVE_SNPRINTF=1) endif() -check_function_exists(vsnprintf HAVE_VSNPRINTF) +CHECK_SYMBOL_EXISTS(vsnprintf stdio.h HAVE_VSNPRINTF) if (${HAVE_VSNPRINTF}) add_definitions(-DHAVE_VSNPRINTF=1) endif() @@ -16,14 +18,61 @@ CHECK_INCLUDE_FILE("stdarg.h" HAVE_STDARG_H) if (${HAVE_STDARG_H}) add_definitions(-DHAVE_STDARG_H=1) endif() +CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H) +if (${HAVE_STRING_H}) + add_definitions(-DHAVE_STRING_H=1) +endif() +CHECK_INCLUDE_FILE("malloc.h" HAVE_MALLOC_H) +if (${HAVE_MALLOC_H}) + add_definitions(-DHAVE_MALLOC_H=1) +endif() +CHECK_INCLUDE_FILE("time.h" HAVE_TIME_H) +if (${HAVE_TIME_H}) + add_definitions(-DHAVE_TIME_H=1) +endif() +CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H) +if (${HAVE_ERRNO_H}) + add_definitions(-DHAVE_ERRNO_H=1) +endif() +CHECK_INCLUDE_FILE("fcntl.h" HAVE_FCNTL_H) +if (${HAVE_FCNTL_H}) + add_definitions(-DHAVE_FCNTL_H=1) +endif() +CHECK_INCLUDE_FILE("io.h" HAVE_IO_H) +if (${HAVE_IO_H}) + add_definitions(-DHAVE_IO_H=1) +endif() +CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H) +if (${HAVE_UNISTD_H}) + add_definitions(-DHAVE_UNISTD_H=1) +endif() +CHECK_INCLUDE_FILES("stdarg.h;stdlib.h;stddef.h;string.h" HAVE_STDC_HEADERS) +if (${HAVE_STDC_HEADERS}) + add_definitions(-DSTDC_HEADERS=1) +endif() +check_include_files("time.h;sys/time.h" TIME_WITH_SYS_TIME) +if (${TIME_WITH_SYS_TIME}) + add_definitions(-DTIME_WITH_SYS_TIME=1) +endif() include(FindCurses) if (CURSES_NCURSES_LIBRARY) add_definitions(-D__USE_NCURSES__) endif() if (MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /J") - add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE -DHAVE_SNPRINTF -DHAVE_VSNPRINTF -D_CRT_SECURE_NO_WARNINGS -D_ALLOW_RTCc_IN_STL -D_CONSOLE -DHAVE_CONFIG_H -D__INCLUDE_NEW_KEYWORDS__) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /J /MP") + add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_ALLOW_RTCc_IN_STL -D_CONSOLE -D__INCLUDE_NEW_KEYWORDS__) + set(CompilerFlags + CMAKE_CXX_FLAGS + CMAKE_CXX_FLAGS_DEBUG + CMAKE_CXX_FLAGS_RELEASE + CMAKE_C_FLAGS + CMAKE_C_FLAGS_DEBUG + CMAKE_C_FLAGS_RELEASE + ) + foreach(CompilerFlag ${CompilerFlags}) + string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}") + endforeach() else() add_definitions(-funsigned-char -D__INCLUDE_NEW_KEYWORDS__ -DPRAGMA_PACK -Wno-sign-compare -pedantic -Wno-write-strings) endif() diff --git a/appveyor.yml b/appveyor.yml index fc45ceb..0750312 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,27 +3,37 @@ branches: only: - master - /^golded-.*/ -image: - - Visual Studio 2017 environment: matrix: + - generator: Visual Studio 10 2010 + pf: "msvc2010" + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + - generator: Visual Studio 10 2010 Win64 + pf: "msvc2010" + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - generator: Visual Studio 15 2017 + pf: "msvc2017" + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - generator: Visual Studio 15 2017 Win64 + pf: "msvc2017" + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 install: - cmd: copy golded3\mygolded.__h golded3\mygolded.h build_script: + - if ["%GENERATOR%"]==["Visual Studio 10 2010 Win64"] if not ["%APPVEYOR_REPO_TAG%"]==["true"] (appveyor exit) + - if ["%GENERATOR%"]==["Visual Studio 15 2017 Win64"] if not ["%APPVEYOR_REPO_TAG%"]==["true"] (appveyor exit) - cmd: mkdir build && cd build && cmake --version - cmd: cmake .. -G "%GENERATOR%" - cmd: cmake --build . -- /P:Configuration=Release - cmd: cpack - + - ps: gci *.7z | %{ rename-item –path $_.Fullname –Newname ( $_.basename +"-"+$Env:pf+$_.extension) } artifacts: - path: build\*.7z name: dist -deploy: - provider: GitHub - artifact: dist - auth_token: $(GITHUB_OAUTH_TOKEN) - on: - appveyor_repo_tag: true \ No newline at end of file +deploy: + provider: GitHub + artifact: dist + auth_token: $(GITHUB_OAUTH_TOKEN) + on: + appveyor_repo_tag: true diff --git a/goldlib/glibc/CMakeLists.txt b/goldlib/glibc/CMakeLists.txt index 549c920..4c69422 100644 --- a/goldlib/glibc/CMakeLists.txt +++ b/goldlib/glibc/CMakeLists.txt @@ -2,6 +2,5 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(glibc_SOURCES regex.cpp ) -add_definitions(-DHAVE_CONFIG_H) include_directories(../gall) ADD_LIBRARY(glibc STATIC ${glibc_SOURCES}) diff --git a/goldlib/uulib/CMakeLists.txt b/goldlib/uulib/CMakeLists.txt index ec4312f..48949c6 100644 --- a/goldlib/uulib/CMakeLists.txt +++ b/goldlib/uulib/CMakeLists.txt @@ -9,6 +9,6 @@ set(uulib_SOURCES uustring.cpp uuutil.cpp ) -add_definitions(-DHAVE_CONFIG_H) include_directories(../gall ../glibc) ADD_LIBRARY(uulib STATIC ${uulib_SOURCES}) +target_compile_definitions(uulib PRIVATE -DVERSION="15" -DPATCH="0.5") \ No newline at end of file