Unverified Commit bc3fe80b authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

Merge pull request #1997 from giacomofiorin/lepton-windows-defines

Defines to build and link the Lepton library with MSVC
parents 4c870be4 250e3892
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -12,6 +12,8 @@ if(COLVARS_LEPTON)
  if(NOT BUILD_SHARED_LIBS)
    install(TARGETS lepton EXPORT LAMMPS_Targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
  endif()
  # Change the define below to LEPTON_BUILDING_SHARED_LIBRARY when linking Lepton as a DLL with MSVC
  target_compile_definitions(lepton PRIVATE -DLEPTON_BUILDING_STATIC_LIBRARY)
  set_target_properties(lepton PROPERTIES OUTPUT_NAME lammps_lepton${LAMMPS_MACHINE})
  target_include_directories(lepton PRIVATE ${LEPTON_DIR}/include)
endif()
@@ -27,6 +29,8 @@ target_link_libraries(lammps PRIVATE colvars)

if(COLVARS_LEPTON)
  target_link_libraries(lammps PRIVATE lepton)
  target_compile_options(colvars PRIVATE -DLEPTON)
  target_compile_definitions(colvars PRIVATE -DLEPTON)
  # Disable the line below when linking Lepton as a DLL with MSVC
  target_compile_definitions(colvars PRIVATE -DLEPTON_USE_STATIC_LIBRARIES)
  target_include_directories(colvars PUBLIC ${LEPTON_DIR}/include)
endif()
+17 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ ifeq ($(COLVARS_LEPTON),no)
LEPTON_INCFLAGS = 
COLVARS_OBJS = $(COLVARS_SRCS:.cpp=.o)
else
LEPTON_INCFLAGS = -Ilepton/include -DLEPTON
LEPTON_INCFLAGS = -Ilepton/include -DLEPTON -DLEPTON_USE_STATIC_LIBRARIES
COLVARS_OBJS = $(COLVARS_SRCS:.cpp=.o) $(LEPTON_SRCS:.cpp=.o)
endif

@@ -82,4 +82,20 @@ Makefile.deps: $(COLVARS_SRCS)
	  done

include Makefile.deps

# Exceptions to pattern rule above for Lepton objects

lepton/src/CompiledExpression.o: lepton/src/CompiledExpression.cpp
	$(CXX) $(CXXFLAGS) -Ilepton/include -DLEPTON_BUILDING_STATIC_LIBRARY -c -o $@ $<
lepton/src/ExpressionProgram.o: lepton/src/ExpressionProgram.cpp
	$(CXX) $(CXXFLAGS) -Ilepton/include -DLEPTON_BUILDING_STATIC_LIBRARY -c -o $@ $<
lepton/src/ExpressionTreeNode.o: lepton/src/ExpressionTreeNode.cpp
	$(CXX) $(CXXFLAGS) -Ilepton/include -DLEPTON_BUILDING_STATIC_LIBRARY -c -o $@ $<
lepton/src/Operation.o: lepton/src/Operation.cpp
	$(CXX) $(CXXFLAGS) -Ilepton/include -DLEPTON_BUILDING_STATIC_LIBRARY -c -o $@ $<
lepton/src/ParsedExpression.o: lepton/src/ParsedExpression.cpp
	$(CXX) $(CXXFLAGS) -Ilepton/include -DLEPTON_BUILDING_STATIC_LIBRARY -c -o $@ $<
lepton/src/Parser.o: lepton/src/Parser.cpp
	$(CXX) $(CXXFLAGS) -Ilepton/include -DLEPTON_BUILDING_STATIC_LIBRARY -c -o $@ $<

include Makefile.lepton.deps # Hand-generated