Skip to content

Commit

Permalink
Merge pull request #12 from yhuang43/dev
Browse files Browse the repository at this point in the history
prepare for integration into FS
  • Loading branch information
ste93ste authored Mar 13, 2024
2 parents a7ae92d + b98fc8d commit 8087e69
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
17 changes: 15 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,22 @@ message(STATUS "ITK_DIR=${ITK_DIR} pybind11_DIR=${pybind11_DIR}")
# --------------------------------------------------
# build settings
# --------------------------------------------------
# set -DAPPLE_ARM64=ON on cmake command line for arm64 build
# when building with freesurfer, CMAKE_C_COMPILER and CMAKE_CXX_COMPILER will be specified on the cmake command line
if(APPLE_ARM64)
set(CMAKE_OSX_ARCHITECTURES "arm64")
add_definitions(-DARM64 -DDarwin -DPNG_ARM_NEON_OPT=0)
endif()
message(STATUS "CMAKE_C_COMPILER=${CMAKE_C_COMPILER}, CMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}, CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}, CMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID}")

# warnings
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -Wno-absolute-value -Wno-sign-compare -Wno-write-strings -Wno-unused-result -Wno-unused-parameter")
if(NOT APPLE_ARM64)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -Wno-absolute-value -Wno-sign-compare -Wno-write-strings -Wno-unused-result -Wno-unused-parameter")
endif()

# clang complains about -Wno-unused-but-set-variable and says to use -Wno-unused-const-variable
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-const-variable -Wno-inconsistent-missing-override")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-non-c-typedef-for-linkage -Wno-unused-const-variable -Wno-inconsistent-missing-override -Wno-self-assign-field -Wno-tautological-overlap-compare -Wno-tautological-compare -Wno-unused-value -Wno-range-loop-analysis -Wno-return-stack-address -Wno-dangling-gsl")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-variable")
endif()
Expand All @@ -75,6 +84,10 @@ if(PROFILING)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
endif()

message(STATUS "C/C++ standard set to ${CMAKE_CXX_STANDARD}, CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}")
message(STATUS "For HOST_OS=${HOST_OS} CMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID}")
message(STATUS "For HOST_OS=${HOST_OS} CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}")

# --------------------------------------------------
# build samseg
# --------------------------------------------------
Expand Down
12 changes: 9 additions & 3 deletions gems/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${GEMS_RUNTIME_PATH})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${GEMS_RUNTIME_PATH})

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "-fPIC -fpermissive -msse2 -mfpmath=sse")
if(NOT APPLE_ARM64)
set(CMAKE_CXX_FLAGS "-fPIC -fpermissive -msse2 -mfpmath=sse")
endif()

# SC 2023/04/04: Commented out as it causes problem with Windows build
# add_compile_options(-Wno-inconsistent-missing-override -Wno-self-assign-field)
if(NOT WIN32)
# SC 2023/04/04: Commented out as it causes problem with Windows build
add_compile_options(-Wno-inconsistent-missing-override -Wno-self-assign-field)
endif()

# to set additional debug cxxflags:
# export GEMS_DEBUG_CXXFLAG="-DGEMS_DEBUG_RASTERIZE_VOXEL_COUNT"
Expand Down Expand Up @@ -158,6 +162,8 @@ set(SOURCES_DYN
kvlAtlasMeshJacobianDeterminantDrawer.cxx
)

message(WARNING "ZLIB_LIBRARIES=${ZLIB_LIBRARIES} ITK_LIBRARIES=${ITK_LIBRARIES}")

# gems libary
add_library(kvlGEMSCommon ${SOURCES})
target_link_libraries(kvlGEMSCommon ${ZLIB_LIBRARIES} ${ITK_LIBRARIES})
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def run(self):
'-H.'
]
# Pass environment variables to CMake
for k in ['ITK_DIR', 'ZLIB_INCLUDE_DIR', 'ZLIB_LIBRARY']:
for k in ['ITK_DIR', 'ZLIB_INCLUDE_DIR', 'ZLIB_LIBRARY', 'pybind11_DIR', 'CMAKE_C_COMPILER', 'CMAKE_CXX_COMPILER', 'APPLE_ARM64', 'CMAKE_VERBOSE_MAKEFILE', 'CMAKE_RULE_MESSAGES']:
try:
path = os.path.abspath(os.environ[k].replace('"', ''))
except KeyError:
Expand Down

0 comments on commit 8087e69

Please sign in to comment.