summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJan Niklas Hasse <jhasse@bixense.com>2020-11-14 15:03:41 (GMT)
committerGitHub <noreply@github.com>2020-11-14 15:03:41 (GMT)
commita30ccaef7314f5aa858ba3167af08be4b518d960 (patch)
treec1e121625069350ad339101eb4cf5ac0113e7c81 /CMakeLists.txt
parenta0b56413e476977eaf01467c9b93aaa9e498ef86 (diff)
parent92fc37555fd74b9a3848c956df49a516906af711 (diff)
downloadNinja-a30ccaef7314f5aa858ba3167af08be4b518d960.zip
Ninja-a30ccaef7314f5aa858ba3167af08be4b518d960.tar.gz
Ninja-a30ccaef7314f5aa858ba3167af08be4b518d960.tar.bz2
Merge pull request #1879 from kadler/aix-cleanup
Fix building on AIX
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt21
1 files changed, 17 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0b56e31..7f03c35 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -110,6 +110,14 @@ if(WIN32)
endif()
else()
target_sources(libninja PRIVATE src/subprocess-posix.cc)
+ if(CMAKE_SYSTEM_NAME STREQUAL "OS400" OR CMAKE_SYSTEM_NAME STREQUAL "AIX")
+ target_sources(libninja PRIVATE src/getopt.c)
+ endif()
+
+ # Needed for perfstat_cpu_total
+ if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
+ target_link_libraries(libninja PUBLIC "-lperfstat")
+ endif()
endif()
#Fixes GetActiveProcessorCount on MinGW
@@ -117,11 +125,10 @@ if(MINGW)
target_compile_definitions(libninja PRIVATE _WIN32_WINNT=0x0601 __USE_MINGW_ANSI_STDIO=1)
endif()
-# On IBM i (identified as "OS400" for compatibility reasons), this fixes missing
-# PRId64 (and others) at compile time, and links to libutil for getopt_long
-if(CMAKE_SYSTEM_NAME STREQUAL "OS400")
+# On IBM i (identified as "OS400" for compatibility reasons) and AIX, this fixes missing
+# PRId64 (and others) at compile time in C++ sources
+if(CMAKE_SYSTEM_NAME STREQUAL "OS400" OR CMAKE_SYSTEM_NAME STREQUAL "AIX")
string(APPEND CMAKE_CXX_FLAGS " -D__STDC_FORMAT_MACROS")
- string(APPEND CMAKE_EXE_LINKER_FLAGS " -lutil")
endif()
# Main executable is library plus main() function.
@@ -194,6 +201,12 @@ if(BUILD_TESTING)
target_link_libraries(${perftest} PRIVATE libninja libninja-re2c)
endforeach()
+ if(CMAKE_SYSTEM_NAME STREQUAL "AIX" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
+ # These tests require more memory than will fit in the standard AIX shared stack/heap (256M)
+ target_link_libraries(hash_collision_bench PRIVATE "-Wl,-bmaxdata:0x80000000")
+ target_link_libraries(manifest_parser_perftest PRIVATE "-Wl,-bmaxdata:0x80000000")
+ endif()
+
add_test(NinjaTest ninja_test)
endif()