Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3542085

Browse files
committedMar 1, 2023
Finish 0.96
2 parents 83a8756 + 816f798 commit 3542085

File tree

7 files changed

+281
-51
lines changed

7 files changed

+281
-51
lines changed
 

‎.gitattributes

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#this file specifies some rules on specific files for line endings and more.
2+
#it also has a section on which files should NOT be part of an export (git archive) command.
3+
4+
#List of files to NOT export:
5+
.git export-ignore
6+
.github export-ignore
7+
.cirrus.yml export-ignore
8+
.whitesource export-ignore
9+
.vscode export-ignore
10+
.travis.yml export-ignore
11+

‎CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ option(BUILD_SHARED_LIBS "Build the shared library" OFF)
55

66
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
77

8-
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
8+
if(WIN32)
9+
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
10+
endif()
911

1012
if(BUILD_SHARED_LIBS)
1113
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

‎GNUmakefile

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright 2022 Seagate Technology and/or its Affiliates
2+
# This is a handwritten GNUMakefile for wingetopt
3+
# This was done so as not to collide with the makefile output from CMake when CMake is used.
4+
# This makefile is for projects unable to use cmake or meson, but support GNUMake
5+
# Can convert this to a POSIX makefile if needed. -TJE
6+
7+
NAME=wingetopt
8+
CC ?= cc
9+
SRC_DIR=./src
10+
INC_DIR=-I./src/
11+
CC ?= gcc
12+
AR ?= ar
13+
CFLAGS ?= -Wall -Wextra -c -fPIC -I.
14+
SRC_FILES = $(SRC_DIR)/getopt.c
15+
LIB_OBJ_FILES = $(SRC_FILES:.c=.o)
16+
STATIC_LIB = lib$(NAME).a
17+
SHARED_LIB = lib$(NAME).so
18+
19+
FILE_OUTPUT_DIR=lib
20+
21+
.PHONY: all
22+
23+
all: clean mkoutputdir static
24+
25+
%.o: %.c
26+
$(CC) $(CFLAGS) $(INC_DIR) $< -o $@
27+
28+
static: $(LIB_OBJ_FILES)
29+
rm -f $(FILE_OUTPUT_DIR)/$(STATIC_LIB) $(FILE_OUTPUT_DIR)/$(SHARED_LIB)
30+
$(AR) cq $(FILE_OUTPUT_DIR)/$(STATIC_LIB) $(LIB_OBJ_FILES)
31+
32+
shared: $(LIB_OBJ_FILES)
33+
rm -f $(FILE_OUTPUT_DIR)/$(STATIC_LIB) $(FILE_OUTPUT_DIR)/$(SHARED_LIB)
34+
$(CC) -shared $(LIB_OBJ_FILES) -o $(FILE_OUTPUT_DIR)/$(SHARED_LIB)
35+
36+
clean:
37+
rm -f $(FILE_OUTPUT_DIR)/$(STATIC_LIB) $(FILE_OUTPUT_DIR)/$(SHARED_LIB) *.o $(SRC_DIR)*.o
38+
rm -rf $(FILE_OUTPUT_DIR)
39+
40+
mkoutputdir:
41+
mkdir -p $(FILE_OUTPUT_DIR)
42+

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
getopt library for Windows compilers
44

55

6-
This library was created to allow compilation linux-based software on Windows.
6+
This library was created to allow compilation Linux-based software on Windows.
77
http://en.wikipedia.org/wiki/Getopt
88

99
The sources were taken from MinGW-runtime project.

‎meson.build

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Modifications Copyright 2022 Seagate Technology and/or its Affiliates
2+
3+
project(
4+
'wingetopt',
5+
'c',
6+
version: '0.95',
7+
license : ['ISC', 'BSD-3-Clause'],
8+
meson_version: '>= 0.55',
9+
default_options: [
10+
'warning_level=3',
11+
'default_library=static'
12+
],
13+
)
14+
15+
compiler = meson.get_compiler('c')
16+
17+
c_args = []
18+
19+
if compiler.get_id() == 'msvc'
20+
# -D_CRT_SECURE_NO_WARNINGS is not needed as the code checks flags to switch to MSFT preferred functions as needed-TJE
21+
if get_option('default_library') == 'shared'
22+
c_args += [
23+
'-DBUILDING_WINGETOPT_DLL',
24+
'-DWINGETOPT_SHARED_LIB',
25+
]
26+
endif
27+
endif
28+
29+
wingetopt_lib = library(
30+
'wingetopt',
31+
'src/getopt.c',
32+
include_directories: include_directories(
33+
'src',
34+
),
35+
c_args: c_args,
36+
)
37+
38+
wingetopt_dep = declare_dependency(
39+
link_with: wingetopt_lib,
40+
include_directories: include_directories(
41+
'src',
42+
),
43+
)
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.