Skip to content

Commit ecb9027

Browse files
authored
Add Solaris build support (scream3r#45)
Add Solaris 10,11 build support
1 parent 0a29bca commit ecb9027

File tree

5 files changed

+27
-5
lines changed

5 files changed

+27
-5
lines changed

CMakeLists.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
2929
if(WIN32)
3030
# Assume mingw, use "-static"
3131
set(CMAKE_CXX_STANDARD_LIBRARIES "-static ${CMAKE_CXX_STANDARD_LIBRARIES}")
32-
else()
32+
elseif(NOT CMAKE_SYSTEM_NAME STREQUAL SunOS)
3333
set(CMAKE_CXX_STANDARD_LIBRARIES "-static-libgcc -static-libstdc++ ${CMAKE_CXX_STANDARD_LIBRARIES}")
3434
endif()
3535
execute_process(COMMAND uname OUTPUT_VARIABLE OS_TYPE OUTPUT_STRIP_TRAILING_WHITESPACE)
@@ -70,10 +70,16 @@ if(NOT NATIVE_LIB_DIR)
7070

7171
# 32-bit or 64-bit
7272
#FIXME: Might fail on cross-compile
73-
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
73+
if(FORCE_M32)
74+
set(OS_BITS 32)
75+
elseif(FORCE_M64)
7476
set(OS_BITS 64)
7577
else()
76-
set(OS_BITS 32)
78+
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
79+
set(OS_BITS 64)
80+
else()
81+
set(OS_BITS 32)
82+
endif()
7783
endif()
7884
SET(NATIVE_LIB_DIR ${OS_NAME}_${OS_BITS})
7985
endif()
@@ -112,6 +118,9 @@ endif()
112118
if(FORCE_M32)
113119
# Build 32-bit binary on Linux
114120
set_target_properties(jssc PROPERTIES COMPILE_FLAGS -m32 LINK_FLAGS -m32)
121+
elseif(FORCE_M64)
122+
# Build 64-bit binary on Linux
123+
set_target_properties(jssc PROPERTIES COMPILE_FLAGS -m64 LINK_FLAGS -m64)
115124
endif()
116125

117126
# Call strip on non-debug builds
@@ -128,5 +137,5 @@ if(MSVC)
128137
target_compile_options(jssc PRIVATE /W4)
129138
else()
130139
#TODO Treat warnings as errors -Werror
131-
target_compile_options(jssc PRIVATE -Wall -Wextra -pedantic)
140+
target_compile_options(jssc PRIVATE -Wall -Wextra -pedantic -Wno-long-long)
132141
endif()

pom.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,19 @@
378378
</properties>
379379
</profile>
380380

381+
<!-- cmake linux 64-bit profile -->
382+
<profile>
383+
<id>m64</id>
384+
<properties>
385+
<os.detected.arch>x86_64</os.detected.arch>
386+
<os.detected.bitness>64</os.detected.bitness>
387+
<!-- skip test on cross-compile -->
388+
<maven.test.skip>true</maven.test.skip>
389+
<cmake.generate.args>-DNATIVE_LIB_DIR=${os.detected.name}_${os.detected.bitness}</cmake.generate.args>
390+
<cmake.generate.extra>-DFORCE_M64=True</cmake.generate.extra>
391+
</properties>
392+
</profile>
393+
381394
<!-- cmake windows-amd64 profile -->
382395
<profile>
383396
<id>win64</id>

src/cpp/_nix_based/jssc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#ifdef __linux__
3636
#include <linux/serial.h>
3737
#endif
38-
#ifdef __SunOS
38+
#ifdef __sun
3939
#include <sys/filio.h>//Needed for FIONREAD in Solaris
4040
#include <string.h>//Needed for select() function
4141
#endif
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)