@@ -66,7 +66,7 @@ project(decenttree)
66
66
# Ninja from the official website, and put that somewhere in your path.
67
67
# Windows VS Code GCC 9.2 The compiler mightn't have libgomp.a, libgomp.dll.a, libgomp.spec files in
68
68
# its lib directory. I found I could copy them across from the 12.2 compiler's
69
- #` lib directory, to get a GCC 9.2 build to at least... link. No idea if it runs!
69
+ # lib directory, to get a GCC 9.2 build to at least... link. No idea if it runs!
70
70
# Windows VS COde GCC 12.2 CMake isn't recognizing the compiler. Tried installing a slightly later
71
71
# CMake (3.24 rather than 3.23) but that didn't help.
72
72
# Building fails due to an error message which CMake/VS Code won't display.
@@ -89,6 +89,16 @@ project(decenttree)
89
89
# copy c:\msys64\usr\bin\msys-2.0.dll c:\msys64\mingw64\bin
90
90
#
91
91
# Mac OS Clang 13 Seems to be compiling with -std=c99 (or similar).
92
+ # Mac OS Clang 15 { "name": "Clang 15.0.2",
93
+ # "compilers": {
94
+ # "C": "/usr/local/opt/llvm/bin/clang",
95
+ # "CXX": "/usr/local/opt/llvm/bin/clang++"
96
+ # },
97
+ # "keep": true
98
+ # },
99
+ # ... had to be added to
100
+ # /Users/[me]/.local/share/CMakeTools/cmake-tools-kits.json
101
+ # ... because Microsoft Code wasn't finding the compiler.
92
102
#
93
103
#NOTE: Static linking with clang windows: make a symlink libgcc_eh.a to libgcc.a (administrator required
94
104
# C:\TDM-GCC-64\lib\gcc\x86_64-w64-mingw32\5.1.0>mklink libgcc_eh.a libgcc.a
@@ -138,6 +148,19 @@ elseif (APPLE)
138
148
message ("Target OS : Mac OS X" )
139
149
message ("Target System Name : ${CMAKE_HOST_SYSTEM_NAME} " )
140
150
message ("Target System Version : ${CMAKE_HOST_SYSTEM_VERSION} " )
151
+
152
+ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
153
+ if ("${CMAKE_CXX_COMPILER_VERSION} " VERSION_GREATER_EQUAL 13)
154
+ #This doesn't look to work very well. I'm definite
155
+ #that I want /usr/local/opt/llvm/lib for Clang 15 on my
156
+ #Mac Wintel laptop. But find_library keeps pointing at
157
+ #/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk
158
+ #/user/lib/libc++.tbd
159
+ link_directories (/usr/local/opt/llvm/lib)
160
+ find_library (CXXLIB c++ /usr/local/opt/llvm/lib)
161
+ endif ()
162
+ endif ()
163
+
141
164
# to be compatible back to Mac OS X 10.7
142
165
if (DECENTTREE_FLAGS MATCHES "oldmac" )
143
166
add_definitions ("-mmacosx-version-min=10.5" )
@@ -255,11 +278,12 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
255
278
endif ()
256
279
257
280
# use libc++ per default in MacOS
258
- # set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -v")
281
+ set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -v" )
259
282
if (APPLE )
260
283
SET (CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++" )
261
284
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++" )
262
285
endif ()
286
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
263
287
264
288
#remove -rdynamic for Clang under Linux
265
289
if (UNIX AND DECENTTREE_FLAGS MATCHES "static" )
@@ -437,12 +461,14 @@ if (NOT DECENTTREE_FLAGS MATCHES "single")
437
461
#But I don't as yet know how to tell CMake to do that. -James B. 23-Jul-2020
438
462
else ()
439
463
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread" )
464
+ if (APPLE )
465
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xpreprocessor" )
466
+ set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/bin" )
467
+ endif ()
440
468
if (APPLE OR WIN32 )
441
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xpreprocessor -fopenmp -pthread" )
442
469
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lomp" )
443
- else ()
444
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -pthread" )
445
- endif ()
470
+ endif ()
471
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -pthread" )
446
472
endif ()
447
473
endif ()
448
474
else ()
@@ -698,6 +724,11 @@ if (WIN32)
698
724
else ()
699
725
#This doesn't look to be needed for clang-15 builds
700
726
#set(PLATFORM_LIB "m")
727
+
728
+ #But this might be...
729
+ if (NOT "${CXXLIB} " STREQUAL "" )
730
+ target_link_libraries (decenttree ${CXXLIB} )
731
+ endif ()
701
732
endif ()
702
733
703
734
if (DECENTTREE_FLAGS MATCHES "libcxx" )
0 commit comments