Skip to content

Commit

Permalink
Add Solaris build support (scream3r#45)
Browse files Browse the repository at this point in the history
Add Solaris 10,11 build support
  • Loading branch information
tresf committed Apr 23, 2019
1 parent 0a29bca commit ecb9027
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 deletions.
17 changes: 13 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(WIN32)
# Assume mingw, use "-static"
set(CMAKE_CXX_STANDARD_LIBRARIES "-static ${CMAKE_CXX_STANDARD_LIBRARIES}")
else()
elseif(NOT CMAKE_SYSTEM_NAME STREQUAL SunOS)
set(CMAKE_CXX_STANDARD_LIBRARIES "-static-libgcc -static-libstdc++ ${CMAKE_CXX_STANDARD_LIBRARIES}")
endif()
execute_process(COMMAND uname OUTPUT_VARIABLE OS_TYPE OUTPUT_STRIP_TRAILING_WHITESPACE)
Expand Down Expand Up @@ -70,10 +70,16 @@ if(NOT NATIVE_LIB_DIR)

# 32-bit or 64-bit
#FIXME: Might fail on cross-compile
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
if(FORCE_M32)
set(OS_BITS 32)
elseif(FORCE_M64)
set(OS_BITS 64)
else()
set(OS_BITS 32)
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(OS_BITS 64)
else()
set(OS_BITS 32)
endif()
endif()
SET(NATIVE_LIB_DIR ${OS_NAME}_${OS_BITS})
endif()
Expand Down Expand Up @@ -112,6 +118,9 @@ endif()
if(FORCE_M32)
# Build 32-bit binary on Linux
set_target_properties(jssc PROPERTIES COMPILE_FLAGS -m32 LINK_FLAGS -m32)
elseif(FORCE_M64)
# Build 64-bit binary on Linux
set_target_properties(jssc PROPERTIES COMPILE_FLAGS -m64 LINK_FLAGS -m64)
endif()

# Call strip on non-debug builds
Expand All @@ -128,5 +137,5 @@ if(MSVC)
target_compile_options(jssc PRIVATE /W4)
else()
#TODO Treat warnings as errors -Werror
target_compile_options(jssc PRIVATE -Wall -Wextra -pedantic)
target_compile_options(jssc PRIVATE -Wall -Wextra -pedantic -Wno-long-long)
endif()
13 changes: 13 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,19 @@
</properties>
</profile>

<!-- cmake linux 64-bit profile -->
<profile>
<id>m64</id>
<properties>
<os.detected.arch>x86_64</os.detected.arch>
<os.detected.bitness>64</os.detected.bitness>
<!-- skip test on cross-compile -->
<maven.test.skip>true</maven.test.skip>
<cmake.generate.args>-DNATIVE_LIB_DIR=${os.detected.name}_${os.detected.bitness}</cmake.generate.args>
<cmake.generate.extra>-DFORCE_M64=True</cmake.generate.extra>
</properties>
</profile>

<!-- cmake windows-amd64 profile -->
<profile>
<id>win64</id>
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/_nix_based/jssc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#ifdef __linux__
#include <linux/serial.h>
#endif
#ifdef __SunOS
#ifdef __sun
#include <sys/filio.h>//Needed for FIONREAD in Solaris
#include <string.h>//Needed for select() function
#endif
Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit ecb9027

Please sign in to comment.