Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
###############################################################################

cmake_minimum_required(VERSION 3.24)
project(libzoslib CXX C ASM)
project(libzoslib VERSION 4.0.0 LANGUAGES CXX C ASM)

include_directories(BEFORE include)

Expand Down Expand Up @@ -103,3 +103,25 @@ endif()
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CMAKE_INSTALL_PREFIX "." CACHE PATH "install path" FORCE)
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

# Configure and install pkgconfig file
set(ZOSLIB_VERSION "${PROJECT_VERSION}")
# Allow users to specify extra flags and libs via CMake variables
if(NOT DEFINED ZOSLIB_EXTRA_CFLAGS)
set(ZOSLIB_EXTRA_CFLAGS "")
endif()
if(NOT DEFINED ZOSLIB_EXTRA_LIBS)
set(ZOSLIB_EXTRA_LIBS "")
endif()
if(NOT DEFINED ZOSLIB_PRIVATE_LIBS)
set(ZOSLIB_PRIVATE_LIBS "")
endif()
configure_file(
${CMAKE_SOURCE_DIR}/zoslib.pc.in
${CMAKE_BINARY_DIR}/zoslib.pc
@ONLY
)
install(
FILES ${CMAKE_BINARY_DIR}/zoslib.pc
DESTINATION lib/pkgconfig
)
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ After ZOSLIB has finished building, install it from `build`:
$ cmake --build . --target install
```

The install step will place:
- Libraries (`libzoslib.a`, `libzoslib.so`, and sidedeck) in `install/lib`
- Header files in `install/include`
- pkg-config file (`zoslib.pc`) in `install/lib/pkgconfig`
- Helper utilities in `install/bin`

## Quick Start

Once we have ZOSLIB built and installed, let's attempt to build our first
Expand Down Expand Up @@ -196,8 +202,9 @@ In the `main` function, we make use of two ZOSLIB definitions,
`__zoslib_version` to obtain the ZOSLIB version, and `getentropy` to generate
a list of random values.

3. To compile and link the application, enter the following command:
3. To compile and link the application, enter one of the following commands:

Using explicit paths:
``` bash
xlclang++ -qascii -I path/to/zoslib/include -L path/to/build/lib -lzoslib random.cc -o random
```
Expand All @@ -206,6 +213,19 @@ or:
clang++ -fzos-le-char-mode=ascii -I path/to/zoslib/include -L path/to/build/lib -lzoslib random.cc -o random
```

Using pkg-config (if zoslib is installed):
``` bash
xlclang++ -qascii $(pkg-config --cflags --libs zoslib) random.cc -o random
```
or:
``` bash
clang++ -fzos-le-char-mode=ascii $(pkg-config --cflags --libs zoslib) random.cc -o random
```

Note: pkg-config automatically includes the following flags:
- Compile flags: `-DZOSLIB_OVERRIDE_CLIB=1 -DZOSLIB_OVERRIDE_CLIB_GETENV=1 -DZOSLIB_OVERRIDE_CLIB_LOCALE_FORCE`
- Libraries: `-lzoslib` and `celquopt.s.o`

4. To run the application, enter the following command:
``` bash
./random 2
Expand Down
Binary file modified docs/bdwn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/doc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/folderclosed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/folderopen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions zoslib.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: zoslib
Description: ZOSLIB - A z/OS C/C++ Library providing POSIX APIs, EBCDIC/ASCII conversion, and diagnostic utilities
Version: @ZOSLIB_VERSION@
URL: https://github.com/ibmruntimes/zoslib
Libs: -L${libdir} -lzoslib ${libdir}/celquopt.s.o@ZOSLIB_EXTRA_LIBS@
Libs.private:@ZOSLIB_PRIVATE_LIBS@
Cflags: -I${includedir} -DZOSLIB_OVERRIDE_CLIB=1 -DZOSLIB_OVERRIDE_CLIB_GETENV=1 -DZOSLIB_OVERRIDE_CLIB_LOCALE_FORCE@ZOSLIB_EXTRA_CFLAGS@