Skip to content

Commit

Permalink
[Release] 0.3.0 - Linux support (#12)
Browse files Browse the repository at this point in the history
* add linux to test.yml and cmakelists.txt

* remove rc5

* include all parts of openssl

* set prefix and openssldir

* add options back in

* remove no-shared

* remove all options

* use shared objects

* use .a files again

* use complete openssl triplet

* change openssl triplet to linx-x86_64

* add some more linker flags

* remove exclusions

* remove if condition

* use ./config

* try .so again

* whole archive

* check dynamic dependencies

* add -static linker flag

* add -static-libstdc++ -static-libgcc

* add everything back in

* bump version
  • Loading branch information
Thomas-mcinally authored Mar 23, 2024
1 parent 997ddff commit 1870aba
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
if: startsWith(github.event.head_commit.message, '[Release]')
strategy:
matrix:
os: [macos-12, macos-14, windows-latest]
os: [macos-12, macos-14, windows-latest, ubuntu-latest]
include:
- os: macos-12
bin_path: ./build/stockprice
Expand All @@ -24,6 +24,9 @@ jobs:
- os: windows-latest
bin_path: ./build/Release/stockprice.exe
compressed_name: stockprice-bin-windows-x86_64.zip
- os: ubuntu-latest
bin_path: ./build/stockprice
compressed_name: stockprice-bin-Linux-x86_64.tar.gz
runs-on: ${{ matrix.os }}
steps:
- name: Git clone the repository
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ jobs:
test:
strategy:
matrix:
os: [windows-latest]
os: [macos-12, macos-14, windows-latest, ubuntu-latest]
include:
- os: macos-12
bin_path: ./build/stockprice
- os: macos-14
bin_path: ./build/stockprice
- os: windows-latest
bin_path: ./build/Release/stockprice.exe
- os: ubuntu-latest
bin_path: ./build/stockprice
runs-on: ${{ matrix.os }}
steps:
- name: Git clone the repository
Expand Down
24 changes: 16 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 11)
project(Stockprice)
project(stockprice)

if(MSVC)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
endif()

add_executable(Stockprice src/main.cpp src/get_ticker_statistics.cpp)
add_executable(stockprice src/main.cpp src/get_ticker_statistics.cpp)

if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64")
Expand All @@ -19,12 +19,12 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
endif()

add_custom_target(openssl
COMMAND ./Configure no-shared no-asm no-zlib no-psk no-srp enable-rc5 ${OPENSSL_CONFIGURE_TRIPLET}
COMMAND ./Configure no-shared no-asm no-zlib no-psk no-srp ${OPENSSL_CONFIGURE_TRIPLET}
COMMAND make
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/openssl-3.2.1
)
add_dependencies(Stockprice openssl)
target_link_libraries(Stockprice ${CMAKE_SOURCE_DIR}/openssl-3.2.1/libcrypto.a ${CMAKE_SOURCE_DIR}/openssl-3.2.1/libssl.a)
add_dependencies(stockprice openssl)
target_link_libraries(stockprice ${CMAKE_SOURCE_DIR}/openssl-3.2.1/libcrypto.a ${CMAKE_SOURCE_DIR}/openssl-3.2.1/libssl.a)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64")
set(OPENSSL_CONFIGURE_TRIPLET "VC-WIN64A")
Expand All @@ -33,12 +33,20 @@ elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
endif()

add_custom_target(openssl
COMMAND perl Configure no-shared no-asm no-zlib no-psk no-srp enable-rc5 ${OPENSSL_CONFIGURE_TRIPLET}
COMMAND perl Configure no-shared no-asm no-zlib no-psk no-srp ${OPENSSL_CONFIGURE_TRIPLET}
COMMAND nmake
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/openssl-3.2.1
)
add_dependencies(Stockprice openssl)
target_link_libraries(Stockprice ${CMAKE_SOURCE_DIR}/openssl-3.2.1/libcrypto.lib ${CMAKE_SOURCE_DIR}/openssl-3.2.1/libssl.lib)
add_dependencies(stockprice openssl)
target_link_libraries(stockprice ${CMAKE_SOURCE_DIR}/openssl-3.2.1/libcrypto.lib ${CMAKE_SOURCE_DIR}/openssl-3.2.1/libssl.lib)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
add_custom_target(openssl
COMMAND ./config
COMMAND make
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/openssl-3.2.1
)
add_dependencies(stockprice openssl)
target_link_libraries(stockprice -Wl,--whole-archive ${CMAKE_SOURCE_DIR}/openssl-3.2.1/libcrypto.a ${CMAKE_SOURCE_DIR}/openssl-3.2.1/libssl.a -Wl,--no-whole-archive -static)
else()
message(FATAL_ERROR "Unsupported system: ${CMAKE_HOST_SYSTEM_NAME}")
endif()
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.0
0.3.0

0 comments on commit 1870aba

Please sign in to comment.